From: Peter Rabbitson Date: Sun, 12 Oct 2008 21:26:54 +0000 (+0000) Subject: TODOify the 'upgrade twice within a second' problem in Schema::Versioned X-Git-Tag: v0.08240~323 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e9fbbbf4d6666d62fe782d24f7540d24e191c0e3;p=dbsrgits%2FDBIx-Class.git TODOify the 'upgrade twice within a second' problem in Schema::Versioned --- diff --git a/t/94versioning.t b/t/94versioning.t index 1160935..92e465c 100644 --- a/t/94versioning.t +++ b/t/94versioning.t @@ -19,7 +19,7 @@ BEGIN { eval "use DBD::mysql; use SQL::Translator 0.09;"; plan $@ ? ( skip_all => 'needs DBD::mysql and SQL::Translator 0.09 for testing' ) - : ( tests => 23 ); + : ( tests => 22 ); } my $version_table_name = 'dbix_class_schema_versions'; @@ -66,6 +66,9 @@ my $schema_upgrade = DBICVersion::Schema->connect($dsn, $user, $pass, { ignore_v { my $w; local $SIG{__WARN__} = sub { $w = shift }; + + sleep 1; # remove this when TODO below is completed + $schema_upgrade->upgrade(); like ($w, qr/Attempting upgrade\.$/, 'Warn before upgrade'); } @@ -143,7 +146,10 @@ my $schema_upgrade = DBICVersion::Schema->connect($dsn, $user, $pass, { ignore_v } # attempt a deploy/upgrade cycle within one second -{ +TODO: { + + local $TODO = 'To fix this properly the table must be extended with an autoinc column, mst will not accept anything less'; + eval { $schema_orig->storage->dbh->do('drop table ' . $version_table_name) }; eval { $schema_orig->storage->dbh->do('drop table ' . $old_table_name) }; eval { $schema_orig->storage->dbh->do('drop table TestVersion') }; @@ -158,13 +164,11 @@ my $schema_upgrade = DBICVersion::Schema->connect($dsn, $user, $pass, { ignore_v $schema_orig->deploy; } - my $w; - local $SIG{__WARN__} = sub { $w = shift }; + local $SIG{__WARN__} = sub { warn if $_[0] !~ /Attempting upgrade\.$/ }; $schema_upgrade->upgrade(); - like ($w, qr/Attempting upgrade\.$/, 'Warn before upgrade'); is($schema_upgrade->get_db_version(), '2.0', 'Fast deploy/upgrade'); -} +}; unless ($ENV{DBICTEST_KEEP_VERSIONING_DDL}) { unlink $_ for (values %$fn);