add unique index for emails in clients

This commit is contained in:
Stefan Tollkühn
2025-07-21 17:00:20 +02:00
parent 347bdf370b
commit 6647a62ccd
2 changed files with 7 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
class AddIndexToClients < ActiveRecord::Migration[8.0]
def change
add_index :clients, :email, unique: true
end
end

3
db/schema.rb generated
View File

@@ -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|