Commit c983e8eb authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Create separate table to store Merge request commits/diffs

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 1018cbdc
class CreateMergeRequestDiffs < ActiveRecord::Migration
def change
create_table :merge_request_diffs do |t|
t.string :state, null: false, default: 'valid'
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
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
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140116231608) do ActiveRecord::Schema.define(version: 20140122114406) do
create_table "broadcast_messages", force: true do |t| create_table "broadcast_messages", force: true do |t|
t.text "message", null: false t.text "message", null: false
...@@ -66,8 +66,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -66,8 +66,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do
t.integer "assignee_id" t.integer "assignee_id"
t.integer "author_id" t.integer "author_id"
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", null: false t.datetime "created_at"
t.datetime "updated_at", null: false t.datetime "updated_at"
t.integer "position", default: 0 t.integer "position", default: 0
t.string "branch_name" t.string "branch_name"
t.text "description" t.text "description"
...@@ -85,8 +85,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -85,8 +85,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do
create_table "keys", force: true do |t| create_table "keys", force: true do |t|
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", null: false t.datetime "created_at"
t.datetime "updated_at", null: false t.datetime "updated_at"
t.text "key" t.text "key"
t.string "title" t.string "title"
t.string "type" t.string "type"
...@@ -95,6 +95,15 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -95,6 +95,15 @@ ActiveRecord::Schema.define(version: 20140116231608) do
add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree 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.text "st_commits", limit: 2147483647
t.text "st_diffs", limit: 2147483647
t.integer "merge_request_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "merge_requests", force: true do |t| create_table "merge_requests", force: true do |t|
t.string "target_branch", null: false t.string "target_branch", null: false
t.string "source_branch", null: false t.string "source_branch", null: false
...@@ -102,8 +111,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -102,8 +111,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do
t.integer "author_id" t.integer "author_id"
t.integer "assignee_id" t.integer "assignee_id"
t.string "title" t.string "title"
t.datetime "created_at", null: false t.datetime "created_at"
t.datetime "updated_at", null: false t.datetime "updated_at"
t.text "st_commits", limit: 2147483647 t.text "st_commits", limit: 2147483647
t.text "st_diffs", limit: 2147483647 t.text "st_diffs", limit: 2147483647
t.integer "milestone_id" t.integer "milestone_id"
...@@ -156,8 +165,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -156,8 +165,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do
t.text "note" t.text "note"
t.string "noteable_type" t.string "noteable_type"
t.integer "author_id" t.integer "author_id"
t.datetime "created_at", null: false t.datetime "created_at"
t.datetime "updated_at", null: false t.datetime "updated_at"
t.integer "project_id" t.integer "project_id"
t.string "attachment" t.string "attachment"
t.string "line_code" t.string "line_code"
...@@ -179,8 +188,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -179,8 +188,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do
t.string "name" t.string "name"
t.string "path" t.string "path"
t.text "description" t.text "description"
t.datetime "created_at", null: false t.datetime "created_at"
t.datetime "updated_at", null: false t.datetime "updated_at"
t.integer "creator_id" t.integer "creator_id"
t.boolean "issues_enabled", default: true, null: false t.boolean "issues_enabled", default: true, null: false
t.boolean "wall_enabled", default: true, null: false t.boolean "wall_enabled", default: true, null: false
...@@ -231,8 +240,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -231,8 +240,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do
t.text "content", limit: 2147483647 t.text "content", limit: 2147483647
t.integer "author_id", null: false t.integer "author_id", null: false
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", null: false t.datetime "created_at"
t.datetime "updated_at", null: false t.datetime "updated_at"
t.string "file_name" t.string "file_name"
t.datetime "expires_at" t.datetime "expires_at"
t.boolean "private", default: true, null: false t.boolean "private", default: true, null: false
...@@ -254,16 +263,13 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -254,16 +263,13 @@ ActiveRecord::Schema.define(version: 20140116231608) do
t.datetime "created_at" t.datetime "created_at"
end end
add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree
add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree
create_table "tags", force: true do |t| create_table "tags", force: true do |t|
t.string "name" t.string "name"
end end
create_table "users", force: true do |t| create_table "users", force: true do |t|
t.string "email", default: "", null: false t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false t.string "encrypted_password", limit: 128, default: "", null: false
t.string "reset_password_token" t.string "reset_password_token"
t.datetime "reset_password_sent_at" t.datetime "reset_password_sent_at"
t.datetime "remember_created_at" t.datetime "remember_created_at"
...@@ -272,8 +278,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -272,8 +278,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do
t.datetime "last_sign_in_at" t.datetime "last_sign_in_at"
t.string "current_sign_in_ip" t.string "current_sign_in_ip"
t.string "last_sign_in_ip" t.string "last_sign_in_ip"
t.datetime "created_at", null: false t.datetime "created_at"
t.datetime "updated_at", null: false t.datetime "updated_at"
t.string "name" t.string "name"
t.boolean "admin", default: false, null: false t.boolean "admin", default: false, null: false
t.integer "projects_limit", default: 10 t.integer "projects_limit", default: 10
...@@ -308,7 +314,6 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -308,7 +314,6 @@ ActiveRecord::Schema.define(version: 20140116231608) do
add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["extern_uid", "provider"], name: "index_users_on_extern_uid_and_provider", unique: true, using: :btree
add_index "users", ["name"], name: "index_users_on_name", using: :btree add_index "users", ["name"], name: "index_users_on_name", using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
add_index "users", ["username"], name: "index_users_on_username", using: :btree add_index "users", ["username"], name: "index_users_on_username", using: :btree
...@@ -327,8 +332,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -327,8 +332,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do
create_table "users_projects", force: true do |t| create_table "users_projects", force: true do |t|
t.integer "user_id", null: false t.integer "user_id", null: false
t.integer "project_id", null: false t.integer "project_id", null: false
t.datetime "created_at", null: false t.datetime "created_at"
t.datetime "updated_at", null: false t.datetime "updated_at"
t.integer "project_access", default: 0, null: false t.integer "project_access", default: 0, null: false
t.integer "notification_level", default: 3, null: false t.integer "notification_level", default: 3, null: false
end end
...@@ -340,8 +345,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do ...@@ -340,8 +345,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do
create_table "web_hooks", force: true do |t| create_table "web_hooks", force: true do |t|
t.string "url" t.string "url"
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", null: false t.datetime "created_at"
t.datetime "updated_at", null: false t.datetime "updated_at"
t.string "type", default: "ProjectHook" t.string "type", default: "ProjectHook"
t.integer "service_id" t.integer "service_id"
t.boolean "push_events", default: true, null: false t.boolean "push_events", default: true, null: false
......
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