diff --git a/pkg/amigo/amigo.go b/pkg/amigo/amigo.go index 2de75be..3f88e7c 100644 --- a/pkg/amigo/amigo.go +++ b/pkg/amigo/amigo.go @@ -219,7 +219,7 @@ func (a Amigo) GenerateMigrationsFiles(writer io.Writer) error { // GetStatus return the state of the database func (a Amigo) GetStatus(db *sql.DB) ([]string, error) { - rows, err := db.Query("SELECT id FROM " + a.ctx.SchemaVersionTable + " ORDER BY id desc") + rows, err := db.Query("SELECT version FROM " + a.ctx.SchemaVersionTable + " ORDER BY version desc") if err != nil { return nil, fmt.Errorf("unable to get state: %w", err) } diff --git a/pkg/templates/migrations.go.tmpl b/pkg/templates/migrations.go.tmpl index 4e02a5e..26ecff1 100644 --- a/pkg/templates/migrations.go.tmpl +++ b/pkg/templates/migrations.go.tmpl @@ -7,9 +7,10 @@ import ( "embed" {{if .ImportSchemaPackage}}"{{ .ImportSchemaPackage }}"{{end}} ) - +{{if .ImportSchemaPackage}} //go:embed *.sql var sqlMigrationsFS embed.FS +{{end}} var Migrations = []schema.Migration{ {{- range .Migrations }}