diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-05-29 11:05:51 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-05-30 11:16:29 +0100 |
commit | 7ed252c1e72d446883a5007d375d4404c3504b0c (patch) | |
tree | 24d2f623170ed35c57eb77232ad640aca54d8639 | |
parent | fee3fe72904e88d6480822ef307cffeea2c34d90 (diff) | |
download | gitlab-ce-7ed252c1e72d446883a5007d375d4404c3504b0c.tar.gz |
Merge branch 'ensure-remote-mirror-columns-in-ce' into 'master'
Adds migration to ensure all remote mirror columns get created
Closes #46775
See merge request gitlab-org/gitlab-ce!19196
-rw-r--r-- | changelogs/unreleased/ensure-remote-mirror-columns-in-ce.yml | 5 | ||||
-rw-r--r-- | db/migrate/20180529093006_ensure_remote_mirror_columns.rb | 24 | ||||
-rw-r--r-- | db/schema.rb | 4 |
3 files changed, 33 insertions, 0 deletions
diff --git a/changelogs/unreleased/ensure-remote-mirror-columns-in-ce.yml b/changelogs/unreleased/ensure-remote-mirror-columns-in-ce.yml new file mode 100644 index 00000000000..7617412431f --- /dev/null +++ b/changelogs/unreleased/ensure-remote-mirror-columns-in-ce.yml @@ -0,0 +1,5 @@ +--- +title: Fix remote mirror database inconsistencies when upgrading from EE to CE +merge_request: 19196 +author: +type: fixed diff --git a/db/migrate/20180529093006_ensure_remote_mirror_columns.rb b/db/migrate/20180529093006_ensure_remote_mirror_columns.rb new file mode 100644 index 00000000000..290416cb61c --- /dev/null +++ b/db/migrate/20180529093006_ensure_remote_mirror_columns.rb @@ -0,0 +1,24 @@ +class EnsureRemoteMirrorColumns < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column :remote_mirrors, :last_update_started_at, :datetime unless column_exists?(:remote_mirrors, :last_update_started_at) + add_column :remote_mirrors, :remote_name, :string unless column_exists?(:remote_mirrors, :remote_name) + + unless column_exists?(:remote_mirrors, :only_protected_branches) + add_column_with_default(:remote_mirrors, + :only_protected_branches, + :boolean, + default: false, + allow_null: false) + end + end + + def down + # db/migrate/20180503131624_create_remote_mirrors.rb will remove the table + end +end diff --git a/db/schema.rb b/db/schema.rb index 168ab198025..c94bcc83b04 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,11 @@ # # It's strongly recommended that you check this file into your version control system. +<<<<<<< HEAD ActiveRecord::Schema.define(version: 20180508102840) do +======= +ActiveRecord::Schema.define(version: 20180529093006) do +>>>>>>> 516c00763e... Merge branch 'ensure-remote-mirror-columns-in-ce' into 'master' # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |