2019-01-03 12:48:30 +05:30
|
|
|
class AddNotNullConstraintToProjectMirrorDataForeignKey < ActiveRecord::Migration
|
2018-10-15 14:42:47 +05:30
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
class ProjectImportState < ActiveRecord::Base
|
|
|
|
include EachBatch
|
|
|
|
|
|
|
|
self.table_name = 'project_mirror_data'
|
|
|
|
end
|
|
|
|
|
|
|
|
def up
|
|
|
|
ProjectImportState.where(project_id: nil).delete_all
|
|
|
|
|
|
|
|
change_column_null :project_mirror_data, :project_id, false
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
change_column_null :project_mirror_data, :project_id, true
|
|
|
|
end
|
|
|
|
end
|