From: Peter Rabbitson Date: Sun, 9 Nov 2008 20:19:39 +0000 (+0000) Subject: Switch schema management version calls from VERSION() to schema_version() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b1f9d92eb466f2624ecd5dc65f8c75eb726b49d6;p=dbsrgits%2FDBIx-Class-Historic.git Switch schema management version calls from VERSION() to schema_version() --- diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 2a1c883..a65c0a9 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -1054,7 +1054,7 @@ If no arguments are passed, then the following default values are used: =item databases - ['MySQL', 'SQLite', 'PostgreSQL'] -=item version - $schema->VERSION +=item version - $schema->schema_version =item directory - './' diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 9cb918f..ea81980 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1579,7 +1579,10 @@ sub create_ddl_dir { } $databases ||= ['MySQL', 'SQLite', 'PostgreSQL']; $databases = [ $databases ] if(ref($databases) ne 'ARRAY'); - $version ||= $schema->VERSION || '1.x'; + + my $schema_version = $schema->schema_version || '1.x'; + $version ||= $schema_version; + $sqltargs = { add_drop_table => 1, ignore_constraint_names => 1, @@ -1604,7 +1607,7 @@ sub create_ddl_dir { my $file; my $filename = $schema->ddl_filename($db, $version, $dir); - if (-e $filename && (!$version || ($version == $schema->schema_version()))) { + if (-e $filename && ($version eq $schema_version )) { # if we are dumping the current version, overwrite the DDL warn "Overwriting existing DDL file - $filename"; unlink($filename); @@ -1721,7 +1724,7 @@ sub deployment_statements { # Need to be connected to get the correct sqlt_type $self->ensure_connected() unless $type; $type ||= $self->sqlt_type; - $version ||= $schema->VERSION || '1.x'; + $version ||= $schema->schema_version || '1.x'; $dir ||= './'; my $filename = $schema->ddl_filename($type, $dir, $version); if(-f $filename) diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index 09291bb..4a2af21 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -44,7 +44,7 @@ sub parse { my $schema = $tr->schema; my $table_no = 0; - $schema->name( ref($dbicschema) . " v" . ($dbicschema->VERSION || '1.x')) + $schema->name( ref($dbicschema) . " v" . ($dbicschema->schema_version || '1.x')) unless ($schema->name); my %seen_tables;