Files
probo/pkg/coredata/migrations/20260407T120000Z.sql
Sacha Al Himdani eeee93e464 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 <sacha@getprobo.com>
2026-04-13 18:10:14 +02:00

29 lines
1.2 KiB
SQL

-- Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
--
-- 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.
ALTER TABLE documents ALTER COLUMN title DROP NOT NULL;
ALTER TABLE documents DROP COLUMN description;
-- Move search_vector from documents to document_versions.
DROP INDEX documents_search_idx;
ALTER TABLE documents DROP COLUMN search_vector;
ALTER TABLE document_versions ADD COLUMN search_vector tsvector
GENERATED ALWAYS AS (
to_tsvector('simple', COALESCE(title, ''))
) STORED;
CREATE INDEX document_versions_search_idx ON document_versions USING gin(search_vector);