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
# 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) = @_;
$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');
sub run_upgrade
{
my ($self, $stm) = @_;
+ $stm ||= qr//;
# print "Reg: $stm\n";
my @statements = grep { $_ =~ $stm } @{$self->_filedata};
# print "Statements: ", join("\n", @statements), "\n";
# 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<DBIx::Class::Schema>
C<upgrade> method, running whichever commands you specify via the
regex in the parameter.
+B<NOTE:> 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.
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 );
}