how i can rollback or remove this formula clean im try def up and def down but not migrate
class AllowAllTrackersAsSubtasks < ActiveRecord::Migration[5.1]
def change
trackers = Tracker.all
trackers_ids = trackers.pluck(:id)
trackers.each do |tracker|
tracker.subtask_ids = trackers_ids
tracker.save
end
end
end
this another code
class CreateTrackerSubtask < ActiveRecord::Migration[5.1]
def change
create_table "trackers_subtasks", :id => false, :force => true do |t|
t.column "tracker_id", :integer, :default => 0, :null => false
t.column "subtask_id", :integer, :default => 0, :null => false
t.index [:tracker_id, :subtask_id], :unique => true
end
end
end