From: Ash Berlin Date: Sat, 1 Mar 2008 12:17:54 +0000 (+0000) Subject: Fix versioning test so it works with SQLT 0.09. X-Git-Tag: v0.08010^0 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=commitdiff_plain;h=dd018f09328dbfb2c28a199bbb271d8323cb9a77 Fix versioning test so it works with SQLT 0.09. --- diff --git a/Changes b/Changes index 624473b..d75bf9b 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for DBIx::Class +0.08010 2008-03-01 10:30 + - Fix t/94versioning.t so it passes with latest SQL::Translator + 0.08009 2008-01-20 13:30 - Made search_rs smarter about when to preserve the cache to fix mm prefetch usage diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index 61b7d07..1e9a7bd 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -24,7 +24,7 @@ sub component_base_class { 'DBIx::Class' } # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports # brain damage and presumably various other packaging systems too -$VERSION = '0.08009'; +$VERSION = '0.08010'; sub MODIFY_CODE_ATTRIBUTES { my ($class,$code,@attrs) = @_; diff --git a/lib/DBIx/Class/Schema/Versioned.pm b/lib/DBIx/Class/Schema/Versioned.pm index f5ea037..ebfe9ac 100644 --- a/lib/DBIx/Class/Schema/Versioned.pm +++ b/lib/DBIx/Class/Schema/Versioned.pm @@ -180,12 +180,7 @@ sub upgrade $self->backup(); - $self->run_upgrade(qr/create/i); - $self->run_upgrade(qr/alter table .*? add/i); - $self->run_upgrade(qr/alter table .*? (?!drop)/i); - $self->run_upgrade(qr/alter table .*? drop/i); - $self->run_upgrade(qr/drop/i); -# $self->run_upgrade(qr//i); + $self->run_upgrade(); my $vschema = DBIx::Class::Version->connect(@{$self->storage->connect_info()}); my $vtable = $vschema->resultset('Table'); @@ -198,6 +193,7 @@ sub upgrade sub run_upgrade { my ($self, $stm) = @_; + $stm ||= qr//; # print "Reg: $stm\n"; my @statements = grep { $_ =~ $stm } @{$self->_filedata}; # print "Statements: ", join("\n", @statements), "\n"; @@ -236,20 +232,6 @@ DBIx::Class::Schema::Versioned - DBIx::Class::Schema plugin for Schema upgrades # my special backup process } - sub upgrade - { - my ($self) = @_; - - ## overridable sub, per default just runs all the commands. - - $self->run_upgrade(qr/create/i); - $self->run_upgrade(qr/alter table .*? add/i); - $self->run_upgrade(qr/alter table .*? (?!drop)/i); - $self->run_upgrade(qr/alter table .*? drop/i); - $self->run_upgrade(qr/drop/i); - $self->run_upgrade(qr//i); - } - =head1 DESCRIPTION This module is a component designed to extend L @@ -308,6 +290,9 @@ idea is that this method can be called any number of times from your C method, running whichever commands you specify via the regex in the parameter. +B Since SQL::Translator 0.09000 it is better to just run all statmets +in the order given, since the SQL produced is of better quality. + =head2 upgrade_directory Use this to set the directory your upgrade files are stored in. diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index 9cc3bbf..91fe228 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -262,7 +262,7 @@ which allows the rollback to propagate to the outermost transaction. sub txn_rollback { die "Virtual method!" } -=for +=for comment =head2 txn_scope_guard diff --git a/lib/DBIx/Class/Storage/TxnScopeGuard.pm b/lib/DBIx/Class/Storage/TxnScopeGuard.pm index 06c510c..d699138 100644 --- a/lib/DBIx/Class/Storage/TxnScopeGuard.pm +++ b/lib/DBIx/Class/Storage/TxnScopeGuard.pm @@ -1,4 +1,5 @@ -package DBIx::Class::Storage::TxnScopeGuard; +package # Hide from pause for now - till we get it working + DBIx::Class::Storage::TxnScopeGuard; use strict; use warnings; diff --git a/t/94versioning.t b/t/94versioning.t index 7de9edd..f985eee 100644 --- a/t/94versioning.t +++ b/t/94versioning.t @@ -5,9 +5,9 @@ use Test::More; use File::Spec; BEGIN { - eval "use DBD::SQLite; use SQL::Translator 0.08;"; + eval "use DBD::SQLite; use SQL::Translator 0.09;"; plan $@ - ? ( skip_all => 'needs DBD::SQLite and SQL::Translator 0.08 for testing' ) + ? ( skip_all => 'needs DBD::SQLite and SQL::Translator 0.09 for testing' ) : ( tests => 6 ); }