diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-05-23 14:45:53 +0100 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-05-23 14:45:53 +0100 |
commit | 2fdf15dd9784dd9cef76ab62ea36a3d165fa9bec (patch) | |
tree | 442cfa0a2e939cefc35e85e2f17047e5c72a44fc | |
parent | acdb7435dadc0b4efbe8da96873383cac4221a97 (diff) | |
download | gitlab-ce-2fdf15dd9784dd9cef76ab62ea36a3d165fa9bec.tar.gz |
Edits create_project_mirror_data to add the new columns when table already exists
-rw-r--r-- | db/migrate/20180502122856_create_project_mirror_data.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/db/migrate/20180502122856_create_project_mirror_data.rb b/db/migrate/20180502122856_create_project_mirror_data.rb index d449f944844..d050ff1ca61 100644 --- a/db/migrate/20180502122856_create_project_mirror_data.rb +++ b/db/migrate/20180502122856_create_project_mirror_data.rb @@ -4,13 +4,17 @@ class CreateProjectMirrorData < ActiveRecord::Migration DOWNTIME = false def up - return if table_exists?(:project_mirror_data) - - create_table :project_mirror_data do |t| - t.references :project, index: true, foreign_key: { on_delete: :cascade } - t.string :status - t.string :jid - t.text :last_error + if table_exists?(:project_mirror_data) + add_column :project_mirror_data, :status, :string unless column_exists?(:project_mirror_data, :status) + add_column :project_mirror_data, :jid, :string unless column_exists?(:project_mirror_data, :jid) + add_column :project_mirror_data, :last_error, :text unless column_exists?(:project_mirror_data, :last_error) + else + create_table :project_mirror_data do |t| + t.references :project, index: true, foreign_key: { on_delete: :cascade } + t.string :status + t.string :jid + t.text :last_error + end end end |