initial VersionStorage commit
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler.pm
index 8dbc97f..6de3e7d 100644 (file)
@@ -24,7 +24,6 @@ has schema => (
   isa      => 'DBIx::Class::Schema',
   is       => 'ro',
   required => 1,
-  handles => [qw( ddl_filename schema_version )],
 );
 
 has upgrade_directory => ( # configuration
@@ -40,22 +39,18 @@ has backup_directory => ( # configuration
   predicate  => 'has_backup_directory',
 );
 
-has do_backup => ( # configuration
-  isa     => 'Bool',
-  is      => 'ro',
-  default => undef,
-);
-
 has version_rs => (
   isa        => 'DBIx::Class::ResultSet',
   is         => 'ro',
-  lazy_build => 1,
-  handles    => [qw( is_installed db_version )],
+  lazy_build => 1, # builder comes from another role...
+                   # which is... probably not how we want it
+  handles    => [qw( is_installed )],
 );
 
-has to_version => (
+has to_version => ( # configuration
   is         => 'ro',
-  lazy_build => 1,
+  lazy_build => 1, # builder comes from another role...
+                   # which is... probably not how we want it
 );
 
 has databases => ( # configuration
@@ -88,12 +83,21 @@ method install {
   }
 }
 
-method upgrade {
+sub upgrade {
+  my $self = shift;
   while ( my $version_list = $self->next_version_set ) {
     $self->_upgrade_single_step($version_list);
+
+    $self->version_rs->create({
+      version     => $version_list->[-1],
+      # ddl         => $ddl,
+      # upgrade_sql => $upgrade_sql,
+    });
   }
 }
 
+method backup { $self->storage->backup($self->backup_directory) }
+
 __PACKAGE__->meta->make_immutable;
 
 1;