Remove relationships where source == target prior to adding relationship type

This commit is contained in:
Karina Kwiatek 2022-01-15 12:38:10 +01:00 committed by Karina Kwiatek
parent 5c9659ccf5
commit 4a1ed5394a
1 changed files with 2 additions and 0 deletions

View File

@ -2,6 +2,8 @@ class AddTypeToRelationships < ActiveRecord::Migration[5.2]
def up
add_column :relationships, :type, :string
execute %(delete from relationships where source_id = target_id)
execute %(update relationships set type = 'Relationships::Follow')
change_column_null :relationships, :type, false