summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2016-08-30 22:44:11 +0300
committerValery Sizov <valery@gitlab.com>2016-08-30 23:50:22 +0300
commita476e6f5e53c54bcc74a482f0695564713da7dd0 (patch)
tree6ad9308cdb4313c2b3f0c24436fd65851d034f5d /db/migrate
parentdafbcf63bd4eb7a90b611b9054d7de7832e3c97a (diff)
downloadgitlab-ce-a476e6f5e53c54bcc74a482f0695564713da7dd0.tar.gz
Remove default value for lock_version
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20160827011312_ensure_lock_version_has_no_default.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/db/migrate/20160827011312_ensure_lock_version_has_no_default.rb b/db/migrate/20160827011312_ensure_lock_version_has_no_default.rb
new file mode 100644
index 00000000000..7c55bc23cf2
--- /dev/null
+++ b/db/migrate/20160827011312_ensure_lock_version_has_no_default.rb
@@ -0,0 +1,16 @@
+class EnsureLockVersionHasNoDefault < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ change_column_default :issues, :lock_version, nil
+ change_column_default :merge_requests, :lock_version, nil
+
+ execute('UPDATE issues SET lock_version = 1 WHERE lock_version = 0')
+ execute('UPDATE merge_requests SET lock_version = 1 WHERE lock_version = 0')
+ end
+
+ def down
+ end
+end