diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-05-29 12:43:06 +0300 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-05-29 13:29:29 +0300 |
commit | 4a344a154949fc9ba72cd6e122fe4e24d952ff3f (patch) | |
tree | a93e02e87e51f9b35a5af0894ad8e7c1fb1c4c23 /db/migrate/20180529093006_ensure_remote_mirror_columns.rb | |
parent | c5adf04cd69035a7a1737df8c2303bc228ea4089 (diff) |
Adds migration to ensure all remote mirror columns get created
Diffstat (limited to 'db/migrate/20180529093006_ensure_remote_mirror_columns.rb')
-rw-r--r-- | db/migrate/20180529093006_ensure_remote_mirror_columns.rb | 24 |
1 files changed, 24 insertions, 0 deletions
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 |