polish THIS SUCKS in main pod
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / VersionStorage / Standard.pm
index 0d9cd88..3da6506 100644 (file)
@@ -1,5 +1,8 @@
 package DBIx::Class::DeploymentHandler::VersionStorage::Standard;
 use Moose;
+
+# ABSTRACT: Version storage that does the normal stuff
+
 use Method::Signatures::Simple;
 
 has schema => (
@@ -11,24 +14,31 @@ has schema => (
 has version_rs => (
   isa        => 'DBIx::Class::ResultSet',
   is         => 'ro',
-  lazy_build => 1, # builder comes from another role...
-                   # which is... probably not how we want it
+  lazy_build => 1,
   handles    => [qw( database_version version_storage_is_installed )],
 );
 
 with 'DBIx::Class::DeploymentHandler::HandlesVersionStorage';
 
 sub _build_version_rs {
-   $_[0]->schema->set_us_up_the_bomb;
-   $_[0]->schema->resultset('__VERSION')
+  $_[0]->schema->register_class(
+    __VERSION =>
+      'DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult'
+  );
+  $_[0]->schema->resultset('__VERSION')
 }
 
 sub add_database_version { $_[0]->version_rs->create($_[1]) }
 
-sub install_version_storage { die }
+sub delete_database_version {
+  $_[0]->version_rs->search({ version => $_[1]->{version}})->delete
+}
+
+__PACKAGE__->meta->make_immutable;
 
 1;
 
+# vim: ts=2 sw=2 expandtab
+
 __END__
 
-vim: ts=2 sw=2 expandtab