# 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: 20160812205919) do

  create_table "ingredient_units", force: :cascade do |t|
    t.integer "ingredient_id",                          null: false
    t.string  "name",                                   null: false
    t.decimal "gram_weight",   precision: 10, scale: 2, null: false
    t.index ["ingredient_id"], name: "index_ingredient_units_on_ingredient_id"
  end

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

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

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

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

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

  create_table "usda_food_weights", force: :cascade do |t|
    t.integer  "usda_food_id",                         null: false
    t.decimal  "amount",       precision: 7, scale: 3
    t.string   "description"
    t.decimal  "gram_weight",  precision: 7, scale: 1
    t.datetime "created_at",                           null: false
    t.datetime "updated_at",                           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.string   "ndbn",               limit: 5,                          null: false
    t.string   "long_description"
    t.string   "short_description"
    t.decimal  "water",                        precision: 10, scale: 2
    t.integer  "kcal"
    t.decimal  "protein",                      precision: 10, scale: 2
    t.decimal  "lipid",                        precision: 10, scale: 2
    t.decimal  "ash",                          precision: 10, scale: 2
    t.decimal  "carbohydrates",                precision: 10, scale: 2
    t.decimal  "fiber",                        precision: 10, scale: 1
    t.decimal  "sugar",                        precision: 10, scale: 2
    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.string   "refuse_description"
    t.integer  "refuse_percent"
    t.string   "scientific_name"
    t.datetime "created_at",                                            null: false
    t.datetime "updated_at",                                            null: false
    t.integer  "calcium"
    t.decimal  "iron",                         precision: 10, scale: 2
    t.integer  "magnesium"
    t.integer  "phosphorus"
    t.integer  "potassium"
    t.integer  "sodium"
    t.decimal  "zinc",                         precision: 10, scale: 2
    t.decimal  "copper",                       precision: 10, scale: 3
    t.decimal  "manganese",                    precision: 10, scale: 3
    t.decimal  "vit_c",                        precision: 10, scale: 1
    t.decimal  "vit_b6",                       precision: 10, scale: 3
    t.decimal  "vit_b12",                      precision: 10, scale: 2
    t.integer  "vit_a"
    t.decimal  "vit_e",                        precision: 10, scale: 2
    t.decimal  "vit_d",                        precision: 10, scale: 1
    t.decimal  "vit_k",                        precision: 10, scale: 1
    t.decimal  "cholesterol",                  precision: 10, scale: 3
    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.string   "username"
    t.string   "email"
    t.string   "full_name"
    t.string   "password_digest"
    t.boolean  "admin"
    t.datetime "created_at",      null: false
    t.datetime "updated_at",      null: false
  end

end
