Files
old-zsterminator/db/schema.rb

74 lines
2.9 KiB
Ruby
Generated

# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rails
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2025_07_04_092438) do
create_table "companies", force: :cascade do |t|
t.string "name"
t.string "id_number"
t.string "vat_number"
t.string "address_line_one"
t.string "address_line_two"
t.string "postal_code"
t.string "city"
t.string "entity"
t.string "country"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "customers", id: false, force: :cascade do |t|
t.string "phone"
t.text "notes"
t.string "email"
t.integer "birthyear"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "company_id"
t.string "first_name"
t.string "surname", null: false
t.string "original_phone", null: false
t.string "color"
t.index ["company_id"], name: "index_customers_on_company_id"
t.index ["first_name", "surname", "original_phone", "company_id"], name: "index_customers_on_composite_key_and_company", unique: true
t.index ["first_name", "surname", "original_phone"], name: "index_customers_on_composite_key", unique: true
end
create_table "reservations", force: :cascade do |t|
t.integer "company_id", null: false
t.string "title"
t.text "description"
t.datetime "start_time"
t.datetime "end_time"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "team_id", null: false
t.string "customer_first_name"
t.string "customer_surname"
t.string "customer_original_phone"
t.index ["company_id"], name: "index_reservations_on_company_id"
t.index ["team_id"], name: "index_reservations_on_team_id"
end
create_table "teams", force: :cascade do |t|
t.string "name"
t.integer "company_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["company_id"], name: "index_teams_on_company_id"
end
add_foreign_key "reservations", "companies"
add_foreign_key "reservations", "customers", column: ["customer_first_name", "customer_surname", "customer_original_phone"], primary_key: ["first_name", "surname", "original_phone"]
add_foreign_key "reservations", "teams"
add_foreign_key "teams", "companies"
end