Better comments
This commit is contained in:
parent
342d84bb04
commit
743dafb1b6
6
main.go
6
main.go
@ -6,17 +6,21 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// create a migrator, connecting to the postgresql
|
||||||
|
// database defined by the environment variable
|
||||||
migrator, err := migrations.NewMigrator(os.Getenv("DB_DNS"))
|
migrator, err := migrations.NewMigrator(os.Getenv("DB_DNS"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get the current migration status
|
||||||
now, exp, info, err := migrator.Info()
|
now, exp, info, err := migrator.Info()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if now < exp {
|
if now < exp {
|
||||||
// migration is required, dump out the current state and perform the migration
|
// migration is required, dump out the current state
|
||||||
|
// and perform the migration
|
||||||
println("migration needed, current state:")
|
println("migration needed, current state:")
|
||||||
println(info)
|
println(info)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user