Add some basic doc and a little cleanup
[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 =method prepare_install
20
21  (should this be renamed prepare_deploy?)
22
23  $dh->prepare_install
24
25 Generate the needed data files to install the schema to the database.
26
27 =method deploy
28
29  $dh->deploy
30
31 Deploy the schema to the database.
32
33 =method prepare_resultsource_install
34
35  $dh->prepare_resultsource_install($resultset->result_source)
36
37 Takes a L<DBIx::Class::ResultSource> and generates a single migration file to
38 create the resultsource's table.
39
40 =method install_resultsource
41
42  $dh->prepare_resultsource_install($resultset->result_source);
43
44 Takes a L<DBIx::Class::ResultSource> and runs a single migration file to
45 deploy the resultsource's table.
46
47 =method prepare_upgrade
48
49  $dh->prepare_upgrade(1, 2, [1, 2]);
50
51 Takes two versions and a version set.  This basically is supposed to generate
52 the needed C<SQL> to migrate up from the first version to the second version.
53 The version set uniquely identifies the migration.
54
55 =method prepare_downgrade
56
57  $dh->prepare_downgrade(2, 1, [1, 2]);
58
59 Takes two versions and a version set.  This basically is supposed to generate
60 the needed C<SQL> to migrate down from the first version to the second version.
61 The version set uniquely identifies the migration and should match it's
62 respective upgrade version set.
63
64 =method upgrade_single_step
65
66  my ($ddl, $sql) = @{$dh->upgrade_single_step($version_set)||[]}
67
68 Call a single upgrade migration.  Takes a version set as an argument.
69 Optionally return C<< [ $ddl, $upgrade_sql ] >> where C<$ddl> is the DDL for
70 that version of the schema and C<$upgrade_sql> is the SQL that was run to
71 upgrade the database.
72
73 =method downgrade_single_step
74
75  $dh->downgrade_single_step($version_set);
76
77 Call a single downgrade migration.  Takes a version set as an argument.
78 Optionally return C<< [ $ddl, $upgrade_sql ] >> where C<$ddl> is the DDL for
79 that version of the schema and C<$upgrade_sql> is the SQL that was run to
80 upgrade the database.
81
82 =head1 KNOWN IMPLEMENTATIONS
83
84 =over
85
86 =item *
87
88 L<DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator>
89
90 =item *
91
92 L<DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated>
93
94 =back
95