Commit a735ce2aa7da72242629a4452c33e7a1900fdd62

Authored by Dmitriy Zaporozhets
1 parent 543d86f3

migrations for ssh key STI and deploy keys <-> projects relation

db/migrate/20130506085413_add_type_to_key.rb 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +class AddTypeToKey < ActiveRecord::Migration
  2 + def change
  3 + add_column :keys, :type, :string
  4 + end
  5 +end
db/migrate/20130506090604_create_deploy_keys_projects.rb 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +class CreateDeployKeysProjects < ActiveRecord::Migration
  2 + def change
  3 + create_table :deploy_keys_projects do |t|
  4 + t.integer :deploy_key_id, null: false
  5 + t.integer :project_id, null: false
  6 +
  7 + t.timestamps
  8 + end
  9 + end
  10 +end
@@ -11,7 +11,14 @@ @@ -11,7 +11,14 @@
11 # 11 #
12 # It's strongly recommended to check this file into your version control system. 12 # It's strongly recommended to check this file into your version control system.
13 13
14 -ActiveRecord::Schema.define(:version => 20130410175022) do 14 +ActiveRecord::Schema.define(:version => 20130506090604) do
  15 +
  16 + create_table "deploy_keys_projects", :force => true do |t|
  17 + t.integer "deploy_key_id", :null => false
  18 + t.integer "project_id", :null => false
  19 + t.datetime "created_at", :null => false
  20 + t.datetime "updated_at", :null => false
  21 + end
15 22
16 create_table "events", :force => true do |t| 23 create_table "events", :force => true do |t|
17 t.string "target_type" 24 t.string "target_type"
@@ -46,8 +53,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do @@ -46,8 +53,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
46 t.integer "assignee_id" 53 t.integer "assignee_id"
47 t.integer "author_id" 54 t.integer "author_id"
48 t.integer "project_id" 55 t.integer "project_id"
49 - t.datetime "created_at"  
50 - t.datetime "updated_at" 56 + t.datetime "created_at", :null => false
  57 + t.datetime "updated_at", :null => false
51 t.integer "position", :default => 0 58 t.integer "position", :default => 0
52 t.string "branch_name" 59 t.string "branch_name"
53 t.text "description" 60 t.text "description"
@@ -64,12 +71,13 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do @@ -64,12 +71,13 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
64 71
65 create_table "keys", :force => true do |t| 72 create_table "keys", :force => true do |t|
66 t.integer "user_id" 73 t.integer "user_id"
67 - t.datetime "created_at"  
68 - t.datetime "updated_at" 74 + t.datetime "created_at", :null => false
  75 + t.datetime "updated_at", :null => false
69 t.text "key" 76 t.text "key"
70 t.string "title" 77 t.string "title"
71 t.string "identifier" 78 t.string "identifier"
72 t.integer "project_id" 79 t.integer "project_id"
  80 + t.string "type"
73 end 81 end
74 82
75 add_index "keys", ["identifier"], :name => "index_keys_on_identifier" 83 add_index "keys", ["identifier"], :name => "index_keys_on_identifier"
@@ -83,8 +91,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do @@ -83,8 +91,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
83 t.integer "author_id" 91 t.integer "author_id"
84 t.integer "assignee_id" 92 t.integer "assignee_id"
85 t.string "title" 93 t.string "title"
86 - t.datetime "created_at"  
87 - t.datetime "updated_at" 94 + t.datetime "created_at", :null => false
  95 + t.datetime "updated_at", :null => false
88 t.text "st_commits", :limit => 2147483647 96 t.text "st_commits", :limit => 2147483647
89 t.text "st_diffs", :limit => 2147483647 97 t.text "st_diffs", :limit => 2147483647
90 t.integer "milestone_id" 98 t.integer "milestone_id"
@@ -133,8 +141,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do @@ -133,8 +141,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
133 t.text "note" 141 t.text "note"
134 t.string "noteable_type" 142 t.string "noteable_type"
135 t.integer "author_id" 143 t.integer "author_id"
136 - t.datetime "created_at"  
137 - t.datetime "updated_at" 144 + t.datetime "created_at", :null => false
  145 + t.datetime "updated_at", :null => false
138 t.integer "project_id" 146 t.integer "project_id"
139 t.string "attachment" 147 t.string "attachment"
140 t.string "line_code" 148 t.string "line_code"
@@ -152,8 +160,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do @@ -152,8 +160,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
152 t.string "name" 160 t.string "name"
153 t.string "path" 161 t.string "path"
154 t.text "description" 162 t.text "description"
155 - t.datetime "created_at"  
156 - t.datetime "updated_at" 163 + t.datetime "created_at", :null => false
  164 + t.datetime "updated_at", :null => false
157 t.integer "creator_id" 165 t.integer "creator_id"
158 t.string "default_branch" 166 t.string "default_branch"
159 t.boolean "issues_enabled", :default => true, :null => false 167 t.boolean "issues_enabled", :default => true, :null => false
@@ -197,8 +205,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do @@ -197,8 +205,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
197 t.text "content" 205 t.text "content"
198 t.integer "author_id", :null => false 206 t.integer "author_id", :null => false
199 t.integer "project_id", :null => false 207 t.integer "project_id", :null => false
200 - t.datetime "created_at"  
201 - t.datetime "updated_at" 208 + t.datetime "created_at", :null => false
  209 + t.datetime "updated_at", :null => false
