diff --git a/db/migrate/20150810155304_add_organization_to_users.rb b/db/migrate/20150810155304_add_organization_to_users.rb deleted file mode 100644 index b5c38400c..000000000 --- a/db/migrate/20150810155304_add_organization_to_users.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddOrganizationToUsers < ActiveRecord::Migration - def change - add_column :users, :organization_name, :string, limit: 80 - add_column :users, :organization_verified_at, :datetime - add_column :users, :phone_number, :string, limit: 30 - end -end diff --git a/db/migrate/20150812104712_add_organization_rejected_at_to_users.rb b/db/migrate/20150812104712_add_organization_rejected_at_to_users.rb deleted file mode 100644 index a097c7b34..000000000 --- a/db/migrate/20150812104712_add_organization_rejected_at_to_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddOrganizationRejectedAtToUsers < ActiveRecord::Migration - def change - add_column :users, :organization_rejected_at, :datetime - end -end diff --git a/db/migrate/20150813142213_create_organizations.rb b/db/migrate/20150813142213_create_organizations.rb new file mode 100644 index 000000000..a0974df7f --- /dev/null +++ b/db/migrate/20150813142213_create_organizations.rb @@ -0,0 +1,10 @@ +class CreateOrganizations < ActiveRecord::Migration + def change + create_table :organizations do |t| + t.belongs_to :user, index: true, foreign_key: true + t.string :name, limit: 80 + t.datetime :verified_at + t.datetime :rejected_at + end + end +end diff --git a/db/migrate/20150813161654_add_phone_number_to_users.rb b/db/migrate/20150813161654_add_phone_number_to_users.rb new file mode 100644 index 000000000..070b99586 --- /dev/null +++ b/db/migrate/20150813161654_add_phone_number_to_users.rb @@ -0,0 +1,5 @@ +class AddPhoneNumberToUsers < ActiveRecord::Migration + def change + add_column :users, :phone_number, :string, limit: 30 + end +end diff --git a/db/schema.rb b/db/schema.rb index 79860f41f..2c4e7e639 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150812104712) do +ActiveRecord::Schema.define(version: 20150813161654) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -28,12 +28,13 @@ ActiveRecord::Schema.define(version: 20150812104712) do t.string "title" t.text "body" t.string "subject" - t.integer "user_id", null: false + t.integer "user_id", null: false t.integer "parent_id" t.integer "lft" t.integer "rgt" t.datetime "created_at" t.datetime "updated_at" + t.integer "children_count", default: 0 end add_index "comments", ["commentable_id", "commentable_type"], name: "index_comments_on_commentable_id_and_commentable_type", using: :btree @@ -53,6 +54,15 @@ ActiveRecord::Schema.define(version: 20150812104712) do add_index "moderators", ["user_id"], name: "index_moderators_on_user_id", using: :btree + create_table "organizations", force: :cascade do |t| + t.integer "user_id" + t.string "name", limit: 80 + t.datetime "verified_at" + t.datetime "rejected_at" + end + + add_index "organizations", ["user_id"], name: "index_organizations_on_user_id", using: :btree + create_table "simple_captcha_data", force: :cascade do |t| t.string "key", limit: 40 t.string "value", limit: 6 @@ -83,18 +93,18 @@ ActiveRecord::Schema.define(version: 20150812104712) do add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree create_table "users", force: :cascade do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.string "first_name" t.string "last_name" t.string "confirmation_token" @@ -102,13 +112,10 @@ ActiveRecord::Schema.define(version: 20150812104712) do t.datetime "confirmation_sent_at" t.string "unconfirmed_email" t.string "nickname" - t.boolean "use_nickname", default: false, null: false - t.boolean "email_on_debate_comment", default: false - t.boolean "email_on_comment_reply", default: false - t.string "organization_name", limit: 80 - t.datetime "organization_verified_at" - t.string "phone_number", limit: 30 - t.datetime "organization_rejected_at" + t.boolean "use_nickname", default: false, null: false + t.boolean "email_on_debate_comment", default: false + t.boolean "email_on_comment_reply", default: false + t.string "phone_number", limit: 30 end add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree @@ -132,4 +139,5 @@ ActiveRecord::Schema.define(version: 20150812104712) do add_foreign_key "administrators", "users" add_foreign_key "moderators", "users" + add_foreign_key "organizations", "users" end