diff options
author | Nick Thomas <nick@gitlab.com> | 2016-08-04 15:27:53 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-08-04 15:27:53 +0100 |
commit | f301d547c2a3ca2a3f1fd07f9ddc4eb451e70244 (patch) | |
tree | bc5f38e80ff419052377e7b7ee80ecf78b079285 /db | |
parent | db69111a63cfadb31cc02cf4400d743a913bdfbd (diff) | |
download | gitlab-ce-f301d547c2a3ca2a3f1fd07f9ddc4eb451e70244.tar.gz |
Add a data migration to fix some missing timestamps in the members table (again)
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20160804150737_add_timestamps_to_members_again.rb | 20 | ||||
-rw-r--r-- | db/schema.rb | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/db/migrate/20160804150737_add_timestamps_to_members_again.rb b/db/migrate/20160804150737_add_timestamps_to_members_again.rb new file mode 100644 index 00000000000..60f4e7af90f --- /dev/null +++ b/db/migrate/20160804150737_add_timestamps_to_members_again.rb @@ -0,0 +1,20 @@ +# rubocop:disable all +# 20141121133009_add_timestamps_to_members.rb was meant to ensure that all +# rows in the members table had created_at and updated_at set, following an +# error in a previous migration. This failed to set all rows in at least one +# case: https://gitlab.com/gitlab-org/gitlab-ce/issues/20568 +# +# Why this happened is lost in the mists of time, so repeat the SQL query +# without speculation, just in case more than one person was affected. +class AddTimestampsToMembersAgain < ActiveRecord::Migration + + def up + execute "UPDATE members SET created_at = NOW() WHERE created_at IS NULL" + execute "UPDATE members SET updated_at = NOW() WHERE updated_at IS NULL" + end + + def down + # no change + end + +end diff --git a/db/schema.rb b/db/schema.rb index dc28842758a..71980a6d51f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160802010328) do +ActiveRecord::Schema.define(version: 20160804150737) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |