From: Luke Saunders Date: Wed, 4 Feb 2009 11:43:10 +0000 (+0000) Subject: use deferred fk checks also for dropping tables X-Git-Tag: v1.001002~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9586eb0c7165ded57656b46696ac345855c329ab;p=dbsrgits%2FDBIx-Class-Fixtures.git use deferred fk checks also for dropping tables --- diff --git a/MANIFEST b/MANIFEST index e9c3f7d..d457e4b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -15,8 +15,6 @@ lib/DBIx/Class/Fixtures/DBI.pm lib/DBIx/Class/Fixtures/DBI/mysql.pm lib/DBIx/Class/Fixtures/DBI/Pg.pm lib/DBIx/Class/Fixtures/Schema.pm -lib/DBIx/Class/Fixtures/SchemaVersioned.pm -lib/DBIx/Class/Fixtures/Versioned.pm Makefile.PL MANIFEST This list of files META.yml diff --git a/lib/DBIx/Class/Fixtures.pm b/lib/DBIx/Class/Fixtures.pm index 7e7e05e..f4434a1 100644 --- a/lib/DBIx/Class/Fixtures.pm +++ b/lib/DBIx/Class/Fixtures.pm @@ -713,10 +713,11 @@ sub _generate_schema { # clear existing db $self->msg("- clearing DB of existing tables"); - eval { $dbh->do('SET foreign_key_checks=0') }; - foreach my $table (@tables) { - eval { $dbh->do('drop table ' . $table . ($params->{cascade} ? ' cascade' : '') ) }; - } + $pre_schema->storage->with_deferred_fk_checks(sub { + foreach my $table (@tables) { + eval { $dbh->do('drop table ' . $table . ($params->{cascade} ? ' cascade' : '') ) }; + } + }); # import new ddl file to db my $ddl_file = $params->{ddl};