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
a68b0014
Commit
a68b0014
authored
Feb 22, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make the db migration idempotent
parent
272af7a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
4 deletions
+34
-4
ee/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb
...b/migrate/20170825015534_add_file_store_to_lfs_objects.rb
+6
-2
ee/db/migrate/20170918072949_add_file_store_job_artifacts.rb
ee/db/migrate/20170918072949_add_file_store_job_artifacts.rb
+18
-0
ee/db/migrate/20171214144320_add_store_column_to_uploads.rb
ee/db/migrate/20171214144320_add_store_column_to_uploads.rb
+10
-2
No files found.
db/migrate/20170825015534_add_file_store_to_lfs_objects.rb
→
ee/
db/migrate/20170825015534_add_file_store_to_lfs_objects.rb
View file @
a68b0014
...
...
@@ -26,10 +26,14 @@ class AddFileStoreToLfsObjects < ActiveRecord::Migration
disable_ddl_transaction!
def
up
add_column
(
:lfs_objects
,
:file_store
,
:integer
)
unless
column_exists?
(
:lfs_objects
,
:file_store
)
add_column
(
:lfs_objects
,
:file_store
,
:integer
)
end
end
def
down
remove_column
(
:lfs_objects
,
:file_store
)
if
column_exists?
(
:lfs_objects
,
:file_store
)
remove_column
(
:lfs_objects
,
:file_store
)
end
end
end
db/migrate/20170918072949_add_file_store_job_artifacts.rb
→
ee/
db/migrate/20170918072949_add_file_store_job_artifacts.rb
View file @
a68b0014
...
...
@@ -5,10 +5,14 @@ class AddFileStoreJobArtifacts < ActiveRecord::Migration
DOWNTIME
=
false
def
up
add_column
(
:ci_job_artifacts
,
:file_store
,
:integer
)
unless
column_exists?
(
:ci_job_artifacts
,
:file_store
)
add_column
(
:ci_job_artifacts
,
:file_store
,
:integer
)
end
end
def
down
remove_column
(
:ci_job_artifacts
,
:file_store
)
if
column_exists?
(
:ci_job_artifacts
,
:file_store
)
remove_column
(
:ci_job_artifacts
,
:file_store
)
end
end
end
db/migrate/20171214144320_add_store_column_to_uploads.rb
→
ee/
db/migrate/20171214144320_add_store_column_to_uploads.rb
View file @
a68b0014
...
...
@@ -6,7 +6,15 @@ class AddStoreColumnToUploads < ActiveRecord::Migration
DOWNTIME
=
false
def
change
add_column
:uploads
,
:store
,
:integer
def
up
unless
column
.
exists?
(
:uploads
,
:store
)
add_column
(
:uploads
,
:store
,
:integer
)
end
end
def
down
if
column
.
exists?
(
:uploads
,
:store
)
remove_column
(
:uploads
,
:store
)
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