Commit c983e8eb3d9cac01090b8657735544f71f891576
1 parent
1018cbdc
Exists in
spb-stable
and in
3 other branches
Create separate table to store Merge request commits/diffs
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
67 additions
and
39 deletions
Show diff stats
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +class CreateMergeRequestDiffs < ActiveRecord::Migration | ||
| 2 | + def change | ||
| 3 | + create_table :merge_request_diffs do |t| | ||
| 4 | + t.string :state, null: false, default: 'valid' | ||
| 5 | + t.text :st_commits, null: true, limit: 2147483647 | ||
| 6 | + t.text :st_diffs, null: true, limit: 2147483647 | ||
| 7 | + t.integer :merge_request_id, null: false | ||
| 8 | + | ||
| 9 | + t.timestamps | ||
| 10 | + end | ||
| 11 | + end | ||
| 12 | +end |
| @@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
| 1 | +class MigrateMrDiffs < ActiveRecord::Migration | ||
| 2 | + def self.up | ||
| 3 | + execute "INSERT INTO merge_request_diffs ( merge_request_id ) SELECT id FROM merge_requests" | ||
| 4 | + execute "UPDATE merge_requests mr, merge_request_diffs md SET md.st_commits = mr.st_commits WHERE md.merge_request_id = mr.id" | ||
| 5 | + execute "UPDATE merge_requests mr, merge_request_diffs md SET md.st_diffs = mr.st_diffs WHERE md.merge_request_id = mr.id" | ||
| 6 | + end | ||
| 7 | + | ||
| 8 | + def self.down | ||
| 9 | + MergeRequestDiff.delete_all | ||
| 10 | + end | ||
| 11 | +end |
db/schema.rb
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | # | 11 | # |
| 12 | # It's strongly recommended that you check this file into your version control system. | 12 | # It's strongly recommended that you check this file into your version control system. |
| 13 | 13 | ||
| 14 | -ActiveRecord::Schema.define(version: 20140116231608) do | 14 | +ActiveRecord::Schema.define(version: 20140122114406) do |
| 15 | 15 | ||
| 16 | create_table "broadcast_messages", force: true do |t| | 16 | create_table "broadcast_messages", force: true do |t| |
| 17 | t.text "message", null: false | 17 | 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 | ||
| 66 | t.integer "assignee_id" | 66 | t.integer "assignee_id" |
| 67 | t.integer "author_id" | 67 | t.integer "author_id" |
| 68 | t.integer "project_id" | 68 | t.integer "project_id" |
| 69 | - t.datetime "created_at", null: false | ||
| 70 | - t.datetime "updated_at", null: false | 69 | + t.datetime "created_at" |
| 70 | + t.datetime "updated_at" | ||
| 71 | t.integer "position", default: 0 | 71 | t.integer "position", default: 0 |
| 72 | t.string "branch_name" | 72 | t.string "branch_name" |
| 73 | t.text "description" | 73 | t.text "description" |
| @@ -85,8 +85,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do | @@ -85,8 +85,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do | ||
| 85 | 85 | ||
| 86 | create_table "keys", force: true do |t| | 86 | create_table "keys", force: true do |t| |
| 87 | t.integer "user_id" | 87 | t.integer "user_id" |
| 88 | - t.datetime "created_at", null: false | ||
| 89 | - t.datetime "updated_at", null: false | 88 | + t.datetime "created_at" |
| 89 | + t.datetime "updated_at" | ||
| 90 | t.text "key" | 90 | t.text "key" |
| 91 | t.string "title" | 91 | t.string "title" |
| 92 | t.string "type" | 92 | t.string "type" |
| @@ -95,6 +95,15 @@ ActiveRecord::Schema.define(version: 20140116231608) do | @@ -95,6 +95,15 @@ ActiveRecord::Schema.define(version: 20140116231608) do | ||
| 95 | 95 | ||
| 96 | add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree | 96 | add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree |
| 97 | 97 | ||
| 98 | + create_table "merge_request_diffs", force: true do |t| | ||
| 99 | + t.string "state", default: "valid", null: false | ||
| 100 | + t.text "st_commits", limit: 2147483647 | ||
| 101 | + t.text "st_diffs", limit: 2147483647 | ||
| 102 | + t.integer "merge_request_id", null: false | ||
| 103 | + t.datetime "created_at" | ||
| 104 | + t.datetime "updated_at" | ||
| 105 | + end | ||
| 106 | + | ||
| 98 | create_table "merge_requests", force: true do |t| | 107 | create_table "merge_requests", force: true do |t| |
| 99 | t.string "target_branch", null: false | 108 | t.string "target_branch", null: false |
| 100 | t.string "source_branch", null: false | 109 | 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 | ||
| 102 | t.integer "author_id" | 111 | t.integer "author_id" |
| 103 | t.integer "assignee_id" | 112 | t.integer "assignee_id" |
| 104 | t.string "title" | 113 | t.string "title" |
| 105 | - t.datetime "created_at", null: false | ||
| 106 | - t.datetime "updated_at", null: false | 114 | + t.datetime "created_at" |
| 115 | + t.datetime "updated_at" | ||
| 107 | t.text "st_commits", limit: 2147483647 | 116 | t.text "st_commits", limit: 2147483647 |
| 108 | t.text "st_diffs", limit: 2147483647 | 117 | t.text "st_diffs", limit: 2147483647 |
| 109 | t.integer "milestone_id" | 118 | t.integer "milestone_id" |
| @@ -156,8 +165,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do | @@ -156,8 +165,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do | ||
| 156 | t.text "note" | 165 | t.text "note" |
| 157 | t.string "noteable_type" | 166 | t.string "noteable_type" |
| 158 | t.integer "author_id" | 167 | t.integer "author_id" |
| 159 | - t.datetime "created_at", null: false | ||
| 160 | - t.datetime "updated_at", null: false | 168 | + t.datetime "created_at" |
| 169 | + t.datetime "updated_at" | ||
| 161 | t.integer "project_id" | 170 | t.integer "project_id" |
| 162 | t.string "attachment" | 171 | t.string "attachment" |
| 163 | t.string "line_code" | 172 | t.string "line_code" |
| @@ -179,8 +188,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do | @@ -179,8 +188,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do | ||
| 179 | t.string "name" | 188 | t.string "name" |
| 180 | t.string "path" | 189 | t.string "path" |
| 181 | t.text "description" | 190 | t.text "description" |
| 182 | - t.datetime "created_at", null: false | ||
| 183 | - t.datetime "updated_at", null: false | 191 | + t.datetime "created_at" |
| 192 | + t.datetime "updated_at" | ||
| 184 | t.integer "creator_id" | 193 | t.integer "creator_id" |
| 185 | t.boolean "issues_enabled", default: true, null: false | 194 | t.boolean "issues_enabled", default: true, null: false |
| 186 | t.boolean "wall_enabled", default: true, null: false | 195 | 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 | ||
| 231 | t.text "content", limit: 2147483647 | 240 | t.text "content", limit: 2147483647 |
| 232 | t.integer "author_id", null: false | 241 | t.integer "author_id", null: false |
| 233 | t.integer "project_id" | 242 | t.integer "project_id" |
| 234 | - t.datetime "created_at", null: false | ||
| 235 | - t.datetime "updated_at", null: false | 243 | + t.datetime "created_at" |
| 244 | + t.datetime "updated_at" | ||
| 236 | t.string "file_name" | 245 | t.string "file_name" |
| 237 | t.datetime "expires_at" | 246 | t.datetime "expires_at" |
| 238 | t.boolean "private", default: true, null: false | 247 | t.boolean "private", default: true, null: false |
| @@ -254,45 +263,42 @@ ActiveRecord::Schema.define(version: 20140116231608) do | @@ -254,45 +263,42 @@ ActiveRecord::Schema.define(version: 20140116231608) do | ||
| 254 | t.datetime "created_at" | 263 | t.datetime "created_at" |
| 255 | end | 264 | end |
| 256 | 265 | ||
| 257 | - add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree | ||
| 258 | - add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree | ||
| 259 | - | ||
| 260 | create_table "tags", force: true do |t| | 266 | create_table "tags", force: true do |t| |
| 261 | t.string "name" | 267 | t.string "name" |
| 262 | end | 268 | end |
| 263 | 269 | ||
| 264 | create_table "users", force: true do |t| | 270 | create_table "users", force: true do |t| |
| 265 | - t.string "email", default: "", null: false | ||
| 266 | - t.string "encrypted_password", default: "", null: false | 271 | + t.string "email", default: "", null: false |
| 272 | + t.string "encrypted_password", limit: 128, default: "", null: false | ||
| 267 | t.string "reset_password_token" | 273 | t.string "reset_password_token" |
| 268 | t.datetime "reset_password_sent_at" | 274 | t.datetime "reset_password_sent_at" |
| 269 | t.datetime "remember_created_at" | 275 | t.datetime "remember_created_at" |
| 270 | - t.integer "sign_in_count", default: 0 | 276 | + t.integer "sign_in_count", default: 0 |
| 271 | t.datetime "current_sign_in_at" | 277 | t.datetime "current_sign_in_at" |
| 272 | t.datetime "last_sign_in_at" | 278 | t.datetime "last_sign_in_at" |
| 273 | t.string "current_sign_in_ip" | 279 | t.string "current_sign_in_ip" |
| 274 | t.string "last_sign_in_ip" | 280 | t.string "last_sign_in_ip" |
| 275 | - t.datetime "created_at", null: false | ||
| 276 | - t.datetime "updated_at", null: false | 281 | + t.datetime "created_at" |
| 282 | + t.datetime "updated_at" | ||
| 277 | t.string "name" | 283 | t.string "name" |
| 278 | - t.boolean "admin", default: false, null: false | ||
| 279 | - t.integer "projects_limit", default: 10 | ||
| 280 | - t.string "skype", default: "", null: false | ||
| 281 | - t.string "linkedin", default: "", null: false | ||
| 282 | - t.string "twitter", default: "", null: false | 284 | + t.boolean "admin", default: false, null: false |
| 285 | + t.integer "projects_limit", default: 10 | ||
| 286 | + t.string "skype", default: "", null: false | ||
| 287 | + t.string "linkedin", default: "", null: false | ||
| 288 | + t.string "twitter", default: "", null: false | ||
| 283 | t.string "authentication_token" | 289 | t.string "authentication_token" |
| 284 | - t.integer "theme_id", default: 1, null: false | 290 | + t.integer "theme_id", default: 1, null: false |
| 285 | t.string "bio" | 291 | t.string "bio" |
| 286 | - t.integer "failed_attempts", default: 0 | 292 | + t.integer "failed_attempts", default: 0 |
| 287 | t.datetime "locked_at" | 293 | t.datetime "locked_at" |
| 288 | t.string "extern_uid" | 294 | t.string "extern_uid" |
| 289 | t.string "provider" | 295 | t.string "provider" |
| 290 | t.string "username" | 296 | t.string "username" |
| 291 | - t.boolean "can_create_group", default: true, null: false | ||
| 292 | - t.boolean "can_create_team", default: true, null: false | 297 | + t.boolean "can_create_group", default: true, null: false |
| 298 | + t.boolean "can_create_team", default: true, null: false | ||
| 293 | t.string "state" | 299 | t.string "state" |
| 294 | - t.integer "color_scheme_id", default: 1, null: false | ||
| 295 | - t.integer "notification_level", default: 1, null: false | 300 | + t.integer "color_scheme_id", default: 1, null: false |
| 301 | + t.integer "notification_level", default: 1, null: false | ||
| 296 | t.datetime "password_expires_at" | 302 | t.datetime "password_expires_at" |
| 297 | t.integer "created_by_id" | 303 | t.integer "created_by_id" |
| 298 | t.string "avatar" | 304 | t.string "avatar" |
| @@ -300,15 +306,14 @@ ActiveRecord::Schema.define(version: 20140116231608) do | @@ -300,15 +306,14 @@ ActiveRecord::Schema.define(version: 20140116231608) do | ||
| 300 | t.datetime "confirmed_at" | 306 | t.datetime "confirmed_at" |
| 301 | t.datetime "confirmation_sent_at" | 307 | t.datetime "confirmation_sent_at" |
| 302 | t.string "unconfirmed_email" | 308 | t.string "unconfirmed_email" |
| 303 | - t.boolean "hide_no_ssh_key", default: false | ||
| 304 | - t.string "website_url", default: "", null: false | 309 | + t.boolean "hide_no_ssh_key", default: false |
| 310 | + t.string "website_url", default: "", null: false | ||
| 305 | end | 311 | end |
| 306 | 312 | ||
| 307 | add_index "users", ["admin"], name: "index_users_on_admin", using: :btree | 313 | add_index "users", ["admin"], name: "index_users_on_admin", using: :btree |
| 308 | add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree | 314 | add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree |
| 309 | add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree | 315 | add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree |
| 310 | add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree | 316 | add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree |
| 311 | - add_index "users", ["extern_uid", "provider"], name: "index_users_on_extern_uid_and_provider", unique: true, using: :btree | ||
| 312 | add_index "users", ["name"], name: "index_users_on_name", using: :btree | 317 | add_index "users", ["name"], name: "index_users_on_name", using: :btree |
| 313 | add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree | 318 | add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree |
| 314 | add_index "users", ["username"], name: "index_users_on_username", using: :btree | 319 | 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 | ||
| 327 | create_table "users_projects", force: true do |t| | 332 | create_table "users_projects", force: true do |t| |
| 328 | t.integer "user_id", null: false | 333 | t.integer "user_id", null: false |
| 329 | t.integer "project_id", null: false | 334 | t.integer "project_id", null: false |
| 330 | - t.datetime "created_at", null: false | ||
| 331 | - t.datetime "updated_at", null: false | 335 | + t.datetime "created_at" |
| 336 | + t.datetime "updated_at" | ||
| 332 | t.integer "project_access", default: 0, null: false | 337 | t.integer "project_access", default: 0, null: false |
| 333 | t.integer "notification_level", default: 3, null: false | 338 | t.integer "notification_level", default: 3, null: false |
| 334 | end | 339 | end |
| @@ -340,8 +345,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do | @@ -340,8 +345,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do | ||
| 340 | create_table "web_hooks", force: true do |t| | 345 | create_table "web_hooks", force: true do |t| |
| 341 | t.string "url" | 346 | t.string "url" |
| 342 | t.integer "project_id" | 347 | t.integer "project_id" |
| 343 | - t.datetime "created_at", null: false | ||
| 344 | - t.datetime "updated_at", null: false | 348 | + t.datetime "created_at" |
| 349 | + t.datetime "updated_at" | ||
| 345 | t.string "type", default: "ProjectHook" | 350 | t.string "type", default: "ProjectHook" |
| 346 | t.integer "service_id" | 351 | t.integer "service_id" |
| 347 | t.boolean "push_events", default: true, null: false | 352 | t.boolean "push_events", default: true, null: false |