summaryrefslogtreecommitdiff
path: root/db/post_migrate
diff options
context:
space:
mode:
authorArun Kumar Mohan <arunmohandm@gmail.com>2019-06-18 17:14:33 -0500
committerArun Kumar Mohan <arunmohandm@gmail.com>2019-06-18 17:14:33 -0500
commitd9abaab0c8fcc2f09c525a75093f7bb8858764ad (patch)
treece47e5c5a6b9f53940771604e79df15760f22865 /db/post_migrate
parent6fa900547dbd30b0db0070f87dbeb4b05d485b9b (diff)
downloadgitlab-ce-d9abaab0c8fcc2f09c525a75093f7bb8858764ad.tar.gz
Disallow `NULL` values for `geo_nodes.primary` column
Diffstat (limited to 'db/post_migrate')
-rw-r--r--db/post_migrate/20190618171120_update_geo_nodes_primary.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/db/post_migrate/20190618171120_update_geo_nodes_primary.rb b/db/post_migrate/20190618171120_update_geo_nodes_primary.rb
new file mode 100644
index 00000000000..dc9cfbda177
--- /dev/null
+++ b/db/post_migrate/20190618171120_update_geo_nodes_primary.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class UpdateGeoNodesPrimary < ActiveRecord::Migration[5.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ change_column_default(:geo_nodes, :primary, false)
+ change_column_null(:geo_nodes, :primary, false, false)
+ end
+
+ def down
+ change_column_default(:geo_nodes, :primary, nil)
+ change_column_null(:geo_nodes, :primary, true)
+ end
+end