Files
fizzy/db/migrate/20240916193936_add_project_to_bubbles.rb
T
Kevin McConnell 13f5952336 Fix migrations that can no longer be applied
The migrations could no longer be applied on an empty database, mainly
because they referred to models that no longer existed. Replaced the
model references with direct table access that will always be correct at
the time the migration is applied.

Also removed conflicting indexes in table renames.
2024-10-02 13:50:46 +01:00

12 lines
295 B
Ruby

class AddProjectToBubbles < ActiveRecord::Migration[8.0]
def change
change_table :bubbles do |t|
t.references :project, null: true
end
execute "update bubbles set project_id = (select id from projects limit 1)"
change_column_null :bubbles, :project_id, false
end
end