Skip to content

Commit

Permalink
update logSep to force redeployment...
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisgsmith committed Sep 19, 2024
1 parent ea62e56 commit 481a447
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions api/internal/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,19 @@ type Version struct {
*version.Version
}

const logSep = "-----------------------------------------"

func (s migrationService) Run(ctx context.Context) {
start := time.Now()

if err := s.migrate(ctx); err != nil {
log.Println()
log.Print(logSep)
log.Print("ERROR ENCOUNTERED; ROLLED BACK MIGRATIONS")
log.Fatal(err.Error())
}

end := time.Now()
log.Println()
log.Print(logSep)
log.Printf("SUCCESSFULLY COMPLETED DATABASE MIGRATIONS IN %s", end.Sub(start))
}

Expand Down Expand Up @@ -194,7 +196,7 @@ func (s migrationService) migrate(ctx context.Context) error {
slices.SortFunc(schemaMigrations, sortFileBySemver)

log.Printf("VALIDATING %d EXISTING VERSIONED MIGRATIONS...", len(history))
log.Println()
log.Print(logSep)
for _, m := range schemaMigrations {
n := m.Prefix + "/" + m.File.Name()

Expand Down Expand Up @@ -255,9 +257,9 @@ func (s migrationService) migrate(ctx context.Context) error {
action = "INITIALIZING"
}

log.Println()
log.Print(logSep)
log.Printf("%s %d NEW VERSIONED MIGRATIONS...", action, len(migrationsNew))
log.Println()
log.Print(logSep)
for _, m := range migrationsNew {
content, err := fs.ReadFile(s.cfg.MigrationsDir, m.Filename)
if err != nil {
Expand Down Expand Up @@ -299,9 +301,9 @@ func (s migrationService) migrate(ctx context.Context) error {
return repeat[i].Name() < repeat[j].Name()
})

log.Println()
log.Print(logSep)
log.Printf("APPLYING %d REPEAT MIGRATIONS...", len(repeat))
log.Println()
log.Print(logSep)
for _, f := range repeat {
n := "repeat/" + f.Name()
content, err := fs.ReadFile(s.cfg.MigrationsDir, n)
Expand Down

0 comments on commit 481a447

Please sign in to comment.