You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If table_a has table_b_id column, and the foreign key constraint exists, seed_fu tries to insert initial table_a data and fails because of the constraint.
As far as I know, seed_fu reads files in alphabetical order of filenames.
So I can change the filenames into db/fixtures/01_table_b.rb and db/fixtures/02_table_a.rb to fix it, but I think it's better if we need not do it.
Is there any solution? Thanks.
The text was updated successfully, but these errors were encountered:
takegue
added a commit
to takegue/group-manager
that referenced
this issue
Jul 7, 2016
Disabling referential integrity during seeding is a workaround for some situations, but note postgresql (and I'm assuming other dbs) will not validate the constraints afterward, so you can end up with orphaned foreign keys:
If
table_a
hastable_b_id
column, and the foreign key constraint exists,seed_fu
tries to insert initialtable_a
data and fails because of the constraint.As far as I know, seed_fu reads files in alphabetical order of filenames.
So I can change the filenames into
db/fixtures/01_table_b.rb
anddb/fixtures/02_table_a.rb
to fix it, but I think it's better if we need not do it.Is there any solution? Thanks.
The text was updated successfully, but these errors were encountered: