diff --git a/db/migrate/20250721145904_add_index_to_clients.rb b/db/migrate/20250721145904_add_index_to_clients.rb new file mode 100644 index 0000000..77a5bd6 --- /dev/null +++ b/db/migrate/20250721145904_add_index_to_clients.rb @@ -0,0 +1,5 @@ +class AddIndexToClients < ActiveRecord::Migration[8.0] + def change + add_index :clients, :email, unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 451ca1d..479cb6d 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[8.0].define(version: 2025_07_21_140802) do +ActiveRecord::Schema[8.0].define(version: 2025_07_21_145904) do create_table "clients", force: :cascade do |t| t.string "company_name" t.string "firstname" @@ -23,6 +23,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_07_21_140802) do t.string "phone" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["email"], name: "index_clients_on_email", unique: true end create_table "projects", force: :cascade do |t|