Skip to content

Commit f1c7805

Browse files
authored
Idempotent migrate command (#805)
This PR makes the command `migrate` idempotent. If there is an active migration, `pgroll` does not return an error. The command just returns and lets the user know that there is an active migration. Closes #798
1 parent b77c05c commit f1c7805

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmd/migrate.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ func migrateCmd() *cobra.Command {
5252
return fmt.Errorf("unable to determine active migration period: %w", err)
5353
}
5454
if active {
55-
return fmt.Errorf("migration %q is active and must be completed first", *latestVersion)
55+
fmt.Printf("migration %q is active\n", *latestVersion)
56+
return nil
5657
}
5758

5859
info, err := os.Stat(migrationsDir)

0 commit comments

Comments
 (0)