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 @@
  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 @@
  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
... ...
db/schema.rb
... ... @@ -11,7 +11,14 @@
11 11 #
12 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 23 create_table "events", :force => true do |t|
17 24 t.string "target_type"
... ... @@ -46,8 +53,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
46 53 t.integer "assignee_id"
47 54 t.integer "author_id"
48 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 58 t.integer "position", :default => 0
52 59 t.string "branch_name"
53 60 t.text "description"
... ... @@ -64,12 +71,13 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
64 71  
65 72 create_table "keys", :force => true do |t|
66 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 76 t.text "key"
70 77 t.string "title"
71 78 t.string "identifier"
72 79 t.integer "project_id"
  80 + t.string "type"
73 81 end
74 82  
75 83 add_index "keys", ["identifier"], :name => "index_keys_on_identifier"
... ... @@ -83,8 +91,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
83 91 t.integer "author_id"
84 92 t.integer "assignee_id"
85 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 96 t.text "st_commits", :limit => 2147483647
89 97 t.text "st_diffs", :limit => 2147483647
90 98 t.integer "milestone_id"
... ... @@ -133,8 +141,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
133 141 t.text "note"
134 142 t.string "noteable_type"
135 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 146 t.integer "project_id"
139 147 t.string "attachment"
140 148 t.string "line_code"
... ... @@ -152,8 +160,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
152 160 t.string "name"
153 161 t.string "path"
154 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 165 t.integer "creator_id"
158 166 t.string "default_branch"
159 167 t.boolean "issues_enabled", :default => true, :null => false
... ... @@ -197,8 +205,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
197 205 t.text "content"
198 206 t.integer "author_id", :null => false
199 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 210 t.string "file_name"
203 211 t.datetime "expires_at"
204 212 end
... ... @@ -217,6 +225,9 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
217 225 t.datetime "created_at"
218 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 231 create_table "tags", :force => true do |t|
221 232 t.string "name"
222 233 end
... ... @@ -248,41 +259,42 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
248 259 end
249 260  
250 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 264 t.string "reset_password_token"
254 265 t.datetime "reset_password_sent_at"
255 266 t.datetime "remember_created_at"
256   - t.integer "sign_in_count", :default => 0
  267 + t.integer "sign_in_count", :default => 0
257 268 t.datetime "current_sign_in_at"
258 269 t.datetime "last_sign_in_at"
259 270 t.string "current_sign_in_ip"
260 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 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 280 t.string "authentication_token"
270   - t.integer "theme_id", :default => 1, :null => false
  281 + t.integer "theme_id", :default => 1, :null => false
271 282 t.string "bio"
272   - t.integer "failed_attempts", :default => 0
  283 + t.integer "failed_attempts", :default => 0
273 284 t.datetime "locked_at"
274 285 t.string "extern_uid"
275 286 t.string "provider"
276 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 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 293 end
283 294  
284 295 add_index "users", ["admin"], :name => "index_users_on_admin"
285 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 298 add_index "users", ["name"], :name => "index_users_on_name"
287 299 add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
288 300 add_index "users", ["username"], :name => "index_users_on_username"
... ... @@ -290,8 +302,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
290 302 create_table "users_projects", :force => true do |t|
291 303 t.integer "user_id", :null => false
292 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 307 t.integer "project_access", :default => 0, :null => false
296 308 t.integer "notification_level", :default => 3, :null => false
297 309 end
... ... @@ -303,8 +315,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130410175022) do
303 315 create_table "web_hooks", :force => true do |t|
304 316 t.string "url"
305 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 320 t.string "type", :default => "ProjectHook"
309 321 t.integer "service_id"
310 322 end
... ...