# 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[8.1].define(version: 2018_09_15_134841) do
  create_table "food_units", force: :cascade do |t|
    t.integer "food_id", null: false
    t.decimal "gram_weight", precision: 10, scale: 2, null: false
    t.string "name", null: false
    t.index ["food_id"], name: "index_food_units_on_food_id"
  end

  create_table "foods", force: :cascade do |t|
    t.decimal "ash", precision: 10, scale: 2
    t.integer "calcium"
    t.decimal "carbohydrates", precision: 10, scale: 2
    t.decimal "cholesterol", precision: 10, scale: 3
    t.decimal "copper", precision: 10, scale: 3
    t.datetime "created_at", precision: nil, null: false
    t.string "density"
    t.decimal "fiber", precision: 10, scale: 1
    t.decimal "iron", precision: 10, scale: 2
    t.integer "kcal"
    t.decimal "lipids", precision: 10, scale: 2
    t.integer "magnesium"
    t.decimal "manganese", precision: 10, scale: 3
    t.string "name"
    t.string "ndbn", limit: 25
    t.text "notes"
    t.integer "phosphorus"
    t.integer "potassium"
    t.decimal "protein", precision: 10, scale: 2
    t.integer "sodium"
    t.decimal "sugar", precision: 10, scale: 2
    t.datetime "updated_at", precision: nil, null: false
    t.integer "user_id"
    t.integer "vit_a"
    t.decimal "vit_b12", precision: 10, scale: 2
    t.decimal "vit_b6", precision: 10, scale: 3
    t.decimal "vit_c", precision: 10, scale: 1
    t.decimal "vit_d", precision: 10, scale: 1
    t.decimal "vit_e", precision: 10, scale: 2
    t.decimal "vit_k", precision: 10, scale: 1
    t.decimal "water", precision: 10, scale: 2
    t.decimal "zinc", precision: 10, scale: 2
    t.index ["ndbn"], name: "index_foods_on_ndbn"
  end

  create_table "logs", force: :cascade do |t|
    t.datetime "created_at", precision: nil, null: false
    t.datetime "date", precision: nil
    t.text "notes"
    t.integer "rating"
    t.integer "recipe_id"
    t.integer "source_recipe_id"
    t.datetime "updated_at", precision: nil, null: false
    t.integer "user_id"
  end

  create_table "notes", force: :cascade do |t|
    t.text "content", null: false
    t.datetime "created_at", precision: nil, null: false
    t.datetime "updated_at", precision: nil, null: false
    t.integer "user_id", null: false
    t.index ["user_id"], name: "index_notes_on_user_id"
  end

  create_table "recipe_ingredients", force: :cascade do |t|
    t.datetime "created_at", precision: nil, null: false
    t.integer "food_id"
    t.string "name"
    t.text "preparation"
    t.string "quantity"
    t.integer "recipe_as_ingredient_id"
    t.integer "recipe_id"
    t.integer "sort_order"
    t.string "units"
    t.datetime "updated_at", precision: nil, null: false
    t.index ["recipe_id"], name: "index_recipe_ingredients_on_recipe_id"
  end

  create_table "recipe_steps", force: :cascade do |t|
    t.datetime "created_at", precision: nil, null: false
    t.integer "recipe_id"
    t.integer "sort_order"
    t.text "step"
    t.datetime "updated_at", precision: nil, null: false
    t.index ["recipe_id"], name: "index_recipe_steps_on_recipe_id"
  end

  create_table "recipes", force: :cascade do |t|
    t.integer "active_time"
    t.datetime "created_at", precision: nil, null: false
    t.boolean "deleted"
    t.text "description"
    t.boolean "is_ingredient"
    t.boolean "is_log"
    t.string "name"
    t.float "rating"
    t.text "source"
    t.text "step_text"
    t.integer "total_time"
    t.datetime "updated_at", precision: nil, null: false
    t.integer "user_id"
    t.string "yields"
  end

  create_table "recipes_tags", id: false, force: :cascade do |t|
    t.integer "recipe_id"
    t.integer "tag_id"
    t.index ["recipe_id"], name: "index_recipes_tags_on_recipe_id"
    t.index ["tag_id"], name: "index_recipes_tags_on_tag_id"
  end

  create_table "tags", force: :cascade do |t|
    t.datetime "created_at", precision: nil, null: false
    t.string "lowercase_name"
    t.string "name"
    t.datetime "updated_at", precision: nil, null: false
    t.index ["lowercase_name"], name: "index_tags_on_lowercase_name", unique: true
  end

  create_table "task_items", force: :cascade do |t|
    t.boolean "completed"
    t.datetime "created_at", precision: nil, null: false
    t.string "name"
    t.string "quantity"
    t.integer "task_list_id", null: false
    t.datetime "updated_at", precision: nil, null: false
    t.index ["task_list_id"], name: "index_task_items_on_task_list_id"
  end

  create_table "task_lists", force: :cascade do |t|
    t.datetime "created_at", precision: nil, null: false
    t.string "name"
    t.datetime "updated_at", precision: nil, null: false
    t.integer "user_id", null: false
    t.index ["user_id"], name: "index_task_lists_on_user_id"
  end

  create_table "usda_food_weights", force: :cascade do |t|
    t.decimal "amount", precision: 7, scale: 3
    t.datetime "created_at", precision: nil, null: false
    t.string "description"
    t.decimal "gram_weight", precision: 7, scale: 1
    t.datetime "updated_at", precision: nil, null: false
    t.integer "usda_food_id", null: false
    t.index ["usda_food_id"], name: "index_usda_food_weights_on_usda_food_id"
  end

  create_table "usda_foods", force: :cascade do |t|
    t.decimal "ash", precision: 10, scale: 2
    t.integer "calcium"
    t.decimal "carbohydrates", precision: 10, scale: 2
    t.decimal "cholesterol", precision: 10, scale: 3
    t.decimal "copper", precision: 10, scale: 3
    t.datetime "created_at", precision: nil, null: false
    t.decimal "fiber", precision: 10, scale: 1
    t.decimal "gram_weight_1", precision: 9, scale: 2
    t.decimal "gram_weight_2", precision: 9, scale: 2
    t.string "gram_weight_desc_1"
    t.string "gram_weight_desc_2"
    t.text "ingredients"
    t.decimal "iron", precision: 10, scale: 2
    t.integer "kcal"
    t.decimal "lipid", precision: 10, scale: 2
    t.string "long_description"
    t.integer "magnesium"
    t.decimal "manganese", precision: 10, scale: 3
    t.string "manufacturer"
    t.string "ndbn", limit: 25
    t.string "nutrient_unit"
    t.integer "phosphorus"
    t.integer "potassium"
    t.decimal "protein", precision: 10, scale: 2
    t.string "refuse_description"
    t.integer "refuse_percent"
    t.string "scientific_name"
    t.string "short_description"
    t.integer "sodium"
    t.string "source"
    t.decimal "sugar", precision: 10, scale: 2
    t.datetime "updated_at", precision: nil, null: false
    t.integer "vit_a"
    t.decimal "vit_b12", precision: 10, scale: 2
    t.decimal "vit_b6", precision: 10, scale: 3
    t.decimal "vit_c", precision: 10, scale: 1
    t.decimal "vit_d", precision: 10, scale: 1
    t.decimal "vit_e", precision: 10, scale: 2
    t.decimal "vit_k", precision: 10, scale: 1
    t.decimal "water", precision: 10, scale: 2
    t.decimal "zinc", precision: 10, scale: 2
    t.index ["long_description"], name: "index_usda_foods_on_long_description"
    t.index ["ndbn"], name: "index_usda_foods_on_ndbn"
  end

  create_table "users", force: :cascade do |t|
    t.boolean "admin"
    t.datetime "created_at", precision: nil, null: false
    t.string "email"
    t.string "full_name"
    t.string "password_digest"
    t.datetime "updated_at", precision: nil, null: false
    t.string "username"
  end
end
