# ---------------------------------------------------------------------------
-package DBIx::Class::Versioning;
+package DBIx::Class::Schema::Versioned;
use strict;
use warnings;
$self->_filedata(\@data);
$self->backup();
- $self->upgrade();
-
-# X Create version table if not exists?
-# Make backup
-# Run create statements
-# Run post-create callback
-# Run alter/drop statement
-# Run post-alter callback
+ $self->upgrade($pversion, $self->VERSION);
+
}
sub exists
eval {
$rs->search({ 1, 0 })->count;
};
-
return 0 if $@;
return 1;
{
my ($self) = @_;
## Make each ::DBI::Foo do this
-# $self->storage->backup();
+ $self->storage->backup();
}
sub upgrade
# load Library::Schema::CD, Library::Schema::Book, Library::Schema::DVD
__PACKAGE__->load_classes(qw/CD Book DVD/);
- __PACKAGE__->load_components(qw/Versioning/);
+ __PACKAGE__->load_components(qw/+DBIx::Class::Schema::Versioned/);
__PACKAGE__->upgrade_directory('/path/to/upgrades/');
sub backup
path between the two versions supplied. By default, every change in
your VERSION is regarded as needing an upgrade.
+NB: At the moment, SQLite upgrading is rather spotty, as SQL::Translator::Diff
+returns SQL statements that SQLite does not support.
+
=head1 METHODS
to call C<< $self->storage->backup >>, to run the standard backup on each
database type.
+This method should return the name of the backup file, if appropriate.
+
=head2 upgrade
This is an overwritable method used to run your upgrade. The freeform method