feat(db): add sqlx migrate feature and renumber migration files
- Add 'migrate' feature to sqlx dependency - Renumber migrations to fix duplicate version numbers (two 014 files) - Re-sequence migrations 009-012 for continuous ordering - Add ALTER TABLE ADD COLUMN IF NOT EXISTS baseline for notification table to handle existing databases missing newer columns - Remove deleted IM migration files (009-012) that were superseded
This commit is contained in:
@@ -1905,6 +1905,17 @@ CREATE TABLE IF NOT EXISTS notification (
|
||||
deleted_at TIMESTAMPTZ NULL
|
||||
|
||||
);
|
||||
ALTER TABLE notification ADD COLUMN IF NOT EXISTS repo_id UUID NULL REFERENCES repo(id) ON DELETE CASCADE;
|
||||
ALTER TABLE notification ADD COLUMN IF NOT EXISTS issue_id UUID NULL REFERENCES issue(id) ON DELETE CASCADE;
|
||||
ALTER TABLE notification ADD COLUMN IF NOT EXISTS pull_request_id UUID NULL REFERENCES pull_request(id) ON DELETE CASCADE;
|
||||
ALTER TABLE notification ADD COLUMN IF NOT EXISTS channel_id UUID NULL REFERENCES channel(id) ON DELETE CASCADE;
|
||||
ALTER TABLE notification ADD COLUMN IF NOT EXISTS message_id UUID NULL REFERENCES message(id) ON DELETE CASCADE;
|
||||
ALTER TABLE notification ADD COLUMN IF NOT EXISTS target_type TEXT NULL;
|
||||
ALTER TABLE notification ADD COLUMN IF NOT EXISTS target_id UUID NULL;
|
||||
ALTER TABLE notification ADD COLUMN IF NOT EXISTS action_url TEXT NULL;
|
||||
ALTER TABLE notification ADD COLUMN IF NOT EXISTS priority TEXT NOT NULL DEFAULT 'normal';
|
||||
ALTER TABLE notification ADD COLUMN IF NOT EXISTS metadata JSONB NULL;
|
||||
ALTER TABLE notification ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMPTZ NULL;
|
||||
CREATE INDEX IF NOT EXISTS idx_notification_user_id ON notification (user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_notification_actor_id ON notification (actor_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_notification_workspace_id ON notification (workspace_id);
|
||||
|
||||
Reference in New Issue
Block a user