From: Rafael Kitover Date: Sat, 31 Oct 2009 20:04:39 +0000 (+0000) Subject: pass sqlite_version to SQLT X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2361982d10699851d845aab7c4a73dde563f23ad;p=dbsrgits%2FDBIx-Class-Historic.git pass sqlite_version to SQLT --- diff --git a/lib/DBIx/Class/Storage/DBI/SQLite.pm b/lib/DBIx/Class/Storage/DBI/SQLite.pm index 1e5f298..48d55fe 100644 --- a/lib/DBIx/Class/Storage/DBI/SQLite.pm +++ b/lib/DBIx/Class/Storage/DBI/SQLite.pm @@ -47,6 +47,22 @@ sub backup return $backupfile; } +sub deployment_statements { + my $self = shift;; + my ($schema, $type, $version, $dir, $sqltargs, @rest) = @_; + + $sqltargs ||= {}; + + my $sqlite_version = $self->_get_dbh->{sqlite_version}; + + # numify, SQLT does a numeric comparison + $sqlite_version =~ s/^(\d+) \. (\d+) (?: \. (\d+)) .*/${1}.${2}/x; + + $sqltargs->{producer_args}{sqlite_version} = $sqlite_version; + + $self->next::method($schema, $type, $version, $dir, $sqltargs, @rest); +} + sub datetime_parser_type { return "DateTime::Format::SQLite"; } 1; diff --git a/t/storage/replication.t b/t/storage/replication.t index 1cd2d90..c7485b4 100644 --- a/t/storage/replication.t +++ b/t/storage/replication.t @@ -66,7 +66,7 @@ TESTSCHEMACLASSES: { sub init_schema { # current SQLT SQLite producer does not handle DROP TABLE IF EXISTS, trap warnings here - local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /no such table.+DROP TABLE/ }; + local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /no such table.+DROP TABLE/s }; my ($class, $schema_method) = @_;