Skip to content

Commit

Permalink
Fix condition in migration breaking roll-back
Browse files Browse the repository at this point in the history
  • Loading branch information
fbacall committed Jan 23, 2025
1 parent 9ac198f commit 01fdc49
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion db/migrate/20240718100022_drop_redundant_fk_from_events.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
class DropRedundantFkFromEvents < ActiveRecord::Migration[7.0]
def change
def up
if ActiveRecord::Base.connection.column_exists?(:events, :llm_interaction_id)
remove_reference :events, :llm_interaction, foreign_key: true
end
end

def down
unless ActiveRecord::Base.connection.column_exists?(:events, :llm_interaction_id)
add_reference :events, :llm_interaction, foreign_key: true
end
end
end

0 comments on commit 01fdc49

Please sign in to comment.