add missing newline for no-linenumber-change dzil
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / HandlesDeploy.pm
CommitLineData
7521a845 1package DBIx::Class::DeploymentHandler::HandlesDeploy;
97aa9a74 2
7521a845 3use Moose::Role;
4
9deabd1f 5# ABSTRACT: Interface for deploy methods
6
ff40cb1f 7requires 'initialize';
fc4b7602 8
91557c90 9requires 'prepare_deploy';
10requires 'deploy';
11
c8a2f7bd 12requires 'prepare_resultsource_install';
13requires 'install_resultsource';
91557c90 14
a41a04e5 15requires 'prepare_upgrade';
7d2a6974 16requires 'upgrade_single_step';
91557c90 17
18requires 'prepare_downgrade';
7d2a6974 19requires 'downgrade_single_step';
7521a845 20
1fcd4fe6 21requires 'txn_do';
22
7521a845 231;
24
37c0b85d 25# vim: ts=2 sw=2 expandtab
26
27__END__
28
ff40cb1f 29=method initialize
80ff6f6d 30
ff40cb1f 31 $dh->initialize({
be140a5f 32 version => 1,
33 storage_type => 'SQLite'
34 });
80ff6f6d 35
36Run scripts before deploying to the database
37
91557c90 38=method prepare_deploy
e3776e58 39
91557c90 40 $dh->prepare_deploy
e3776e58 41
42Generate the needed data files to install the schema to the database.
96ef97e5 43
44=method deploy
45
be140a5f 46 $dh->deploy({ version => 1 })
5228a963 47
48Deploy the schema to the database.
96ef97e5 49
50=method prepare_resultsource_install
51
be140a5f 52 $dh->prepare_resultsource_install({
53 result_source => $resultset->result_source,
54 })
96ef97e5 55
37c0b85d 56Takes a L<DBIx::Class::ResultSource> and generates a single migration file to
57create the resultsource's table.
58
96ef97e5 59=method install_resultsource
60
be140a5f 61 $dh->install_resultsource({
62 result_source => $resultset->result_source,
63 version => 1,
64 })
96ef97e5 65
37c0b85d 66Takes a L<DBIx::Class::ResultSource> and runs a single migration file to
67deploy the resultsource's table.
96ef97e5 68
69=method prepare_upgrade
70
be140a5f 71 $dh->prepare_upgrade({
72 from_version => 1,
73 to_version => 2,
74 version_set => [1, 2]
75 });
96ef97e5 76
37c0b85d 77Takes two versions and a version set. This basically is supposed to generate
78the needed C<SQL> to migrate up from the first version to the second version.
79The version set uniquely identifies the migration.
96ef97e5 80
81=method prepare_downgrade
82
be140a5f 83 $dh->prepare_downgrade({
84 from_version => 1,
85 to_version => 2,
86 version_set => [1, 2]
87 });
96ef97e5 88
37c0b85d 89Takes two versions and a version set. This basically is supposed to generate
90the needed C<SQL> to migrate down from the first version to the second version.
734ace8a 91The version set uniquely identifies the migration and should match its
37c0b85d 92respective upgrade version set.
93
96ef97e5 94=method upgrade_single_step
95
be140a5f 96 my ($ddl, $sql) = @{
97 $dh->upgrade_single_step({ version_set => $version_set })
98 ||[]}
5228a963 99
37c0b85d 100Call a single upgrade migration. Takes a version set as an argument.
101Optionally return C<< [ $ddl, $upgrade_sql ] >> where C<$ddl> is the DDL for
102that version of the schema and C<$upgrade_sql> is the SQL that was run to
103upgrade the database.
96ef97e5 104
105=method downgrade_single_step
106
5228a963 107 $dh->downgrade_single_step($version_set);
108
37c0b85d 109Call a single downgrade migration. Takes a version set as an argument.
110Optionally return C<< [ $ddl, $upgrade_sql ] >> where C<$ddl> is the DDL for
111that version of the schema and C<$upgrade_sql> is the SQL that was run to
112upgrade the database.
96ef97e5 113
1fcd4fe6 114=method txn_do
115
116 $dh->txn_do(sub { ... })
117
118Wrap the passed coderef in a transaction (if transactions are enabled.)
119
ed1721b9 120=head1 KNOWN IMPLEMENTATIONS
121
122=over
123
124=item *
125
126L<DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator>
127
128=item *
129
130L<DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated>
131
132=back
133