From eeee93e4648c4960ca8f3670333a97a1e1e82b95 Mon Sep 17 00:00:00 2001 From: Sacha Al Himdani Date: Thu, 9 Apr 2026 20:16:26 +0200 Subject: [PATCH] Drop legacy document columns and approver tables 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 --- pkg/coredata/migrations/20260319T160000Z.sql | 3 --- pkg/coredata/migrations/20260328T120000Z.sql | 1 - pkg/coredata/migrations/20260331T120000Z.sql | 1 - pkg/coredata/migrations/20260407T120000Z.sql | 1 - pkg/coredata/migrations/20260409T130000Z.sql | 22 ++++++++++++++++++++ 5 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 pkg/coredata/migrations/20260409T130000Z.sql diff --git a/pkg/coredata/migrations/20260319T160000Z.sql b/pkg/coredata/migrations/20260319T160000Z.sql index ce5d8189a..dde3c0adc 100644 --- a/pkg/coredata/migrations/20260319T160000Z.sql +++ b/pkg/coredata/migrations/20260319T160000Z.sql @@ -104,6 +104,3 @@ LEFT JOIN document_approvers da ON da.document_id = dv.document_id WHERE dv.status = 'PUBLISHED' AND COALESCE(dva.approver_profile_id, da.approver_profile_id) IS NOT NULL ON CONFLICT (quorum_id, approver_id) DO NOTHING; - --- TODO: DROP TABLE document_version_approvers once confirmed safe --- TODO: DROP TABLE document_approvers once confirmed safe diff --git a/pkg/coredata/migrations/20260328T120000Z.sql b/pkg/coredata/migrations/20260328T120000Z.sql index ecdc95ce2..d3249c859 100644 --- a/pkg/coredata/migrations/20260328T120000Z.sql +++ b/pkg/coredata/migrations/20260328T120000Z.sql @@ -1,2 +1 @@ --- TODO: drop the classification column from documents. ALTER TABLE documents ALTER COLUMN classification SET DEFAULT 'SECRET'; diff --git a/pkg/coredata/migrations/20260331T120000Z.sql b/pkg/coredata/migrations/20260331T120000Z.sql index e38b0c60f..e36656425 100644 --- a/pkg/coredata/migrations/20260331T120000Z.sql +++ b/pkg/coredata/migrations/20260331T120000Z.sql @@ -8,5 +8,4 @@ WHERE dv.document_id = d.id; ALTER TABLE document_versions ALTER COLUMN document_type DROP DEFAULT; --- TODO: drop the document_type column from documents. ALTER TABLE documents ALTER COLUMN document_type SET DEFAULT 'OTHER'; diff --git a/pkg/coredata/migrations/20260407T120000Z.sql b/pkg/coredata/migrations/20260407T120000Z.sql index 46a9001ef..aad927f6a 100644 --- a/pkg/coredata/migrations/20260407T120000Z.sql +++ b/pkg/coredata/migrations/20260407T120000Z.sql @@ -12,7 +12,6 @@ -- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. --- TODO: drop the title column from documents. ALTER TABLE documents ALTER COLUMN title DROP NOT NULL; ALTER TABLE documents DROP COLUMN description; diff --git a/pkg/coredata/migrations/20260409T130000Z.sql b/pkg/coredata/migrations/20260409T130000Z.sql new file mode 100644 index 000000000..ee3799ac6 --- /dev/null +++ b/pkg/coredata/migrations/20260409T130000Z.sql @@ -0,0 +1,22 @@ +-- Copyright (c) 2026 Probo Inc . +-- +-- Permission to use, copy, modify, and/or distribute this software for any +-- purpose with or without fee is hereby granted, provided that the above +-- copyright notice and this permission notice appear in all copies. +-- +-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. + +-- Drop legacy columns from documents that have been moved to document_versions. +ALTER TABLE documents DROP COLUMN title; +ALTER TABLE documents DROP COLUMN classification; +ALTER TABLE documents DROP COLUMN document_type; + +-- Drop legacy approver tables replaced by approval quorums/decisions. +DROP TABLE document_version_approvers; +DROP TABLE document_approvers;