Fix build stages reference migration
This commit is contained in:
parent
4b0b2f1525
commit
6b9608e13e
|
@ -7,15 +7,11 @@ class AddStageIdToCiBuilds < ActiveRecord::Migration
|
|||
|
||||
def up
|
||||
add_column :ci_builds, :stage_id, :integer
|
||||
|
||||
add_concurrent_foreign_key :ci_builds, :ci_stages, column: :stage_id, on_delete: :cascade
|
||||
add_concurrent_index :ci_builds, :stage_id
|
||||
end
|
||||
|
||||
def down
|
||||
remove_foreign_key :ci_builds, column: :stage_id
|
||||
remove_concurrent_index :ci_builds, :stage_id
|
||||
|
||||
remove_column :ci_builds, :stage_id, :integer
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
class RemoveStageIdIndexFromBuilds < ActiveRecord::Migration
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
if index_exists?(:ci_builds, :stage_id)
|
||||
remove_concurrent_index(:ci_builds, :stage_id)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
# noop
|
||||
end
|
||||
end
|
|
@ -3,6 +3,8 @@ class MigrateBuildStageReference < ActiveRecord::Migration
|
|||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
disable_statement_timeout
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
class AddStageIdIndexToBuilds < ActiveRecord::Migration
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
unless index_exists?(:ci_builds, :stage_id)
|
||||
add_concurrent_index(:ci_builds, :stage_id)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
if index_exists?(:ci_builds, :stage_id)
|
||||
remove_concurrent_index(:ci_builds, :stage_id)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170614115405) do
|
||||
ActiveRecord::Schema.define(version: 20170621102400) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
Loading…
Reference in New Issue