[Rails] Fertilizer recipe solver for the FAPG.
1
# This file is auto-generated from the current state of the database. Instead
2
# of editing this file, please use the migrations feature of Active Record to
3
# incrementally modify your database, and then regenerate this schema definition.
4
#
5
# This file is the source Rails uses to define your schema when running `bin/rails
6
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
# be faster and is potentially less error prone than running all of your
8
# migrations from scratch. Old migrations may fail to apply correctly if those
9
# migrations use external dependencies or application code.
10
#
11
# It's strongly recommended that you check this file into your version control system.
12
13
ActiveRecord::Schema[8.0].define(version: 2025_09_08_181147) do
14
create_table "fertilizer_components", force: :cascade do |t|
15
t.string "name"
16
t.string "formula"
17
t.float "nno3"
18
t.float "nnh4"
19
t.float "p"
20
t.float "k"
21
t.float "ca"
22
t.float "mg"
23
t.float "s"
24
t.float "na"
25
t.float "cl"
26
t.float "si"
27
t.float "fe"
28
t.float "zn"
29
t.float "b"
30
t.float "mn"
31
t.float "cu"
32
t.float "mo"
33
t.datetime "created_at", null: false
34
t.datetime "updated_at", null: false
35
end
36
37
create_table "fertilizer_compositions", force: :cascade do |t|
38
t.integer "fertilizer_product_id", null: false
39
t.integer "fertilizer_component_id", null: false
40
t.decimal "percent_w", precision: 6, scale: 3, null: false
41
t.datetime "created_at", null: false
42
t.datetime "updated_at", null: false
43
t.index ["fertilizer_component_id"], name: "index_fertilizer_compositions_on_fertilizer_component_id"
44
t.index ["fertilizer_product_id"], name: "index_fertilizer_compositions_on_fertilizer_product_id"
45
end
46
47
create_table "fertilizer_products", force: :cascade do |t|
48
t.string "name", null: false
49
t.decimal "purity", precision: 5, scale: 2, default: "100.0", null: false
50
t.datetime "created_at", null: false
51
t.datetime "updated_at", null: false
52
t.index ["name"], name: "index_fertilizer_products_on_name", unique: true
53
end
54
55
create_table "nutrient_measurements", force: :cascade do |t|
56
t.date "measured_on"
57
t.float "nno3"
58
t.float "p"
59
t.float "k"
60
t.float "ca"
61
t.float "mg"
62
t.float "s"
63
t.float "na"
64
t.float "cl"
65
t.float "si"
66
t.float "fe"
67
t.float "zn"
68
t.float "b"
69
t.float "mn"
70
t.float "cu"
71
t.float "mo"
72
t.float "nnh4"
73
t.datetime "created_at", null: false
74
t.datetime "updated_at", null: false
75
t.index ["measured_on"], name: "index_nutrient_measurements_on_measured_on", unique: true
76
end
77
78
create_table "nutrient_profiles", force: :cascade do |t|
79
t.string "name"
80
t.float "nno3"
81
t.float "p"
82
t.float "k"
83
t.float "ca"
84
t.float "mg"
85
t.float "s"
86
t.float "na"
87
t.float "cl"
88
t.float "si"
89
t.float "fe"
90
t.float "zn"
91
t.float "b"
92
t.float "mn"
93
t.float "cu"
94
t.float "mo"
95
t.float "nnh4"
96
t.datetime "created_at", null: false
97
t.datetime "updated_at", null: false
98
end
99
100
create_table "nutrients", force: :cascade do |t|
101
t.string "formula"
102
t.string "name"
103
end
104
105
create_table "target_allocations", force: :cascade do |t|
106
t.integer "target_id", null: false
107
t.integer "nutrient_profile_id", null: false
108
t.decimal "percentage"
109
t.datetime "created_at", null: false
110
t.datetime "updated_at", null: false
111
t.index ["nutrient_profile_id"], name: "index_target_allocations_on_nutrient_profile_id"
112
t.index ["target_id"], name: "index_target_allocations_on_target_id"
113
end
114
115
create_table "targets", force: :cascade do |t|
116
t.string "name"
117
t.datetime "created_at", null: false
118
t.datetime "updated_at", null: false
119
end
120
121
add_foreign_key "fertilizer_compositions", "fertilizer_components"
122
add_foreign_key "fertilizer_compositions", "fertilizer_products"
123
add_foreign_key "target_allocations", "nutrient_profiles"
124
add_foreign_key "target_allocations", "targets"
125
end
126