diff options
Diffstat (limited to 'danger/database/Dangerfile')
-rw-r--r-- | danger/database/Dangerfile | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile index 96134ea66a6..1c0e9d72118 100644 --- a/danger/database/Dangerfile +++ b/danger/database/Dangerfile @@ -35,6 +35,15 @@ DB_MIGRATION_TESTING_REQUIRED_MESSAGE = <<~MSG requesting review to test your migrations against production data. MSG +DB_OLD_MIGRATIONS_MESSAGE = <<~MSG + ⌛ **Migration Timestamp Out of Date** + The following migrations have timestamps that are over three weeks old: + + %<old_migrations>s + + Please double check the timestamps and update them if possible. [Why does this matter?](https://docs.gitlab.com/ee/development/migration_style_guide.html#migration-timestamp-age) +MSG + DATABASE_APPROVED_LABEL = 'database::approved' non_geo_db_schema_updated = !git.modified_files.grep(%r{\Adb/structure\.sql}).empty? @@ -77,3 +86,11 @@ if helper.mr_labels.include?('database') || db_paths_to_review.any? helper.labels_to_add << 'database::review pending' end end + +cutoff = Date.today - 21 # Three weeks ago + +old_migrations = database.find_migration_files_before(git.added_files, cutoff) + +if old_migrations.any? + warn format(DB_OLD_MIGRATIONS_MESSAGE, old_migrations: old_migrations.map { |m| "* #{m}" }.join("\n")) +end |