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