You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Push to `main` → GitHub Actions runs Rust tests + admin-ui tests → builds Docker image → deploys to Fly.io.
30
+
31
+
## Migrations (`migration/`)
32
+
33
+
### Rules (violations here cause hard-to-fix production incidents)
34
+
35
+
**One DDL statement per file.**
36
+
Never combine `CREATE TABLE` + `CREATE INDEX`, multiple `ALTER TABLE`s, etc. in a single migration. SeaORM does NOT wrap SQLite migrations in a transaction — if a multi-step migration fails mid-way, the already-executed DDL commits immediately and cannot be rolled back. The migration is then not recorded in `seaql_migrations`, so on the next run it retries from the top and fails again on the already-applied step. A single-statement migration is either fully applied or not applied at all.
37
+
38
+
**Always use `.if_not_exists()`.**
39
+
Every `Table::create()` must have `.if_not_exists()`. Every `Index::create()` must have `.if_not_exists()`. This makes migrations safe to retry if a previous run applied the DDL but crashed before recording in `seaql_migrations`.
40
+
41
+
**Always name indexes.**
42
+
SQLite requires a name for every `CREATE INDEX`. A nameless `Index::create()` generates `CREATE INDEX ON ...` which is a syntax error in SQLite. Always call `.name("idx_<table>_<column>")` before `.table(...)`.
43
+
44
+
**Never rename or delete a migration file that has been applied.**
45
+
SeaORM records the file name (without extension) as the migration version in `seaql_migrations`. Renaming or deleting a file whose version is already recorded causes a fatal startup error: "Migration file of version '...' is missing". If you need to change what a migration does, add a new migration — never touch old ones.
46
+
47
+
**Never touch the SQLite DB directly.**
48
+
Never run `rm *.db`, `DROP TABLE`, `DELETE FROM`, `DROP COLUMN`, or modify `seaql_migrations` yourself. If the DB needs manual intervention (e.g. a partial migration left stale state), ask the user to do it. Describe exactly what SQL to run and why.
0 commit comments