BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
b24ef9ce
Commit
b24ef9ce
authored
Jul 07, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make wrong migrations idempotent
parent
4e07305b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
20170707183807_add_group_id_to_milestones.rb
db/migrate/20170707183807_add_group_id_to_milestones.rb
+2
-0
20170707184243_add_group_milestone_id_indexes.rb
db/migrate/20170707184243_add_group_milestone_id_indexes.rb
+2
-0
20170707184244_remove_wrong_versions_from_schema_versions.rb
...70707184244_remove_wrong_versions_from_schema_versions.rb
+7
-3
No files found.
db/migrate/20170707183807_add_group_id_to_milestones.rb
View file @
b24ef9ce
...
...
@@ -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
...
...
db/migrate/20170707184243_add_group_milestone_id_indexes.rb
View file @
b24ef9ce
...
...
@@ -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
...
...
db/migrate/20170707184244_remove_wrong_versions_from_schema_versions.rb
View file @
b24ef9ce
class
RemoveWrongVersionsFromSchemaVersions
<
ActiveRecord
::
Migration
def
change
execute
"UPDATE schema_migrations SET version = '20170707183807' WHERE version = '20170723183807'"
execute
"UPDATE schema_migrations SET version = '20170707184243' WHERE version = '20170724184243'"
DOWNTIME
=
false
def
up
execute
(
"DELETE FROM schema_migrations WHERE version IN ('20170723183807', '20170724184243')"
)
end
def
down
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment