| 1 | package DBIx::Class::DeploymentHandler::HandlesVersionStorage; | ||
| 2 | 12 | $DBIx::Class::DeploymentHandler::HandlesVersionStorage::VERSION = '0.002233'; | |
| 3 | 12 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | # ABSTRACT: Interface for version storage methods | ||
| 6 | |||
| 7 | 12 | requires 'add_database_version'; | |
| 8 | 12 | requires 'database_version'; | |
| 9 | 12 | requires 'delete_database_version'; | |
| 10 | 12 | requires 'version_storage_is_installed'; | |
| 11 | |||
| 12 | 12 | 1; | |
| 13 | |||
| 14 | # vim: ts=2 sw=2 expandtab | ||
| 15 | |||
| 16 | __END__ | ||
| 17 | |||
| 18 | =pod | ||
| 19 | |||
| 20 | =head1 NAME | ||
| 21 | |||
| 22 | DBIx::Class::DeploymentHandler::HandlesVersionStorage - Interface for version storage methods | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | Typically VersionStorages will be implemented with a simple | ||
| 27 | DBIx::Class::Result. Take a look at the | ||
| 28 | L<two existing implementations|/KNOWN IMPLEMENTATIONS> for examples of what you | ||
| 29 | might want to do in your own storage. | ||
| 30 | |||
| 31 | =head1 KNOWN IMPLEMENTATIONS | ||
| 32 | |||
| 33 | =over | ||
| 34 | |||
| 35 | =item * | ||
| 36 | |||
| 37 | L<DBIx::Class::DeploymentHandler::VersionStorage::Standard> | ||
| 38 | |||
| 39 | =item * | ||
| 40 | |||
| 41 | L<DBIx::Class::DeploymentHandler::VersionStorage::Deprecated> | ||
| 42 | |||
| 43 | =back | ||
| 44 | |||
| 45 | =head1 METHODS | ||
| 46 | |||
| 47 | =head2 add_database_version | ||
| 48 | |||
| 49 | $dh->add_database_version({ | ||
| 50 | version => '1.02', | ||
| 51 | ddl => $ddl, # can be undef | ||
| 52 | upgrade_sql => $sql, # can be undef | ||
| 53 | }); | ||
| 54 | |||
| 55 | Store a new version into the version storage | ||
| 56 | |||
| 57 | =head2 database_version | ||
| 58 | |||
| 59 | my $db_version = $version_storage->database_version | ||
| 60 | |||
| 61 | Returns the most recently installed version in the database. | ||
| 62 | |||
| 63 | =head2 delete_database_version | ||
| 64 | |||
| 65 | $dh->delete_database_version({ version => '1.02' }) | ||
| 66 | |||
| 67 | Deletes given database version from the version storage | ||
| 68 | |||
| 69 | =head2 version_storage_is_installed | ||
| 70 | |||
| 71 | warn q(I can't version this database!) | ||
| 72 | unless $dh->version_storage_is_installed | ||
| 73 | |||
| 74 | return true if the version storage is installed. | ||
| 75 | |||
| 76 | =head1 AUTHOR | ||
| 77 | |||
| 78 | Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> | ||
| 79 | |||
| 80 | =head1 COPYRIGHT AND LICENSE | ||
| 81 | |||
| 82 | This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt. | ||
| 83 | |||
| 84 | This is free software; you can redistribute it and/or modify it under | ||
| 85 | the same terms as the Perl 5 programming language system itself. | ||
| 86 | |||
| 87 | =cut | ||