Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
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
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
db/migrate/20170707183807_add_group_id_to_milestones.rb
db/migrate/20170707183807_add_group_id_to_milestones.rb
+2
-0
db/migrate/20170707184243_add_group_milestone_id_indexes.rb
db/migrate/20170707184243_add_group_milestone_id_indexes.rb
+2
-0
db/migrate/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
...
@@ -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
...
...
db/migrate/20170707184243_add_group_milestone_id_indexes.rb
View file @
b24ef9ce
...
@@ -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
...
...
db/migrate/20170707184244_remove_wrong_versions_from_schema_versions.rb
View file @
b24ef9ce
class
RemoveWrongVersionsFromSchemaVersions
<
ActiveRecord
::
Migration
class
RemoveWrongVersionsFromSchemaVersions
<
ActiveRecord
::
Migration
def
change
DOWNTIME
=
false
execute
"UPDATE schema_migrations SET version = '20170707183807' WHERE version = '20170723183807'"
execute
"UPDATE schema_migrations SET version = '20170707184243' WHERE version = '20170724184243'"
def
up
execute
(
"DELETE FROM schema_migrations WHERE version IN ('20170723183807', '20170724184243')"
)
end
def
down
end
end
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