From 662b346d5a0a2b17bfc356544a3335be5bd496e0 Mon Sep 17 00:00:00 2001 From: Ian Littman Date: Mon, 24 Nov 2025 15:49:10 -0600 Subject: [PATCH] Use UTC timestamps for DB migrations (#36228) No changes file because this is just a tooling change rather than a functionality change. - [x] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) ## Testing - [x] QA'd all new/changed functionality manually --- server/goose/create.go | 2 +- tools/bump-migration/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/goose/create.go b/server/goose/create.go index 5dd943044f..10cbba636f 100644 --- a/server/goose/create.go +++ b/server/goose/create.go @@ -8,7 +8,7 @@ import ( // Create writes a new blank migration file. func Create(db *sql.DB, dir, name, migrationType string) error { - paths, err := CreateMigration(name, migrationType, dir, time.Now()) + paths, err := CreateMigration(name, migrationType, dir, time.Now().UTC()) if err != nil { return err } diff --git a/tools/bump-migration/main.go b/tools/bump-migration/main.go index 9d7b8630b6..602bdc89ca 100644 --- a/tools/bump-migration/main.go +++ b/tools/bump-migration/main.go @@ -56,7 +56,7 @@ func main() { if _, err := time.Parse(timeFormat, oldTimestamp); err != nil { log.Fatalf("Bad filename pattern, '%s' is not a valid timestamp in '%s'", oldTimestamp, sourceFilename) } - newTimestamp := time.Now().Format(timeFormat) + newTimestamp := time.Now().UTC().Format(timeFormat) newMig, newTest, err := renameMigrationFiles(migrationsDir, sourceFilename, oldTimestamp, newTimestamp) if err != nil {