summaryrefslogtreecommitdiff
path: root/db/migrate/20250901112954_rename_crops_to_nutrient_profiles.rb
diff options
context:
space:
mode:
authorMarius Peter <dev@marius-peter.com>2025-09-04 20:55:03 +0200
committerMarius Peter <dev@marius-peter.com>2025-09-04 20:55:03 +0200
commit8ba568ae0ebe715b5da453681eb141886f1977a8 (patch)
tree3bf3a3d5b41286d0a6da8895857314393bae1db2 /db/migrate/20250901112954_rename_crops_to_nutrient_profiles.rb
parent8f8cea2a0408918629dc8bab03495530861a71f3 (diff)
Simpler, Better, Faster... StrongerHEADmaster
Start small, address critical customer needs, /then/ scale.
Diffstat (limited to 'db/migrate/20250901112954_rename_crops_to_nutrient_profiles.rb')
-rw-r--r--db/migrate/20250901112954_rename_crops_to_nutrient_profiles.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/db/migrate/20250901112954_rename_crops_to_nutrient_profiles.rb b/db/migrate/20250901112954_rename_crops_to_nutrient_profiles.rb
new file mode 100644
index 0000000..5b46df1
--- /dev/null
+++ b/db/migrate/20250901112954_rename_crops_to_nutrient_profiles.rb
@@ -0,0 +1,10 @@
+class RenameCropsToNutrientProfiles < ActiveRecord::Migration[8.0]
+ def change
+ rename_table :crops, :nutrient_profiles
+
+ rename_column :rafts, :crop_id, :crop_nutrient_need_id
+ add_index :rafts, :crop_nutrient_need_id unless index_exists?(:rafts, :crop_nutrient_need_id)
+
+ remove_column :nutrient_profiles, :crop_type
+ end
+end
Copyright 2019--2025 Marius PETER