Commit 10c0cb8ca763861b8c636ccece7278407650f1c8

Authored by Dmitriy Zaporozhets
1 parent 44c94039

Add migration for already imported projects

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
db/migrate/20140313092127_migrate_already_imported_projects.rb 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +class MigrateAlreadyImportedProjects < ActiveRecord::Migration
  2 + def up
  3 + Project.where(imported: true).update_all(import_status: "finished")
  4 + Project.where(imported: false).update_all(import_status: "none")
  5 + remove_column :projects, :imported
  6 + end
  7 +
  8 + def down
  9 + add_column :projects, :imported, :boolean, default: false
  10 + Project.where(import_status: 'finished').update_all(imported: true)
  11 + end
  12 +end
@@ -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: 20140312145357) do 14 +ActiveRecord::Schema.define(version: 20140313092127) do
15 15
16 # These are extensions that must be enabled in order to support this database 16 # These are extensions that must be enabled in order to support this database
17 enable_extension "plpgsql" 17 enable_extension "plpgsql"
@@ -21,8 +21,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -21,8 +21,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
21 t.datetime "starts_at" 21 t.datetime "starts_at"
22 t.datetime "ends_at" 22 t.datetime "ends_at"
23 t.integer "alert_type" 23 t.integer "alert_type"
24 - t.datetime "created_at"  
25 - t.datetime "updated_at" 24 + t.datetime "created_at", null: false
  25 + t.datetime "updated_at", null: false
26 t.string "color" 26 t.string "color"
27 t.string "font" 27 t.string "font"
28 end 28 end
@@ -30,8 +30,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -30,8 +30,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
30 create_table "deploy_keys_projects", force: true do |t| 30 create_table "deploy_keys_projects", force: true do |t|
31 t.integer "deploy_key_id", null: false 31 t.integer "deploy_key_id", null: false
32 t.integer "project_id", null: false 32 t.integer "project_id", null: false
33 - t.datetime "created_at"  
34 - t.datetime "updated_at" 33 + t.datetime "created_at", null: false
  34 + t.datetime "updated_at", null: false
35 end 35 end
36 36
37 add_index "deploy_keys_projects", ["project_id"], name: "index_deploy_keys_projects_on_project_id", using: :btree 37 add_index "deploy_keys_projects", ["project_id"], name: "index_deploy_keys_projects_on_project_id", using: :btree
@@ -52,8 +52,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -52,8 +52,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
52 t.string "title" 52 t.string "title"
53 t.text "data" 53 t.text "data"
54 t.integer "project_id" 54 t.integer "project_id"
55 - t.datetime "created_at"  
56 - t.datetime "updated_at" 55 + t.datetime "created_at", null: false
  56 + t.datetime "updated_at", null: false
57 t.integer "action" 57 t.integer "action"
58 t.integer "author_id" 58 t.integer "author_id"
59 end 59 end
@@ -68,8 +68,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -68,8 +68,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
68 create_table "forked_project_links", force: true do |t| 68 create_table "forked_project_links", force: true do |t|
69 t.integer "forked_to_project_id", null: false 69 t.integer "forked_to_project_id", null: false
70 t.integer "forked_from_project_id", null: false 70 t.integer "forked_from_project_id", null: false
71 - t.datetime "created_at"  
72 - t.datetime "updated_at" 71 + t.datetime "created_at", null: false
  72 + t.datetime "updated_at", null: false
73 end 73 end
74 74
75 add_index "forked_project_links", ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true, using: :btree 75 add_index "forked_project_links", ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true, using: :btree
@@ -79,8 +79,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -79,8 +79,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
79 t.integer "assignee_id" 79 t.integer "assignee_id"
80 t.integer "author_id" 80 t.integer "author_id"
81 t.integer "project_id" 81 t.integer "project_id"
82 - t.datetime "created_at"  
83 - t.datetime "updated_at" 82 + t.datetime "created_at", null: false
  83 + t.datetime "updated_at", null: false
