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 @@ |
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 @@ |
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 | 11 | # |
12 | 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 | 16 | create_table "broadcast_messages", force: true do |t| |
17 | 17 | t.text "message", null: false |
... | ... | @@ -66,8 +66,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do |
66 | 66 | t.integer "assignee_id" |
67 | 67 | t.integer "author_id" |
68 | 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 | 71 | t.integer "position", default: 0 |
72 | 72 | t.string "branch_name" |
73 | 73 | t.text "description" |
... | ... | @@ -85,8 +85,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do |
85 | 85 | |
86 | 86 | create_table "keys", force: true do |t| |
87 | 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 | 90 | t.text "key" |
91 | 91 | t.string "title" |
92 | 92 | t.string "type" |
... | ... | @@ -95,6 +95,15 @@ ActiveRecord::Schema.define(version: 20140116231608) do |
95 | 95 | |
96 | 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 | 107 | create_table "merge_requests", force: true do |t| |
99 | 108 | t.string "target_branch", null: false |
100 | 109 | t.string "source_branch", null: false |
... | ... | @@ -102,8 +111,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do |
102 | 111 | t.integer "author_id" |
103 | 112 | t.integer "assignee_id" |
104 | 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 | 116 | t.text "st_commits", limit: 2147483647 |
108 | 117 | t.text "st_diffs", limit: 2147483647 |
109 | 118 | t.integer "milestone_id" |
... | ... | @@ -156,8 +165,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do |
156 | 165 | t.text "note" |
157 | 166 | t.string "noteable_type" |
158 | 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 | 170 | t.integer "project_id" |
162 | 171 | t.string "attachment" |
163 | 172 | t.string "line_code" |
... | ... | @@ -179,8 +188,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do |
179 | 188 | t.string "name" |
180 | 189 | t.string "path" |
181 | 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 | 193 | t.integer "creator_id" |
185 | 194 | t.boolean "issues_enabled", default: true, null: false |
186 | 195 | t.boolean "wall_enabled", default: true, null: false |
... | ... | @@ -231,8 +240,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do |
231 | 240 | t.text "content", limit: 2147483647 |
232 | 241 | t.integer "author_id", null: false |
233 | 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 | 245 | t.string "file_name" |
237 | 246 | t.datetime "expires_at" |
238 | 247 | t.boolean "private", default: true, null: false |
... | ... | @@ -254,45 +263,42 @@ ActiveRecord::Schema.define(version: 20140116231608) do |
254 | 263 | t.datetime "created_at" |
255 | 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 | 266 | create_table "tags", force: true do |t| |
261 | 267 | t.string "name" |
262 | 268 | end |
263 | 269 | |
264 | 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 | 273 | t.string "reset_password_token" |
268 | 274 | t.datetime "reset_password_sent_at" |
269 | 275 | t.datetime "remember_created_at" |
270 | - t.integer "sign_in_count", default: 0 | |
276 | + t.integer "sign_in_count", default: 0 | |
271 | 277 | t.datetime "current_sign_in_at" |
272 | 278 | t.datetime "last_sign_in_at" |
273 | 279 | t.string "current_sign_in_ip" |
274 | 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 | 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 | 289 | t.string "authentication_token" |
284 | - t.integer "theme_id", default: 1, null: false | |
290 | + t.integer "theme_id", default: 1, null: false | |
285 | 291 | t.string "bio" |
286 | - t.integer "failed_attempts", default: 0 | |
292 | + t.integer "failed_attempts", default: 0 | |
287 | 293 | t.datetime "locked_at" |
288 | 294 | t.string "extern_uid" |
289 | 295 | t.string "provider" |
290 | 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 | 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 | 302 | t.datetime "password_expires_at" |
297 | 303 | t.integer "created_by_id" |
298 | 304 | t.string "avatar" |
... | ... | @@ -300,15 +306,14 @@ ActiveRecord::Schema.define(version: 20140116231608) do |
300 | 306 | t.datetime "confirmed_at" |
301 | 307 | t.datetime "confirmation_sent_at" |
302 | 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 | 311 | end |
306 | 312 | |
307 | 313 | add_index "users", ["admin"], name: "index_users_on_admin", using: :btree |
308 | 314 | add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree |
309 | 315 | add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree |
310 | 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 | 317 | add_index "users", ["name"], name: "index_users_on_name", using: :btree |
313 | 318 | add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree |
314 | 319 | add_index "users", ["username"], name: "index_users_on_username", using: :btree |
... | ... | @@ -327,8 +332,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do |
327 | 332 | create_table "users_projects", force: true do |t| |
328 | 333 | t.integer "user_id", null: false |
329 | 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 | 337 | t.integer "project_access", default: 0, null: false |
333 | 338 | t.integer "notification_level", default: 3, null: false |
334 | 339 | end |
... | ... | @@ -340,8 +345,8 @@ ActiveRecord::Schema.define(version: 20140116231608) do |
340 | 345 | create_table "web_hooks", force: true do |t| |
341 | 346 | t.string "url" |
342 | 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 | 350 | t.string "type", default: "ProjectHook" |
346 | 351 | t.integer "service_id" |
347 | 352 | t.boolean "push_events", default: true, null: false | ... | ... |