Commit bf23d6c6 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'fix_migrations_in_the_future' into 'master'

fix migrations in the future

Closes #34832

See merge request !12719
parents 7414f540 b24ef9ce
...@@ -2,6 +2,8 @@ class AddGroupIdToMilestones < ActiveRecord::Migration ...@@ -2,6 +2,8 @@ class AddGroupIdToMilestones < ActiveRecord::Migration
DOWNTIME = false DOWNTIME = false
def up def up
return if column_exists? :milestones, :group_id
change_column_null :milestones, :project_id, true change_column_null :milestones, :project_id, true
add_column :milestones, :group_id, :integer add_column :milestones, :group_id, :integer
......
...@@ -6,6 +6,8 @@ class AddGroupMilestoneIdIndexes < ActiveRecord::Migration ...@@ -6,6 +6,8 @@ class AddGroupMilestoneIdIndexes < ActiveRecord::Migration
DOWNTIME = false DOWNTIME = false
def up def up
return if index_exists?(:milestones, :group_id)
add_concurrent_foreign_key :milestones, :namespaces, column: :group_id, on_delete: :cascade add_concurrent_foreign_key :milestones, :namespaces, column: :group_id, on_delete: :cascade
add_concurrent_index :milestones, :group_id add_concurrent_index :milestones, :group_id
......
class RemoveWrongVersionsFromSchemaVersions < ActiveRecord::Migration
DOWNTIME = false
def up
execute("DELETE FROM schema_migrations WHERE version IN ('20170723183807', '20170724184243')")
end
def down
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170724184243) do ActiveRecord::Schema.define(version: 20170707184244) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
......
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