diff --git a/db/migrate/20150827205816_add_index_to_categories_photos.rb b/db/migrate/20150827205816_add_index_to_categories_photos.rb new file mode 100644 index 0000000..1d36db8 --- /dev/null +++ b/db/migrate/20150827205816_add_index_to_categories_photos.rb @@ -0,0 +1,5 @@ +class AddIndexToCategoriesPhotos < ActiveRecord::Migration + def change + add_index :categories_photos, [:category_id, :photo_id], unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 46e35bb..333c11a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,18 +11,18 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140308082639) do +ActiveRecord::Schema.define(version: 20150827205816) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" create_table "admin_users", force: true 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", limit: 128, 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 + t.integer "sign_in_count", default: 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" @@ -30,8 +30,7 @@ ActiveRecord::Schema.define(version: 20140308082639) do t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.string "unconfirmed_email" - t.integer "failed_attempts", default: 0 + t.integer "failed_attempts", default: 0 t.string "unlock_token" t.datetime "locked_at" t.datetime "created_at" @@ -59,6 +58,8 @@ ActiveRecord::Schema.define(version: 20140308082639) do t.integer "photo_id" end + add_index "categories_photos", ["category_id", "photo_id"], name: "index_categories_photos_on_category_id_and_photo_id", unique: true, using: :btree + create_table "pages", force: true do |t| t.string "name" t.string "title"