1 package DBIx::Class::DeploymentHandler;
5 extends 'DBIx::Class::DeploymentHandler::Dad';
6 # a single with would be better, but we can't do that
7 # see: http://rt.cpan.org/Public/Bug/Display.html?id=46347
8 with 'DBIx::Class::DeploymentHandler::WithSqltDeployMethod',
9 'DBIx::Class::DeploymentHandler::WithMonotonicVersions',
10 'DBIx::Class::DeploymentHandler::WithStandardVersionStorage';
11 with 'DBIx::Class::DeploymentHandler::WithReasonableDefaults';
13 sub prepare_version_storage_install {
16 $self->prepare_resultsource_install(
17 $self->version_storage->version_rs->result_source
21 sub install_version_storage {
24 $self->install_resultsource(
25 $self->version_storage->version_rs->result_source
29 __PACKAGE__->meta->make_immutable;
37 use aliased 'DBIx::Class::DeploymentHandler' => 'DH';
38 my $s = My::Schema->connect(...);
42 databases => 'SQLite',
43 sqltargs => { add_drop_table => 0 },
52 use aliased 'DBIx::Class::DeploymentHandler' => 'DH';
53 my $s = My::Schema->connect(...);
57 databases => 'SQLite',
58 sqltargs => { add_drop_table => 0 },
61 $dh->prepare_upgrade(1, 2);
67 C<DBIx::Class::DeploymentHandler> is, as it's name suggests, a tool for
68 deploying and upgrading databases with L<DBIx::Class>. It is designed to be
69 much more flexible than L<DBIx::Class::Schema::Versioned>, hence the use of
70 L<Moose> and lots of roles.
72 C<DBIx::Class::DeploymentHandler> itself is just a recommended set of roles
73 that we think will not only work well for everyone, but will also yeild the
74 best overall mileage. Each role it uses has it's own nuances and
75 documentation, so I won't describe all of them here, but here are a few of the
76 major benefits over how L<DBIx::Class::Schema::Versioned> worked (and
77 L<DBIx::Class::DeploymentHandler::Deprecated> tries to maintain compatibility
86 Downgrades in addition to upgrades.
90 Multiple sql files files per upgrade/downgrade/install.
94 Perl scripts allowed for upgrade/downgrade/install.
98 Just one set of files needed for upgrade, unlike before where one might need
99 to generate C<factorial(scalar @versions)>, which is just silly.
107 That's really just a taste of some of the differences. Check out each role for
110 =head1 WHERE IS ALL THE DOC?!
112 C<DBIx::Class::DeploymentHandler> extends
113 L<DBIx::Class::DeploymentHandler::Dad>, so that's probably the first place to
114 look when you are trying to figure out how everything works.
116 Next would be to look at all the roles that fill in the blanks that
117 L<DBIx::Class::DeploymentHandler::Dad> expects to be filled. They would be
118 L<DBIx::Class::DeploymentHandler::WithSqltDeployMethod>,
119 L<DBIx::Class::DeploymentHandler::WithMonotonicVersions>,
120 L<DBIx::Class::DeploymentHandler::WithStandardVersionStorage>, and
121 L<DBIx::Class::DeploymentHandler::WithReasonableDefaults>.
123 =method prepare_version_storage_install
125 $dh->prepare_version_storage_install
127 Creates the needed C<.sql> file to install the version storage and not the rest
130 =method install_version_storage
132 $dh->install_version_storage
134 Install the version storage and not the rest of the tables
138 vim: ts=2 sw=2 expandtab