# 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.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_01_01_124425) do

  create_table "bottle_racks", force: :cascade do |t|
    t.string "name"
    t.integer "lines"
    t.integer "columns"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "bottles", force: :cascade do |t|
    t.integer "millesime_id"
    t.integer "br_id"
    t.integer "pos"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

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

  create_table "colors_regions", id: false, force: :cascade do |t|
    t.integer "region_id", null: false
    t.integer "color_id", null: false
    t.index ["region_id", "color_id"], name: "index_colors_regions_on_region_id_and_color_id"
  end

  create_table "countries", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "dishes", force: :cascade do |t|
    t.string "name"
    t.string "dish_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "dras", force: :cascade do |t|
    t.integer "dish_id"
    t.integer "region_id"
    t.integer "color_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "millesimes", force: :cascade do |t|
    t.integer "year"
    t.integer "garde"
    t.integer "wine_id"
    t.text "notes"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "preferences", force: :cascade do |t|
    t.string "setting"
    t.string "stype"
    t.string "value"
  end

  create_table "producers", force: :cascade do |t|
    t.string "name"
    t.string "address"
    t.string "zip"
    t.string "city"
    t.integer "country_id"
    t.string "phone"
    t.string "web"
    t.string "email"
    t.text "notes"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "providers", force: :cascade do |t|
    t.string "name"
    t.string "address"
    t.string "zip"
    t.string "city"
    t.integer "country_id"
    t.string "phone"
    t.string "web"
    t.string "email"
    t.text "notes"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "regions", force: :cascade do |t|
    t.integer "country_id"
    t.string "name"
    t.integer "parent_id"
    t.integer "lft", null: false
    t.integer "rgt", null: false
    t.integer "depth", default: 0, null: false
    t.integer "children_count", default: 0, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["country_id"], name: "index_regions_on_country_id"
    t.index ["lft"], name: "index_regions_on_lft"
    t.index ["parent_id"], name: "index_regions_on_parent_id"
    t.index ["rgt"], name: "index_regions_on_rgt"
  end

  create_table "wines", force: :cascade do |t|
    t.string "domain"
    t.boolean "effervescent"
    t.boolean "organic"
    t.integer "color_id"
    t.integer "region_id"
    t.integer "producer_id"
    t.integer "provider_id"
    t.text "notes"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "wlogs", force: :cascade do |t|
    t.integer "millesime_id"
    t.date "date"
    t.string "mvt_type"
    t.integer "quantity"
    t.decimal "price", precision: 8, scale: 2
    t.text "notes"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "br_id"
    t.string "pos"
    t.integer "move_to_br_id"
    t.string "move_to_pos"
  end

end
