diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-01-23 16:38:23 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-01-23 16:38:23 +0400 |
commit | 28e13634dc9318dbd093a4561ee8ea16e1d71460 (patch) | |
tree | 0a14694c45a8328fc9dbf868f310c5ba3a71184f /db/migrate | |
parent | 68590fddd860c5d840d8f04314ed11f0d02ddd44 (diff) | |
parent | 573f1f4ade80cc3b66723ad12594467e881b4510 (diff) |
Merge branch 'improve/mr_diff'
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Conflicts:
features/steps/project/project_fork.rb
features/steps/project/project_forked_merge_requests.rb
features/steps/project/project_issue_tracker.rb
features/steps/project/project_markdown_render.rb
features/steps/shared/project.rb
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20140122112253_create_merge_request_diffs.rb | 12 | ||||
-rw-r--r-- | db/migrate/20140122114406_migrate_mr_diffs.rb | 11 | ||||
-rw-r--r-- | db/migrate/20140122122549_remove_m_rdiff_fields.rb | 13 |
3 files changed, 36 insertions, 0 deletions
diff --git a/db/migrate/20140122112253_create_merge_request_diffs.rb b/db/migrate/20140122112253_create_merge_request_diffs.rb new file mode 100644 index 00000000000..ef592305a23 --- /dev/null +++ b/db/migrate/20140122112253_create_merge_request_diffs.rb @@ -0,0 +1,12 @@ +class CreateMergeRequestDiffs < ActiveRecord::Migration + def change + create_table :merge_request_diffs do |t| + t.string :state, null: false, default: 'collected' + t.text :st_commits, null: true, limit: 2147483647 + t.text :st_diffs, null: true, limit: 2147483647 + t.integer :merge_request_id, null: false + + t.timestamps + end + end +end diff --git a/db/migrate/20140122114406_migrate_mr_diffs.rb b/db/migrate/20140122114406_migrate_mr_diffs.rb new file mode 100644 index 00000000000..2cc5faaa851 --- /dev/null +++ b/db/migrate/20140122114406_migrate_mr_diffs.rb @@ -0,0 +1,11 @@ +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" + end + + def self.down + MergeRequestDiff.delete_all + end +end diff --git a/db/migrate/20140122122549_remove_m_rdiff_fields.rb b/db/migrate/20140122122549_remove_m_rdiff_fields.rb new file mode 100644 index 00000000000..c27e649e9a3 --- /dev/null +++ b/db/migrate/20140122122549_remove_m_rdiff_fields.rb @@ -0,0 +1,13 @@ +class RemoveMRdiffFields < ActiveRecord::Migration + def up + remove_column :merge_requests, :st_commits + remove_column :merge_requests, :st_diffs + end + + 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" + end +end |