84 t.integer "position", default: 0 84 t.integer "position", default: 0
85 t.string "branch_name" 85 t.string "branch_name"
86 t.text "description" 86 t.text "description"
@@ -98,8 +98,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -98,8 +98,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
98 98
99 create_table "keys", force: true do |t| 99 create_table "keys", force: true do |t|
100 t.integer "user_id" 100 t.integer "user_id"
101 - t.datetime "created_at"  
102 - t.datetime "updated_at" 101 + t.datetime "created_at", null: false
  102 + t.datetime "updated_at", null: false
103 t.text "key" 103 t.text "key"
104 t.string "title" 104 t.string "title"
105 t.string "type" 105 t.string "type"
@@ -126,8 +126,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -126,8 +126,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
126 t.integer "author_id" 126 t.integer "author_id"
127 t.integer "assignee_id" 127 t.integer "assignee_id"
128 t.string "title" 128 t.string "title"
129 - t.datetime "created_at"  
130 - t.datetime "updated_at" 129 + t.datetime "created_at", null: false
  130 + t.datetime "updated_at", null: false
131 t.integer "milestone_id" 131 t.integer "milestone_id"
132 t.string "state" 132 t.string "state"
133 t.string "merge_status" 133 t.string "merge_status"
@@ -141,7 +141,7 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -141,7 +141,7 @@ ActiveRecord::Schema.define(version: 20140312145357) do
141 add_index "merge_requests", ["created_at"], name: "index_merge_requests_on_created_at", using: :btree 141 add_index "merge_requests", ["created_at"], name: "index_merge_requests_on_created_at", using: :btree
142 add_index "merge_requests", ["milestone_id"], name: "index_merge_requests_on_milestone_id", using: :btree 142 add_index "merge_requests", ["milestone_id"], name: "index_merge_requests_on_milestone_id", using: :btree
143 add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree 143 add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree
144 - add_index "merge_requests", ["source_project_id"], name: "index_merge_requests_on_source_project_id", using: :btree 144 + add_index "merge_requests", ["source_project_id"], name: "index_merge_requests_on_project_id", using: :btree
145 add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree 145 add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree
146 add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree 146 add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree
147 147
@@ -150,8 +150,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -150,8 +150,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
150 t.integer "project_id", null: false 150 t.integer "project_id", null: false
151 t.text "description" 151 t.text "description"
152 t.date "due_date" 152 t.date "due_date"
153 - t.datetime "created_at"  
154 - t.datetime "updated_at" 153 + t.datetime "created_at", null: false
  154 + t.datetime "updated_at", null: false
155 t.string "state" 155 t.string "state"
156 t.integer "iid" 156 t.integer "iid"
157 end 157 end
@@ -163,8 +163,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -163,8 +163,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
163 t.string "name", null: false 163 t.string "name", null: false
164 t.string "path", null: false 164 t.string "path", null: false
165 t.integer "owner_id" 165 t.integer "owner_id"
166 - t.datetime "created_at"  
167 - t.datetime "updated_at" 166 + t.datetime "created_at", null: false
  167 + t.datetime "updated_at", null: false
168 t.string "type" 168 t.string "type"
169 t.string "description", default: "", null: false 169 t.string "description", default: "", null: false
170 t.string "avatar" 170 t.string "avatar"
@@ -179,15 +179,15 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -179,15 +179,15 @@ ActiveRecord::Schema.define(version: 20140312145357) do
179 t.text "note" 179 t.text "note"
180 t.string "noteable_type" 180 t.string "noteable_type"
181 t.integer "author_id" 181 t.integer "author_id"
182 - t.datetime "created_at"  
183 - t.datetime "updated_at" 182 + t.datetime "created_at", null: false
  183 + t.datetime "updated_at", null: false
184 t.integer "project_id" 184 t.integer "project_id"
185 t.string "attachment" 185 t.string "attachment"
186 t.string "line_code" 186 t.string "line_code"
187 t.string "commit_id" 187 t.string "commit_id"
188 t.integer "noteable_id" 188 t.integer "noteable_id"
189 - t.boolean "system", default: false, null: false  
190 t.text "st_diff" 189 t.text "st_diff"
  190 + t.boolean "system", default: false, null: false
