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