dukcapil/migrations/000043_add_revision_number_to_attachments_and_approvals.up.sql
2025-10-13 08:46:26 +07:00

15 lines
641 B
PL/PgSQL

BEGIN;
-- Add revision_number to letter_outgoing_attachments
ALTER TABLE letter_outgoing_attachments
ADD COLUMN IF NOT EXISTS revision_number INTEGER NOT NULL DEFAULT 0;
-- Add revision_number to letter_outgoing_approvals
ALTER TABLE letter_outgoing_approvals
ADD COLUMN IF NOT EXISTS revision_number INTEGER NOT NULL DEFAULT 0;
-- Create indexes for better query performance
CREATE INDEX IF NOT EXISTS idx_letter_outgoing_attachments_revision ON letter_outgoing_attachments(letter_id, revision_number);
CREATE INDEX IF NOT EXISTS idx_letter_outgoing_approvals_revision ON letter_outgoing_approvals(letter_id, revision_number);
COMMIT;