victorstanciu/dbv

Problems with databases that have foreign keys

Fell opened this issue · 2 comments

Fell commented

When importing a database schema with foreign keys, it can happen that the import fails because it cannot add certain foreign keys.

You can easily fix that by running SET FOREIGN_KEY_CHECKS = 0 before the import, but I'm not sure every user would want this.

So anyways, there should be an option for that at least!

Update
I just found out that mysqldump switches off foreign key checks by default, so I think its okay to do that. But I don't know if this works with other DBMS too.

Hmm, couldn't you add the SET FOREIGN_KEY_CHECKS = 0 statement directly in the revision file?

Fell commented

Of course you could, but I think it would be helpful to have a little checkbox or something like that. Otherwise you should at least make sure that the automatic table export adds the statement if neccessary. (don't know if it does right now)

As soon as I find time, I will try to implement an option for that and submit a pull-request.