Skip to content

Prevent future timestamps in migration filenames

Thong Kuah requested to merge ban_far_future_migration_timestamps into master

What does this MR do?

Prevents future timestamps such as !60720 (merged)

Future timestamps are an issue because Rails generates the next migration by getting the latest migration timestamp + 1.

See also gitlab-com/gl-infra/production#4569 (closed).

A failure will look something like:

$ scripts/validate_migration_timestamps 
Traceback (most recent call last):
	4: from scripts/validate_migration_timestamps:12:in `<main>'
	3: from scripts/validate_migration_timestamps:12:in `each'
	2: from scripts/validate_migration_timestamps:13:in `block in <main>'
	1: from scripts/validate_migration_timestamps:13:in `each'
scripts/validate_migration_timestamps:21:in `block (2 levels) in <main>': db/migrate/20260421104930_add_index_to_epic_board_recent_visits.rb has a future timestamp (RuntimeError)

Example failing job: https://gitlab.com/gitlab-org/gitlab/-/jobs/1261789605#L87 https://gitlab.com/gitlab-org/gitlab/-/jobs/1253099791#L77

Thanks to @leetickett for this suggestion

Related to #330636 (closed)

Edited by Thong Kuah

Merge request reports