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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
4125de5e
Commit
4125de5e
authored
Jan 27, 2014
by
skv-headless
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix merge_request_diffs migrations for postgresql
parent
5221dbfe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
db/migrate/20140122114406_migrate_mr_diffs.rb
db/migrate/20140122114406_migrate_mr_diffs.rb
+1
-3
db/migrate/20140122122549_remove_m_rdiff_fields.rb
db/migrate/20140122122549_remove_m_rdiff_fields.rb
+10
-2
No files found.
db/migrate/20140122114406_migrate_mr_diffs.rb
View file @
4125de5e
class
MigrateMrDiffs
<
ActiveRecord
::
Migration
def
self
.
up
execute
"INSERT INTO merge_request_diffs ( merge_request_id ) SELECT id FROM merge_requests"
execute
"UPDATE merge_requests mr, merge_request_diffs md SET md.st_commits = mr.st_commits WHERE md.merge_request_id = mr.id"
execute
"UPDATE merge_requests mr, merge_request_diffs md SET md.st_diffs = mr.st_diffs WHERE md.merge_request_id = mr.id"
execute
"INSERT INTO merge_request_diffs ( merge_request_id, st_commits, st_diffs ) SELECT id, st_commits, st_diffs FROM merge_requests"
end
def
self
.
down
...
...
db/migrate/20140122122549_remove_m_rdiff_fields.rb
View file @
4125de5e
...
...
@@ -7,7 +7,15 @@ class RemoveMRdiffFields < ActiveRecord::Migration
def
down
add_column
:merge_requests
,
:st_commits
,
:text
,
null:
true
,
limit:
2147483647
add_column
:merge_requests
,
:st_diffs
,
:text
,
null:
true
,
limit:
2147483647
execute
"UPDATE merge_requests mr, merge_request_diffs md SET mr.st_commits = md.st_commits WHERE md.merge_request_id = mr.id"
execute
"UPDATE merge_requests mr, merge_request_diffs md SET mr.st_diffs = md.st_diffs WHERE md.merge_request_id = mr.id"
if
ActiveRecord
::
Base
.
connection
.
adapter_name
==
'PostgreSQL'
execute
"UPDATE merge_requests mr
SET (st_commits, st_diffs) = (md.st_commits, md.st_diffs)
FROM merge_request_diffs md
WHERE md.merge_request_id = mr.id"
else
execute
"UPDATE merge_requests mr, merge_request_diffs md SET mr.st_commits = md.st_commits WHERE md.merge_request_id = mr.id"
execute
"UPDATE merge_requests mr, merge_request_diffs md SET mr.st_diffs = md.st_diffs WHERE md.merge_request_id = mr.id"
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