9f8cfac4f1e12e81a3679257c1b058e874733348
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / HandlesVersionStorage.pm
1 package DBIx::Class::DeploymentHandler::HandlesVersionStorage;
2 use Moose::Role;
3
4 # ABSTRACT: Interface for version storage methods
5
6 requires 'add_database_version';
7 requires 'database_version';
8 requires 'delete_database_version';
9 requires 'version_storage_is_installed';
10
11 1;
12
13 # vim: ts=2 sw=2 expandtab
14
15 __END__
16
17 =head1 DESCRIPTION
18
19 Typically VersionStorages will be implemented with a simple
20 DBIx::Class::Result.  Take a look at the
21 L<two existing implementations|/KNOWN IMPLEMENTATIONS> for examples of what you
22 might want to do in your own storage.
23
24 =method add_database_version
25
26  $dh->add_database_version({
27    version     => '1.02',
28    ddl         => $ddl, # can be undef
29    upgrade_sql => $sql, # can be undef
30  });
31
32 Store a new version into the version storage
33
34 =method database_version
35
36  my $db_version = $version_storage->database_version
37
38 Returns the most recently installed version in the database.
39
40 =method delete_database_version
41
42  $dh->delete_database_version({ version => '1.02' })
43
44 Deletes given database version from the version storage
45
46 =method version_storage_is_installed
47
48  warn q(I can't version this database!)
49    unless $dh->version_storage_is_installed
50
51 return true iff the version storage is installed.
52
53 =head1 KNOWN IMPLEMENTATIONS
54
55 =over
56
57 =item *
58
59 L<DBIx::Class::DeploymentHandler::VersionStorage::Standard>
60
61 =item *
62
63 L<DBIx::Class::DeploymentHandler::VersionStorage::Deprecated>
64
65 =back
66