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