Skip to content
This repository was archived by the owner on Apr 11, 2023. It is now read-only.

Commit 4058c1f

Browse files
author
Kate Döen
committed
Fix checking for auto-reset on apply
1 parent 45d4b89 commit 4058c1f

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

cmd/apply.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,6 @@ func NewApplyCommand() *cobra.Command {
9393
}
9494
}
9595

96-
schemaMigrationsTableExists, err := internal.CheckTableExists(ctx, conn, "public", "schema_migrations")
97-
if err != nil {
98-
return fmt.Errorf("failed to check if public.schema_migrations exists: %w", err)
99-
}
100-
101-
if schemaMigrationsTableExists != databaseExists {
102-
//nolint:lll,goerr113
103-
return fmt.Errorf("something is wrong, the database and the schema_migrations table should always exist or not exist together")
104-
}
105-
10696
for _, u := range config.DatabaseUsers {
10797
var userExists bool
10898
userExists, err = internal.CheckUserExists(ctx, conn, u)
@@ -142,7 +132,7 @@ func NewApplyCommand() *cobra.Command {
142132
return fmt.Errorf("failed to initialize go-migrate: %w", err)
143133
}
144134

145-
if resetDatabase || (!databaseExists && !schemaMigrationsTableExists) {
135+
if resetDatabase || !databaseExists {
146136
var files []os.DirEntry
147137
files, err = os.ReadDir(migrationsDir)
148138
if err != nil {

0 commit comments

Comments
 (0)