Merge branch 'fix_migrations_in_the_future' into 'master'

fix migrations in the future

Closes #34832

See merge request !12719
This commit is contained in:
Douwe Maan 2017-07-07 22:53:18 +00:00
commit bf23d6c610
4 changed files with 15 additions and 1 deletions

View File

@ -2,6 +2,8 @@ class AddGroupIdToMilestones < ActiveRecord::Migration
DOWNTIME = false
def up
return if column_exists? :milestones, :group_id
change_column_null :milestones, :project_id, true
add_column :milestones, :group_id, :integer

View File

@ -6,6 +6,8 @@ class AddGroupMilestoneIdIndexes < ActiveRecord::Migration
DOWNTIME = false
def up
return if index_exists?(:milestones, :group_id)
add_concurrent_foreign_key :milestones, :namespaces, column: :group_id, on_delete: :cascade
add_concurrent_index :milestones, :group_id

View File

@ -0,0 +1,10 @@
class RemoveWrongVersionsFromSchemaVersions < ActiveRecord::Migration
DOWNTIME = false
def up
execute("DELETE FROM schema_migrations WHERE version IN ('20170723183807', '20170724184243')")
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# 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
enable_extension "plpgsql"