Clean up for blog presentation
This commit is contained in:
parent
743dafb1b6
commit
1fc1c27267
6
README.md
Normal file
6
README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# Embedding PostgreSQL migrations in a Go binary
|
||||
|
||||
This is the example project for my [blog entry](https://hawkins.id.au/posts/embedded_sql_migrations_with_tern/).
|
||||
|
||||
It shows how to embed SQL migrations and the [tern](https://github.com/JackC/tern) migration tool
|
||||
into your own Go program.
|
@ -25,9 +25,11 @@ func NewMigrator(dbDNS string) (Migrator, error) {
|
||||
if err != nil {
|
||||
return Migrator{}, err
|
||||
}
|
||||
migrator, err := migrate.NewMigratorEx(context.Background(), conn, versionTable, &migrate.MigratorOptions{
|
||||
DisableTx: false,
|
||||
})
|
||||
migrator, err := migrate.NewMigratorEx(
|
||||
context.Background(), conn, versionTable,
|
||||
&migrate.MigratorOptions{
|
||||
DisableTx: false,
|
||||
})
|
||||
if err != nil {
|
||||
return Migrator{}, err
|
||||
}
|
||||
@ -63,7 +65,10 @@ func (m Migrator) Info() (int32, int32, string, error) {
|
||||
if cur {
|
||||
indicator = "->"
|
||||
}
|
||||
info = info + fmt.Sprintf("%2s %3d %s\n", indicator, thisMigration.Sequence, thisMigration.Name)
|
||||
info = info + fmt.Sprintf(
|
||||
"%2s %3d %s\n",
|
||||
indicator,
|
||||
thisMigration.Sequence, thisMigration.Name)
|
||||
}
|
||||
|
||||
return version, last, info, nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user