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:
zhenyi
2026-06-10 18:48:43 +08:00
parent d98e4d59e3
commit d6c468a9fc
11 changed files with 203 additions and 947 deletions
+13
View File
@@ -0,0 +1,13 @@
-- Add repository-level feature toggles, merge settings, topics, and homepage.
-- models/repos/repo.rs → repo
ALTER TABLE repo ADD COLUMN IF NOT EXISTS topics TEXT[] NOT NULL DEFAULT '{}';
ALTER TABLE repo ADD COLUMN IF NOT EXISTS homepage TEXT;
ALTER TABLE repo ADD COLUMN IF NOT EXISTS has_issues BOOLEAN NOT NULL DEFAULT true;
ALTER TABLE repo ADD COLUMN IF NOT EXISTS has_wiki BOOLEAN NOT NULL DEFAULT true;
ALTER TABLE repo ADD COLUMN IF NOT EXISTS has_pull_requests BOOLEAN NOT NULL DEFAULT true;
ALTER TABLE repo ADD COLUMN IF NOT EXISTS allow_forking BOOLEAN NOT NULL DEFAULT true;
ALTER TABLE repo ADD COLUMN IF NOT EXISTS allow_merge_commit BOOLEAN NOT NULL DEFAULT true;
ALTER TABLE repo ADD COLUMN IF NOT EXISTS allow_squash_merge BOOLEAN NOT NULL DEFAULT true;
ALTER TABLE repo ADD COLUMN IF NOT EXISTS allow_rebase_merge BOOLEAN NOT NULL DEFAULT true;
ALTER TABLE repo ADD COLUMN IF NOT EXISTS delete_branch_on_merge BOOLEAN NOT NULL DEFAULT false;