add revision number
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
BEGIN;
|
||||
|
||||
DROP INDEX IF EXISTS idx_letters_outgoing_revision_number;
|
||||
|
||||
ALTER TABLE letters_outgoing
|
||||
DROP COLUMN IF EXISTS revision_number;
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,8 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE letters_outgoing
|
||||
ADD COLUMN IF NOT EXISTS revision_number INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_letters_outgoing_revision_number ON letters_outgoing(revision_number);
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,14 @@
|
||||
BEGIN;
|
||||
|
||||
-- Drop indexes
|
||||
DROP INDEX IF EXISTS idx_letter_outgoing_attachments_revision;
|
||||
DROP INDEX IF EXISTS idx_letter_outgoing_approvals_revision;
|
||||
|
||||
-- Remove revision_number from tables
|
||||
ALTER TABLE letter_outgoing_attachments
|
||||
DROP COLUMN IF EXISTS revision_number;
|
||||
|
||||
ALTER TABLE letter_outgoing_approvals
|
||||
DROP COLUMN IF EXISTS revision_number;
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,15 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user