191 end 191 end
192 192
193 add_index "notes", ["author_id"], name: "index_notes_on_author_id", using: :btree 193 add_index "notes", ["author_id"], name: "index_notes_on_author_id", using: :btree
@@ -202,8 +202,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -202,8 +202,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
202 t.string "name" 202 t.string "name"
203 t.string "path" 203 t.string "path"
204 t.text "description" 204 t.text "description"
205 - t.datetime "created_at"  
206 - t.datetime "updated_at" 205 + t.datetime "created_at", null: false
  206 + t.datetime "updated_at", null: false
207 t.integer "creator_id" 207 t.integer "creator_id"
208 t.boolean "issues_enabled", default: true, null: false 208 t.boolean "issues_enabled", default: true, null: false
209 t.boolean "wall_enabled", default: true, null: false 209 t.boolean "wall_enabled", default: true, null: false
@@ -214,22 +214,21 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -214,22 +214,21 @@ ActiveRecord::Schema.define(version: 20140312145357) do
214 t.string "issues_tracker_id" 214 t.string "issues_tracker_id"
215 t.boolean "snippets_enabled", default: true, null: false 215 t.boolean "snippets_enabled", default: true, null: false
216 t.datetime "last_activity_at" 216 t.datetime "last_activity_at"
217 - t.boolean "imported", default: false, null: false  
218 t.string "import_url" 217 t.string "import_url"
219 t.integer "visibility_level", default: 0, null: false 218 t.integer "visibility_level", default: 0, null: false
220 t.boolean "archived", default: false, null: false 219 t.boolean "archived", default: false, null: false
221 t.string "import_status" 220 t.string "import_status"
222 end 221 end
223 222
224 - add_index "projects", ["creator_id"], name: "index_projects_on_creator_id", using: :btree 223 + add_index "projects", ["creator_id"], name: "index_projects_on_owner_id", using: :btree
225 add_index "projects", ["last_activity_at"], name: "index_projects_on_last_activity_at", using: :btree 224 add_index "projects", ["last_activity_at"], name: "index_projects_on_last_activity_at", using: :btree
226 add_index "projects", ["namespace_id"], name: "index_projects_on_namespace_id", using: :btree 225 add_index "projects", ["namespace_id"], name: "index_projects_on_namespace_id", using: :btree
227 226
228 create_table "protected_branches", force: true do |t| 227 create_table "protected_branches", force: true do |t|
229 t.integer "project_id", null: false 228 t.integer "project_id", null: false
230 t.string "name", null: false 229 t.string "name", null: false
231 - t.datetime "created_at"  
232 - t.datetime "updated_at" 230 + t.datetime "created_at", null: false
  231 + t.datetime "updated_at", null: false
233 end 232 end
234 233
235 add_index "protected_branches", ["project_id"], name: "index_protected_branches_on_project_id", using: :btree 234 add_index "protected_branches", ["project_id"], name: "index_protected_branches_on_project_id", using: :btree
@@ -239,8 +238,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -239,8 +238,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
239 t.string "title" 238 t.string "title"
240 t.string "token" 239 t.string "token"
241 t.integer "project_id", null: false 240 t.integer "project_id", null: false
242 - t.datetime "created_at"  
243 - t.datetime "updated_at" 241 + t.datetime "created_at", null: false
  242 + t.datetime "updated_at", null: false
244 t.boolean "active", default: false, null: false 243 t.boolean "active", default: false, null: false
245 t.string "project_url" 244 t.string "project_url"
246 t.string "subdomain" 245 t.string "subdomain"
@@ -256,8 +255,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -256,8 +255,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
256 t.text "content" 255 t.text "content"
257 t.integer "author_id", null: false 256 t.integer "author_id", null: false
258 t.integer "project_id" 257 t.integer "project_id"
259 - t.datetime "created_at"  
260 - t.datetime "updated_at" 258 + t.datetime "created_at", null: false
  259 + t.datetime "updated_at", null: false
