# 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.0].define(version: 2022_04_25_103855) do
  create_table "absences", charset: "utf8mb4", force: :cascade do |t|
    t.integer "name"
    t.date "start_time"
    t.date "end_time"
    t.bigint "user_id"
    t.text "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "creator"
    t.string "updater"
    t.boolean "cancelled"
    t.index ["user_id"], name: "index_absences_on_user_id"
  end

  create_table "colors", charset: "utf8mb4", force: :cascade do |t|
    t.string "name"
    t.string "code"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "departments", charset: "utf8mb4", force: :cascade do |t|
    t.string "name"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "diseases", charset: "utf8mb4", force: :cascade do |t|
    t.integer "name"
    t.date "start_time"
    t.date "end_time"
    t.bigint "user_id"
    t.text "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "creator"
    t.string "updater"
    t.boolean "cancelled"
    t.string "certificate_number"
    t.index ["user_id"], name: "index_diseases_on_user_id"
  end

  create_table "holidays", charset: "utf8mb4", force: :cascade do |t|
    t.integer "name"
    t.datetime "start_time"
    t.datetime "end_time"
    t.bigint "user_id"
    t.text "description"
    t.string "creator"
    t.string "updater"
    t.boolean "cancelled"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_holidays_on_user_id"
  end

  create_table "howtos", charset: "utf8mb4", force: :cascade do |t|
    t.string "name"
    t.bigint "topic_id", null: false
    t.text "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["topic_id"], name: "index_howtos_on_topic_id"
  end

  create_table "overtimes", charset: "utf8mb4", force: :cascade do |t|
    t.integer "name"
    t.datetime "start_time"
    t.datetime "end_time"
    t.bigint "user_id"
    t.text "description"
    t.string "creator"
    t.string "updater"
    t.boolean "cancelled"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_overtimes_on_user_id"
  end

  create_table "permits", charset: "utf8mb4", force: :cascade do |t|
    t.integer "name"
    t.datetime "start_time", precision: nil
    t.datetime "end_time", precision: nil
    t.bigint "user_id"
    t.text "description"
    t.string "creator"
    t.string "updater"
    t.boolean "cancelled"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_permits_on_user_id"
  end

  create_table "topics", charset: "utf8mb4", force: :cascade do |t|
    t.string "name"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "users", charset: "utf8mb4", force: :cascade do |t|
    t.string "email", default: "", null: false
    t.string "encrypted_password", default: "", null: false
    t.string "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.string "first_name"
    t.string "last_name"
    t.string "phone"
    t.string "mobile"
    t.boolean "admin"
    t.boolean "manager"
    t.boolean "regular"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.bigint "department_id"
    t.bigint "zone_id"
    t.string "username", default: "", null: false
    t.bigint "color_id", null: false
    t.index ["color_id"], name: "index_users_on_color_id"
    t.index ["department_id"], name: "index_users_on_department_id"
    t.index ["email"], name: "index_users_on_email", unique: true
    t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
    t.index ["zone_id"], name: "index_users_on_zone_id"
  end

  create_table "zones", charset: "utf8mb4", force: :cascade do |t|
    t.string "name"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  add_foreign_key "absences", "users"
  add_foreign_key "diseases", "users"
  add_foreign_key "holidays", "users"
  add_foreign_key "howtos", "topics"
  add_foreign_key "overtimes", "users"
  add_foreign_key "permits", "users"
  add_foreign_key "users", "colors"
  add_foreign_key "users", "departments"
  add_foreign_key "users", "zones"
end
