On Fri Nov 18 23:42:37 2011, Christian Grobmeier wrote:
Hi all,

sometimes my Modelere throws an error when I alter my database,
because of foreign key restrictions.

To avoid this, one must do this:
SET foreign_key_checks =0;

and afterwards this:
SET foreign_key_checks =1;

(on a mysql) to make the migration a success.

I wonder if there are sometimes problems with other databases too and
if there is a chance to disable these checks before making the
moderler migrating the alter scripts.

Cheers
Christian


This can sometimes happen because mysql performs constraint checks on a row by row basis. So you might have 3 commands inside a transaction which all together result in valid data. However the first row touched by the first command will cause the innodb engine to validate the row.

Oracle and MS-SQL do not suffer from this limitation, but I've done no testing to verify this. You need to be careful, because "SET foreign_key_checks =1" does not cause the data to the validated. You could end up with invalid rows of data.

--
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Reply via email to