Unverified Commit de724a7a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Improve db schema for merge request diffs


Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent c983e8eb
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
......
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
......@@ -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 @@
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment