fix(shmigrate): restore missing-file comment, remove || true from sync

- Add # ERROR: MISSING FILE comment in generated script when a
  migration file doesn't exist (feature-branch friendly: script
  still includes the command, user decides what to do)
- Remove || true from sync lines — if the log sync query fails,
  something is seriously wrong and the script should fail
This commit is contained in:
AJ ONeal 2026-04-06 00:37:19 -06:00
parent 3461dcbc7d
commit 657b899f1a
No known key found for this signature in database

View File

@ -77,8 +77,11 @@ func (r *Migrator) exec(name, suffix, label string) error {
logPath := unclean(r.LogPath) logPath := unclean(r.LogPath)
fmt.Fprintf(r.Writer, "# %s %s\n", label, name) fmt.Fprintf(r.Writer, "# %s %s\n", label, name)
if _, err := os.Stat(filepath.Join(r.MigrationsDir, name+suffix)); err != nil {
fmt.Fprintln(r.Writer, "# ERROR: MISSING FILE")
}
fmt.Fprintln(r.Writer, cmd) fmt.Fprintln(r.Writer, cmd)
fmt.Fprintf(r.Writer, "%s > %s || true\n", syncCmd, logPath) fmt.Fprintf(r.Writer, "%s > %s\n", syncCmd, logPath)
fmt.Fprintln(r.Writer) fmt.Fprintln(r.Writer)
return nil return nil