debian-mirror-gitlab/db/migrate/20180502122856_create_project_mirror_data.rb

33 lines
1.2 KiB
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
class CreateProjectMirrorData < ActiveRecord::Migration[4.2]
2018-10-15 14:42:47 +05:30
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
2020-05-24 23:13:21 +05:30
# rubocop:disable Migration/PreventStrings
# rubocop:disable Migration/AddLimitToTextColumns
2018-10-15 14:42:47 +05:30
def up
2019-09-04 21:01:54 +05:30
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
2018-10-15 14:42:47 +05:30
end
end
2020-05-24 23:13:21 +05:30
# rubocop:enable Migration/AddLimitToTextColumns
# rubocop:enable Migration/PreventStrings
2018-10-15 14:42:47 +05:30
def down
2019-09-04 21:01:54 +05:30
remove_column :project_mirror_data, :status
remove_column :project_mirror_data, :jid
remove_column :project_mirror_data, :last_error
# ee/db/migrate/20170509153720_create_project_mirror_data_ee.rb will remove the table.
2018-10-15 14:42:47 +05:30
end
end