summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorMarius Peter <dev@marius-peter.com>2025-09-08 21:21:56 +0200
committerMarius Peter <dev@marius-peter.com>2025-09-08 21:21:56 +0200
commit7116826b854188604e21e2a613ac6672b6fd81f3 (patch)
tree33150bf2e04e69b8e1fa7d37901d2643b1955534 /db/migrate
parent8ba568ae0ebe715b5da453681eb141886f1977a8 (diff)
Create Target and nutrient target table on dashboard.
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20250908181137_create_targets.rb9
-rw-r--r--db/migrate/20250908181147_create_target_allocations.rb11
2 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20250908181137_create_targets.rb b/db/migrate/20250908181137_create_targets.rb
new file mode 100644
index 0000000..9144e50
--- /dev/null
+++ b/db/migrate/20250908181137_create_targets.rb
@@ -0,0 +1,9 @@
+class CreateTargets < ActiveRecord::Migration[8.0]
+ def change
+ create_table :targets do |t|
+ t.string :name
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20250908181147_create_target_allocations.rb b/db/migrate/20250908181147_create_target_allocations.rb
new file mode 100644
index 0000000..9141bd3
--- /dev/null
+++ b/db/migrate/20250908181147_create_target_allocations.rb
@@ -0,0 +1,11 @@
+class CreateTargetAllocations < ActiveRecord::Migration[8.0]
+ def change
+ create_table :target_allocations do |t|
+ t.references :target, null: false, foreign_key: true
+ t.references :nutrient_profile, null: false, foreign_key: true
+ t.decimal :percentage
+
+ t.timestamps
+ end
+ end
+end
Copyright 2019--2025 Marius PETER