summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-01-22 15:17:41 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-01-22 15:17:41 +0200
commitde724a7a34a501234000a539e9ba6ce16857ad5d (patch)
treea7ca01a5f2be504f277e68ae1ac660258721b989 /db
parentc983e8eb3d9cac01090b8657735544f71f891576 (diff)
downloadgitlab-ce-de724a7a34a501234000a539e9ba6ce16857ad5d.tar.gz
Improve db schema for merge request diffs
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20140122112253_create_merge_request_diffs.rb2
-rw-r--r--db/migrate/20140122122549_remove_m_rdiff_fields.rb13
-rw-r--r--db/schema.rb16
3 files changed, 21 insertions, 10 deletions
diff --git a/db/migrate/20140122112253_create_merge_request_diffs.rb b/db/migrate/20140122112253_create_merge_request_diffs.rb
index f016ef0f061..ef592305a23 100644
--- a/db/migrate/20140122112253_create_merge_request_diffs.rb
+++ b/db/migrate/20140122112253_create_merge_request_diffs.rb
@@ -1,7 +1,7 @@
class CreateMergeRequestDiffs < ActiveRecord::Migration
def change
create_table :merge_request_diffs do |t|
- t.string :state, null: false, default: 'valid'
+ 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
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
diff --git a/db/schema.rb b/db/schema.rb
index 50170bf4a29..75a44d9aa04 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140122114406) do
+ActiveRecord::Schema.define(version: 20140122122549) do
create_table "broadcast_messages", force: true do |t|
t.text "message", null: false
@@ -96,29 +96,27 @@ ActiveRecord::Schema.define(version: 20140122114406) do
add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree
create_table "merge_request_diffs", force: true do |t|
- t.string "state", default: "valid", null: false
+ t.string "state", default: "collected", null: false
t.text "st_commits", limit: 2147483647
t.text "st_diffs", limit: 2147483647
- t.integer "merge_request_id", null: false
+ t.integer "merge_request_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "merge_requests", force: true do |t|
- t.string "target_branch", null: false
- t.string "source_branch", null: false
- t.integer "source_project_id", null: false
+ t.string "target_branch", null: false
+ t.string "source_branch", null: false
+ t.integer "source_project_id", null: false
t.integer "author_id"
t.integer "assignee_id"
t.string "title"
t.datetime "created_at"
t.datetime "updated_at"
- t.text "st_commits", limit: 2147483647
- t.text "st_diffs", limit: 2147483647
t.integer "milestone_id"
t.string "state"
t.string "merge_status"
- t.integer "target_project_id", null: false
+ t.integer "target_project_id", null: false
t.integer "iid"
t.text "description"
end