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
This commit is contained in:
Ian Littman 2025-11-24 15:49:10 -06:00 committed by GitHub
parent cb26f43472
commit 662b346d5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -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
}

View file

@ -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 {