mirror of
https://github.com/therootcompany/golib.git
synced 2026-11-04 06:55:00 +00:00
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:
parent
3461dcbc7d
commit
657b899f1a
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user