avram icon indicating copy to clipboard operation
avram copied to clipboard

remove_belongs_to throws error about fk constraint

Open jwoertink opened this issue 4 years ago • 0 comments

When you want to remove a belongs_to, postgres will throw an error like:

cannot drop column whatever because other objects depend on it

This is due to the foreign constraint keys. I think when we add remove_belongs_to, we need to also run something like:

execute <<-SQL
    ALTER TABLE things
    DROP CONSTRAINT things_whatever_id_fkey
SQL

jwoertink avatar Jul 26 '21 17:07 jwoertink