202 t.string "file_name" 210 t.string "file_name"
203 t.datetime "expires_at" 211 t.datetime "expires_at"
204 end 212 end
@@ -217,6 +225,9 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do @@ -217,6 +225,9 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
217 t.datetime "created_at" 225 t.datetime "created_at"
218 end 226 end
219 227
  228 + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
  229 + add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
  230 +
220 create_table "tags", :force => true do |t| 231 create_table "tags", :force => true do |t|
221 t.string "name" 232 t.string "name"
222 end 233 end
@@ -248,41 +259,42 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do @@ -248,41 +259,42 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
248 end 259 end
249 260
250 create_table "users", :force => true do |t| 261 create_table "users", :force => true do |t|
251 - t.string "email", :default => "", :null => false  
252 - t.string "encrypted_password", :limit => 128, :default => "", :null => false 262 + t.string "email", :default => "", :null => false
  263 + t.string "encrypted_password", :default => "", :null => false
253 t.string "reset_password_token" 264 t.string "reset_password_token"
254 t.datetime "reset_password_sent_at" 265 t.datetime "reset_password_sent_at"
255 t.datetime "remember_created_at" 266 t.datetime "remember_created_at"
256 - t.integer "sign_in_count", :default => 0 267 + t.integer "sign_in_count", :default => 0
257 t.datetime "current_sign_in_at" 268 t.datetime "current_sign_in_at"
258 t.datetime "last_sign_in_at" 269 t.datetime "last_sign_in_at"
259 t.string "current_sign_in_ip" 270 t.string "current_sign_in_ip"
260 t.string "last_sign_in_ip" 271 t.string "last_sign_in_ip"
261 - t.datetime "created_at"  
262 - t.datetime "updated_at" 272 + t.datetime "created_at", :null => false
  273 + t.datetime "updated_at", :null => false
263 t.string "name" 274 t.string "name"
264 - t.boolean "admin", :default => false, :null => false  
265 - t.integer "projects_limit", :default => 10  
266 - t.string "skype", :default => "", :null => false  
267 - t.string "linkedin", :default => "", :null => false  
268 - t.string "twitter", :default => "", :null => false 275 + t.boolean "admin", :default => false, :null => false
  276 + t.integer "projects_limit", :default => 10
  277 + t.string "skype", :default => "", :null => false
  278 + t.string "linkedin", :default => "", :null => false
  279 + t.string "twitter", :default => "", :null => false
269 t.string "authentication_token" 280 t.string "authentication_token"
270 - t.integer "theme_id", :default => 1, :null => false 281 + t.integer "theme_id", :default => 1, :null => false
271 t.string "bio" 282 t.string "bio"
272 - t.integer "failed_attempts", :default => 0 283 + t.integer "failed_attempts", :default => 0
273 t.datetime "locked_at" 284 t.datetime "locked_at"
274 t.string "extern_uid" 285 t.string "extern_uid"
275 t.string "provider" 286 t.string "provider"
276 t.string "username" 287 t.string "username"
277 - t.boolean "can_create_group", :default => true, :null => false  
278 - t.boolean "can_create_team", :default => true, :null => false 288 + t.boolean "can_create_group", :default => true, :null => false
  289 + t.boolean "can_create_team", :default => true, :null => false
279 t.string "state" 290 t.string "state"
280 - t.integer "color_scheme_id", :default => 1, :null => false  
281 - t.integer "notification_level", :default => 1, :null => false 291 + t.integer "color_scheme_id", :default => 1, :null => false
  292 + t.integer "notification_level", :default => 1, :null => false
282 end 293 end
283 294
284 add_index "users", ["admin"], :name => "index_users_on_admin" 295 add_index "users", ["admin"], :name => "index_users_on_admin"
285 add_index "users", ["email"], :name => "index_users_on_email", :unique => true 296 add_index "users", ["email"], :name => "index_users_on_email", :unique => true
  297 + add_index "users", ["extern_uid", "provider"], :name => "index_users_on_extern_uid_and_provider", :unique => true
286 add_index "users", ["name"], :name => "index_users_on_name" 298 add_index "users", ["name"], :name => "index_users_on_name"
287 add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true 299 add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
288 add_index "users", ["username"], :name => "index_users_on_username" 300 add_index "users", ["username"], :name => "index_users_on_username"
@@ -290,8 +302,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do @@ -290,8 +302,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
290 create_table "users_projects", :force => true do |t| 302 create_table "users_projects", :force => true do |t|
291 t.integer "user_id", :null => false 303 t.integer "user_id", :null => false
292 t.integer "project_id", :null => false 304 t.integer "project_id", :null => false
293 - t.datetime "created_at"  
294 - t.datetime "updated_at" 305 + t.datetime "created_at", :null => false
  306 + t.datetime "updated_at", :null => false
295 t.integer "project_access", :default => 0, :null => false 307 t.integer "project_access", :default => 0, :null => false
296 t.integer "notification_level", :default => 3, :null => false 308 t.integer "notification_level", :default => 3, :null => false
297 end 309 end
@@ -303,8 +315,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do @@ -303,8 +315,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
303 create_table "web_hooks", :force => true do |t| 315 create_table "web_hooks", :force => true do |t|
304 t.string "url" 316 t.string "url"
305 t.integer "project_id" 317 t.integer "project_id"
306 - t.datetime "created_at"  
307 - t.datetime "updated_at" 318 + t.datetime "created_at", :null => false
  319 + t.datetime "updated_at", :null => false
308 t.string "type", :default => "ProjectHook" 320 t.string "type", :default => "ProjectHook"
309 t.integer "service_id" 321 t.integer "service_id"
310 end 322 end