261 t.string "file_name" 260 t.string "file_name"
262 t.datetime "expires_at" 261 t.datetime "expires_at"
263 t.boolean "private", default: true, null: false 262 t.boolean "private", default: true, null: false
@@ -297,8 +296,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -297,8 +296,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
297 t.datetime "last_sign_in_at" 296 t.datetime "last_sign_in_at"
298 t.string "current_sign_in_ip" 297 t.string "current_sign_in_ip"
299 t.string "last_sign_in_ip" 298 t.string "last_sign_in_ip"
300 - t.datetime "created_at"  
301 - t.datetime "updated_at" 299 + t.datetime "created_at", null: false
  300 + t.datetime "updated_at", null: false
302 t.string "name" 301 t.string "name"
303 t.boolean "admin", default: false, null: false 302 t.boolean "admin", default: false, null: false
304 t.integer "projects_limit", default: 10 303 t.integer "projects_limit", default: 10
@@ -320,7 +319,6 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -320,7 +319,6 @@ ActiveRecord::Schema.define(version: 20140312145357) do
320 t.integer "notification_level", default: 1, null: false 319 t.integer "notification_level", default: 1, null: false
321 t.datetime "password_expires_at" 320 t.datetime "password_expires_at"
322 t.integer "created_by_id" 321 t.integer "created_by_id"
323 - t.datetime "last_credential_check_at"  
324 t.string "avatar" 322 t.string "avatar"
325 t.string "confirmation_token" 323 t.string "confirmation_token"
326 t.datetime "confirmed_at" 324 t.datetime "confirmed_at"
@@ -328,6 +326,7 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -328,6 +326,7 @@ ActiveRecord::Schema.define(version: 20140312145357) do
328 t.string "unconfirmed_email" 326 t.string "unconfirmed_email"
329 t.boolean "hide_no_ssh_key", default: false 327 t.boolean "hide_no_ssh_key", default: false
330 t.string "website_url", default: "", null: false 328 t.string "website_url", default: "", null: false
  329 + t.datetime "last_credential_check_at"
331 end 330 end
332 331
333 add_index "users", ["admin"], name: "index_users_on_admin", using: :btree 332 add_index "users", ["admin"], name: "index_users_on_admin", using: :btree
@@ -343,8 +342,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -343,8 +342,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
343 t.integer "group_access", null: false 342 t.integer "group_access", null: false
344 t.integer "group_id", null: false 343 t.integer "group_id", null: false
345 t.integer "user_id", null: false 344 t.integer "user_id", null: false
346 - t.datetime "created_at"  
347 - t.datetime "updated_at" 345 + t.datetime "created_at", null: false
  346 + t.datetime "updated_at", null: false
348 t.integer "notification_level", default: 3, null: false 347 t.integer "notification_level", default: 3, null: false
349 end 348 end
350 349
@@ -353,8 +352,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -353,8 +352,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
353 create_table "users_projects", force: true do |t| 352 create_table "users_projects", force: true do |t|
354 t.integer "user_id", null: false 353 t.integer "user_id", null: false
355 t.integer "project_id", null: false 354 t.integer "project_id", null: false
356 - t.datetime "created_at"  
357 - t.datetime "updated_at" 355 + t.datetime "created_at", null: false
  356 + t.datetime "updated_at", null: false
358 t.integer "project_access", default: 0, null: false 357 t.integer "project_access", default: 0, null: false
359 t.integer "notification_level", default: 3, null: false 358 t.integer "notification_level", default: 3, null: false
360 end 359 end
@@ -366,8 +365,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do @@ -366,8 +365,8 @@ ActiveRecord::Schema.define(version: 20140312145357) do
366 create_table "web_hooks", force: true do |t| 365 create_table "web_hooks", force: true do |t|
367 t.string "url" 366 t.string "url"
368 t.integer "project_id" 367 t.integer "project_id"
369 - t.datetime "created_at"  
370 - t.datetime "updated_at" 368 + t.datetime "created_at", null: false
  369 + t.datetime "updated_at", null: false
371 t.string "type", default: "ProjectHook" 370 t.string "type", default: "ProjectHook"
372 t.integer "service_id" 371 t.integer "service_id"
373 t.boolean "push_events", default: true, null: false 372 t.boolean "push_events", default: true, null: false