Phase 9, part 3: schema migrations for both databases
Migrations from schema 30 on are one list (internal/db/migrations.go), written in SQLite's SQL and translated for Postgres (db.PostgresSQL) unless one gives its own. On Postgres the whole migration is one transaction under an advisory lock, and each step is recorded in schema_migrations. TestSchemasMatch compares the two schemas (tables, columns, types, NOT NULL, nocase, indexes), with and without a new migration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,11 @@ type DB struct {
|
||||
SQL *sql.DB
|
||||
Dialect Dialect
|
||||
|
||||
// MigratedFrom is the schema version the database was at when opened,
|
||||
// if Open migrated it (0 if it was new or already current), for the
|
||||
// log.
|
||||
MigratedFrom int
|
||||
|
||||
closeHook func() error // tests on Postgres: drop the test's schema
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user