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
This commit is contained in:
commit
4dcbee4d26
3 changed files with 26 additions and 1 deletions
5
changelogs/unreleased/db-update-geo-nodes-primary.yml
Normal file
5
changelogs/unreleased/db-update-geo-nodes-primary.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Disallow `NULL` values for `geo_nodes.primary` column
|
||||||
|
merge_request: 29818
|
||||||
|
author: Arun Kumar Mohan
|
||||||
|
type: other
|
20
db/post_migrate/20190618171120_update_geo_nodes_primary.rb
Normal file
20
db/post_migrate/20190618171120_update_geo_nodes_primary.rb
Normal file
|
@ -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
|
|
@ -1391,7 +1391,7 @@ ActiveRecord::Schema.define(version: 20190619175843) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "geo_nodes", id: :serial, force: :cascade do |t|
|
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.integer "oauth_application_id"
|
||||||
t.boolean "enabled", default: true, null: false
|
t.boolean "enabled", default: true, null: false
|
||||||
t.string "access_key"
|
t.string "access_key"
|
||||||
|
|
Loading…
Reference in a new issue