Move schema_migrations table creation into 000.sql with INTEGER version column #56
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Per sneak/pixa PR #36, the standard migrations pattern should be:
schema_migrationstable DDL lives in000.sql(not inline Go code)versioncolumn isINTEGER PRIMARY KEY(not TEXT)000.sqlis self-contained — contains bothCREATE TABLE IF NOT EXISTSandINSERT OR IGNORE INTO schema_migrations (version) VALUES (0)000.sqlThis repo currently creates the migrations table inline in Go code. It should be moved to follow the pixa pattern.
Reference implementation: sneak/pixa
000.sqlanddatabase.go.Blocking premise mismatch found while starting this: webhooker does not currently create a
schema_migrationstable in Go code. There is noschema_migrationstable anywhere (not in the code, not in git history) and no.sqlmigration files. Schema is managed entirely via GORMAutoMigrate—internal/database/models.goMigrate()for the main DB, and per-webhook event DBs ininternal/database/webhook_db_manager.go. So there is nothing to "move" into000.sql.Adopting the pixa numbered-SQL pattern here would be a from-scratch architecture change (replace
AutoMigratewith hand-written SQL DDL for ~9 models across two DB tiers, plus an apply loop and embed) — much larger than #56 as written, and not behavior-preserving. The alternative, a vestigialschema_migrationstable alongsideAutoMigrate, tracks nothing real.Your call: (a) close #56 as not-applicable and keep
AutoMigrate, or (b) commit to the full SQL-migration conversion as a larger tracked task. Recommend (a) unless you specifically want SQL-file migrations. Assigning to you.