The title, classification, and document_type columns have been moved to document_versions. The document_approvers and document_version_approvers tables have been replaced by approval quorums and decisions. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
12 lines
429 B
SQL
12 lines
429 B
SQL
-- Add document_type column to document_versions, copying from parent document.
|
|
ALTER TABLE document_versions ADD COLUMN document_type document_type NOT NULL DEFAULT 'OTHER';
|
|
|
|
UPDATE document_versions dv
|
|
SET document_type = d.document_type
|
|
FROM documents d
|
|
WHERE dv.document_id = d.id;
|
|
|
|
ALTER TABLE document_versions ALTER COLUMN document_type DROP DEFAULT;
|
|
|
|
ALTER TABLE documents ALTER COLUMN document_type SET DEFAULT 'OTHER';
|