summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2014-11-21 15:15:21 +0000
committerValery Sizov <valery@gitlab.com>2014-11-21 15:15:21 +0000
commita7ddcab7aabaf9ca01499844100ca8bd2acae3e6 (patch)
treeca2171d98e9a5fcbe7e9410e57a77c1e33740e52
parente4af2b3db578fb04c5363ca6fbca9e90e78986c8 (diff)
parent4053c055beb7d88f9e22ca4187b9868a40030b00 (diff)
downloadgitlab-ce-a7ddcab7aabaf9ca01499844100ca8bd2acae3e6.tar.gz
Merge branch 'members_table_timestamps' into 'master'
Add missing timestamps to the 'members' table In 20140914145549_migrate_to_new_members_model.rb we forgot to set the created_at and updated_at times for new records in the 'members' table. This became a problem after commit c8e78d972a5a628870eefca0f2ccea0199c55bda which was added in GitLab 7.5. With this migration we ensure that all rows in 'members' have at least some created_at and updated_at timestamp. See merge request !1272
-rw-r--r--CHANGELOG1
-rw-r--r--db/migrate/20141121133009_add_timestamps_to_members.rb15
-rw-r--r--db/schema.rb2
3 files changed, 17 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index cc94e1af486..f321c9c32a1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -41,6 +41,7 @@ v 7.5.0
- Display renamed files in diff views (Vinnie Okada)
- Fix raw view for public snippets
- Use secret token with GitLab internal API.
+ - Add missing timestamps to 'members' table
v 7.4.3
- Fix raw snippets view
diff --git a/db/migrate/20141121133009_add_timestamps_to_members.rb b/db/migrate/20141121133009_add_timestamps_to_members.rb
new file mode 100644
index 00000000000..ef6d4dedf32
--- /dev/null
+++ b/db/migrate/20141121133009_add_timestamps_to_members.rb
@@ -0,0 +1,15 @@
+# In 20140914145549_migrate_to_new_members_model.rb we forgot to set the
+# created_at and updated_at times for new records in the 'members' table. This
+# became a problem after commit c8e78d972a5a628870eefca0f2ccea0199c55bda which
+# was added in GitLab 7.5. With this migration we ensure that all rows in
+# 'members' have at least some created_at and updated_at timestamp.
+class AddTimestampsToMembers < 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 8ddebc5132a..68d1080b6ee 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: 20141007100818) do
+ActiveRecord::Schema.define(version: 20141121133009) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"