X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FVersioned.pm;h=0e83dc6ca9e76aa28c51710f073c2c6987ca25c6;hb=fb13a49f;hp=4e7b944de29ded6ef694eb85633d580dc4b19622;hpb=4c633384a2afd15b77f6c5d46b9c7831feaa1272;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Schema/Versioned.pm b/lib/DBIx/Class/Schema/Versioned.pm index 4e7b944..0e83dc6 100644 --- a/lib/DBIx/Class/Schema/Versioned.pm +++ b/lib/DBIx/Class/Schema/Versioned.pm @@ -96,6 +96,32 @@ this will attempt to upgrade the database from its current version to the curren schema version using a diff from your I. If a suitable diff is not found then no upgrade is possible. +=head1 SEE ALSO + +L is a much more powerful alternative to this +module. Examples of things it can do that this module cannot do include + +=over + +=item * + +Downgrades in addition to upgrades + +=item * + +Multiple sql files files per upgrade/downgrade/install + +=item * + +Perl scripts allowed for upgrade/downgrade/install + +=item * + +Just one set of files needed for upgrade, unlike this module where one might +need to generate C + +=back + =head1 GETTING STARTED Firstly you need to setup your schema class as per the L, make sure @@ -175,7 +201,7 @@ use strict; use warnings; use base 'DBIx::Class::Schema'; -use Carp::Clan qw/^DBIx::Class/; +use DBIx::Class::Carp; use Time::HiRes qw/gettimeofday/; use Try::Tiny; use namespace::clean; @@ -272,7 +298,7 @@ sub create_upgrade_path { =over 4 -=item Returns: a list of version numbers, ordered from lowest to highest +=item Return Value: a list of version numbers, ordered from lowest to highest =back @@ -320,7 +346,7 @@ sub upgrade { # db and schema at same version. do nothing if ( $db_version eq $self->schema_version ) { - carp "Upgrade not necessary\n"; + carp 'Upgrade not necessary'; return; } @@ -391,7 +417,7 @@ sub upgrade_single_step # db and schema at same version. do nothing if ($db_version eq $target_version) { - carp "Upgrade not necessary\n"; + carp 'Upgrade not necessary'; return; } @@ -411,7 +437,7 @@ sub upgrade_single_step $self->create_upgrade_path({ upgrade_file => $upgrade_file }); unless (-f $upgrade_file) { - carp "Upgrade not possible, no upgrade file found ($upgrade_file), please create one\n"; + carp "Upgrade not possible, no upgrade file found ($upgrade_file), please create one"; return; } @@ -586,18 +612,18 @@ sub _on_connect if($pversion eq $self->schema_version) { -# carp "This version is already installed\n"; + #carp "This version is already installed"; return 1; } if(!$pversion) { - carp "Your DB is currently unversioned. Please call upgrade on your schema to sync the DB.\n"; + carp "Your DB is currently unversioned. Please call upgrade on your schema to sync the DB."; return 1; } carp "Versions out of sync. This is " . $self->schema_version . - ", your database contains version $pversion, please call upgrade on your Schema.\n"; + ", your database contains version $pversion, please call upgrade on your Schema."; } # is this just a waste of time? if not then merge with DBI.pm @@ -658,7 +684,7 @@ sub _create_db_to_schema_diff { print $file $diff; close($file); - carp "WARNING: There may be differences between your DB and your DBIC schema. Please review and if necessary run the SQL in $filename to sync your DB.\n"; + carp "WARNING: There may be differences between your DB and your DBIC schema. Please review and if necessary run the SQL in $filename to sync your DB."; } @@ -693,7 +719,7 @@ sub _set_db_version { $dt[2], $dt[1], $dt[0], - $tm[1] / 1000, # convert to millisecs, format as up/down rounded int above + int($tm[1] / 1000), # convert to millisecs ), }); } @@ -731,10 +757,9 @@ sub _source_exists 1; -=head1 AUTHORS +=head1 AUTHOR AND CONTRIBUTORS -Jess Robinson -Luke Saunders +See L and L in DBIx::Class =head1 LICENSE