Skip to content

Commit

Permalink
feat: create sql migrations and apply them
Browse files Browse the repository at this point in the history
- CreateSQLMigrations() writes up- and down- SQL to migration files in the migrations directory
- Migrate() generates migration files and applies them, creating a corresponding entry in the database
- Run() is deprecated. It was decided that AutoMigrator will not support in-place migrations for now
- no-op operations produce a comment in the down files if the an operation is not reversible
  • Loading branch information
bevzzz committed Nov 4, 2024
1 parent 245e968 commit 1bf7cfd
Show file tree
Hide file tree
Showing 5 changed files with 247 additions and 83 deletions.
2 changes: 1 addition & 1 deletion internal/dbtest/inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestDatabaseInspector_Inspect(t *testing.T) {
testEachDB(t, func(t *testing.T, dbName string, db *bun.DB) {
db.RegisterModel((*PublisherToJournalist)(nil))

dbInspector, err := sqlschema.NewInspector(db)
dbInspector, err := sqlschema.NewInspector(db, migrationsTable, migrationLocksTable)
if err != nil {
t.Skip(err)
}
Expand Down
Loading

0 comments on commit 1bf7cfd

Please sign in to comment.