summaryrefslogtreecommitdiff
path: root/db/migrate/20210616134905_add_timestamp_to_schema_migration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20210616134905_add_timestamp_to_schema_migration.rb')
-rw-r--r--db/migrate/20210616134905_add_timestamp_to_schema_migration.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20210616134905_add_timestamp_to_schema_migration.rb b/db/migrate/20210616134905_add_timestamp_to_schema_migration.rb
new file mode 100644
index 00000000000..7086b20c48f
--- /dev/null
+++ b/db/migrate/20210616134905_add_timestamp_to_schema_migration.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddTimestampToSchemaMigration < ActiveRecord::Migration[6.1]
+ def up
+ # Add a nullable column with default null first
+ add_column :schema_migrations, :finished_at, :timestamptz
+
+ # Change default to NOW() for new records
+ change_column_default :schema_migrations, :finished_at, -> { 'NOW()' }
+ end
+
+ def down
+ remove_column :schema_migrations, :finished_at
+ end
+end