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