diff --git a/db/migrate/20240403055814_add_index_to_users.rb b/db/migrate/20240403055814_add_index_to_users.rb new file mode 100644 index 0000000..338f002 --- /dev/null +++ b/db/migrate/20240403055814_add_index_to_users.rb @@ -0,0 +1,6 @@ +class AddIndexToUsers < ActiveRecord::Migration[7.1] + def change + add_index :users, :name, unique: true + add_index :users, :image_url, unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 4e4dfe7..a88c51d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_03_28_001932) do +ActiveRecord::Schema[7.1].define(version: 2024_04_03_055814) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -32,6 +32,8 @@ t.string "image_url", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["image_url"], name: "index_users_on_image_url", unique: true + t.index ["name"], name: "index_users_on_name", unique: true t.index ["provider", "uid"], name: "index_users_on_provider_and_uid", unique: true end