« DeploymentHandler/VersionStorage/Standard.pm
↑ Summary
DeploymentHandler/HandlesVersionStorage.pm »
| 1 | package DBIx::Class::DeploymentHandler::HandlesDeploy; | ||
| 2 | 19 | $DBIx::Class::DeploymentHandler::HandlesDeploy::VERSION = '0.002233'; | |
| 3 | 19 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | # ABSTRACT: Interface for deploy methods | ||
| 6 | |||
| 7 | 19 | requires 'initialize'; | |
| 8 | |||
| 9 | 19 | requires 'prepare_deploy'; | |
| 10 | 19 | requires 'deploy'; | |
| 11 | |||
| 12 | 19 | requires 'prepare_resultsource_install'; | |
| 13 | 19 | requires 'install_resultsource'; | |
| 14 | |||
| 15 | 19 | requires 'prepare_upgrade'; | |
| 16 | 19 | requires 'upgrade_single_step'; | |
| 17 | |||
| 18 | 19 | requires 'prepare_downgrade'; | |
| 19 | 19 | requires 'downgrade_single_step'; | |
| 20 | |||
| 21 | 19 | requires 'txn_do'; | |
| 22 | |||
| 23 | 19 | 1; | |
| 24 | |||
| 25 | # vim: ts=2 sw=2 expandtab | ||
| 26 | |||
| 27 | __END__ | ||
| 28 | |||
| 29 | =pod | ||
| 30 | |||
| 31 | =head1 NAME | ||
| 32 | |||
| 33 | DBIx::Class::DeploymentHandler::HandlesDeploy - Interface for deploy methods | ||
| 34 | |||
| 35 | =head1 KNOWN IMPLEMENTATIONS | ||
| 36 | |||
| 37 | =over | ||
| 38 | |||
| 39 | =item * | ||
| 40 | |||
| 41 | L<DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator> | ||
| 42 | |||
| 43 | =item * | ||
| 44 | |||
| 45 | L<DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated> | ||
| 46 | |||
| 47 | =back | ||
| 48 | |||
| 49 | =head1 METHODS | ||
| 50 | |||
| 51 | =head2 initialize | ||
| 52 | |||
| 53 | $dh->initialize({ | ||
| 54 | version => 1, | ||
| 55 | storage_type => 'SQLite' | ||
| 56 | }); | ||
| 57 | |||
| 58 | Run scripts before deploying to the database | ||
| 59 | |||
| 60 | =head2 prepare_deploy | ||
| 61 | |||
| 62 | $dh->prepare_deploy | ||
| 63 | |||
| 64 | Generate the needed data files to install the schema to the database. | ||
| 65 | |||
| 66 | =head2 deploy | ||
| 67 | |||
| 68 | $dh->deploy({ version => 1 }) | ||
| 69 | |||
| 70 | Deploy the schema to the database. | ||
| 71 | |||
| 72 | =head2 prepare_resultsource_install | ||
| 73 | |||
| 74 | $dh->prepare_resultsource_install({ | ||
| 75 | result_source => $resultset->result_source, | ||
| 76 | }) | ||
| 77 | |||
| 78 | Takes a L<DBIx::Class::ResultSource> and generates a single migration file to | ||
| 79 | create the resultsource's table. | ||
| 80 | |||
| 81 | =head2 install_resultsource | ||
| 82 | |||
| 83 | $dh->install_resultsource({ | ||
| 84 | result_source => $resultset->result_source, | ||
| 85 | version => 1, | ||
| 86 | }) | ||
| 87 | |||
| 88 | Takes a L<DBIx::Class::ResultSource> and runs a single migration file to | ||
| 89 | deploy the resultsource's table. | ||
| 90 | |||
| 91 | =head2 prepare_upgrade | ||
| 92 | |||
| 93 | $dh->prepare_upgrade({ | ||
| 94 | from_version => 1, | ||
| 95 | to_version => 2, | ||
| 96 | version_set => [1, 2] | ||
| 97 | }); | ||
| 98 | |||
| 99 | Takes two versions and a version set. This basically is supposed to generate | ||
| 100 | the needed C<SQL> to migrate up from the first version to the second version. | ||
| 101 | The version set uniquely identifies the migration. | ||
| 102 | |||
| 103 | =head2 prepare_downgrade | ||
| 104 | |||
| 105 | $dh->prepare_downgrade({ | ||
| 106 | from_version => 2, | ||
| 107 | to_version => 1, | ||
| 108 | version_set => [1, 2] | ||
| 109 | }); | ||
| 110 | |||
| 111 | Takes two versions and a version set. This basically is supposed to generate | ||
| 112 | the needed C<SQL> to migrate down from the first version to the second version. | ||
| 113 | The version set uniquely identifies the migration and should match its | ||
| 114 | respective upgrade version set. | ||
| 115 | |||
| 116 | =head2 upgrade_single_step | ||
| 117 | |||
| 118 | my ($ddl, $sql) = @{ | ||
| 119 | $dh->upgrade_single_step({ version_set => $version_set }) | ||
| 120 | ||[]} | ||
| 121 | |||
| 122 | Call a single upgrade migration. Takes a version set as an argument. | ||
| 123 | Optionally return C<< [ $ddl, $upgrade_sql ] >> where C<$ddl> is the DDL for | ||
| 124 | that version of the schema and C<$upgrade_sql> is the SQL that was run to | ||
| 125 | upgrade the database. | ||
| 126 | |||
| 127 | =head2 downgrade_single_step | ||
| 128 | |||
| 129 | $dh->downgrade_single_step($version_set); | ||
| 130 | |||
| 131 | Call a single downgrade migration. Takes a version set as an argument. | ||
| 132 | Optionally return C<< [ $ddl, $upgrade_sql ] >> where C<$ddl> is the DDL for | ||
| 133 | that version of the schema and C<$upgrade_sql> is the SQL that was run to | ||
| 134 | upgrade the database. | ||
| 135 | |||
| 136 | =head2 txn_do | ||
| 137 | |||
| 138 | $dh->txn_do(sub { ... }) | ||
| 139 | |||
| 140 | Wrap the passed coderef in a transaction (if transactions are enabled.) | ||
| 141 | |||
| 142 | =head1 AUTHOR | ||
| 143 | |||
| 144 | Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> | ||
| 145 | |||
| 146 | =head1 COPYRIGHT AND LICENSE | ||
| 147 | |||
| 148 | This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt. | ||
| 149 | |||
| 150 | This is free software; you can redistribute it and/or modify it under | ||
| 151 | the same terms as the Perl 5 programming language system itself. | ||
| 152 | |||
| 153 | =cut | ||