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