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