diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2019-06-21 10:16:50 +0000 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2019-06-21 10:16:50 +0000 |
commit | 4dcbee4d26bc473f408384e61b4f412df6f574de (patch) | |
tree | 00bcbcf2470757152ef3982c0f2f4e2d3812cd3d /db | |
parent | dff6165e8c7d9e1cadbc7c014136dab1c69df62c (diff) | |
parent | 0cb6b787a0508ed891f5e69dad5c914e064db491 (diff) | |
download | gitlab-ce-4dcbee4d26bc473f408384e61b4f412df6f574de.tar.gz |
Merge branch 'db/update-geo-nodes-primary' into 'master'
Disallow `NULL` values for `geo_nodes.primary` column
Closes gitlab-ee#12061
See merge request gitlab-org/gitlab-ce!29818
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20190618171120_update_geo_nodes_primary.rb | 20 | ||||
-rw-r--r-- | db/schema.rb | 2 |
2 files changed, 21 insertions, 1 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 diff --git a/db/schema.rb b/db/schema.rb index 4e333633a8b..02d8ab10935 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1391,7 +1391,7 @@ ActiveRecord::Schema.define(version: 20190619175843) do end create_table "geo_nodes", id: :serial, force: :cascade do |t| - t.boolean "primary" + t.boolean "primary", default: false, null: false t.integer "oauth_application_id" t.boolean "enabled", default: true, null: false t.string "access_key" |