Commit 2fdf15dd authored by Tiago Botelho's avatar Tiago Botelho

Edits create_project_mirror_data to add the new columns when table already exists

parent acdb7435
...@@ -4,8 +4,11 @@ class CreateProjectMirrorData < ActiveRecord::Migration ...@@ -4,8 +4,11 @@ class CreateProjectMirrorData < ActiveRecord::Migration
DOWNTIME = false DOWNTIME = false
def up def up
return if table_exists?(:project_mirror_data) 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| create_table :project_mirror_data do |t|
t.references :project, index: true, foreign_key: { on_delete: :cascade } t.references :project, index: true, foreign_key: { on_delete: :cascade }
t.string :status t.string :status
...@@ -13,6 +16,7 @@ class CreateProjectMirrorData < ActiveRecord::Migration ...@@ -13,6 +16,7 @@ class CreateProjectMirrorData < ActiveRecord::Migration
t.text :last_error t.text :last_error
end end
end end
end
def down def down
drop_table(:project_mirror_data) if table_exists?(:project_mirror_data) drop_table(:project_mirror_data) if table_exists?(:project_mirror_data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment