Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

more doc tweaks

  • Loading branch information...
commit c9c94b39c16fcc9ef019280c90362d132381b99a 1 parent 384c5ce
@jjn1056 authored
View
46 lib/DBIx/Class/Migration/Features.pod
@@ -22,18 +22,28 @@ Given an application where its database has evolved over many versions, you
can install a database to any version in the history, as well as install
development and fixture data for that version.
+ dbic-migration install
+ dbic-migration install --to_version 5
+ dbic-migration populate --fixture_set testing_data
+
=head1 Upgrade / Downgrade Management
Offers a system to move a database from any one version to any other version.
Additionally lets you migrate data between versions and even offers the possibility
to migrate between different types of databases
+ dbic-migration prepare
+ dbic-migration upgrade
+ dbic-migration downgrade
+
=head1 Seed, Developer and Test Data
Create and manage data in your database. Create sets for testing, development
and to manage system or 'seed' data (data that a database needs to properly
function, such as a Country list).
+ dbic-migration dump_named_sets -fixture_set countries
+
Data can be properly converted between database versions
=head1 Testing
@@ -41,6 +51,21 @@ Data can be properly converted between database versions
Integrates with testing tools like L<Test::DBIx::Class> to make testing your
database logic simple.
+ #!/usr/bin/env perl
+
+ use Test::Most;
+ use Test::DBIx::Class
+ -schema_class=>'MyApp::Schema',
+ -fixture_class => '::Population',
+ qw(Artist Country);
+
+ fixtures_ok ['all_tables'];
+
+ is Country->count, 3, 'Correct Number of Countries';
+ ok Artist->first->has_country, 'Artist has a country';
+
+ done_testing;
+
=head1 Easy Creation of Developer level Database sandboxes
Automatically create a developer controlled, local database for rapid prototyping
@@ -48,7 +73,24 @@ and easy administration. Supports Sqlite, MySQL and Postgresql sandboxes.
=head1 Framework Integration
-Plays nice with popular web application development frameworks like L<Catalyst>
+Plays nice with popular web application development frameworks like L<Catalyst>.
+
+ package MyApp::Web::Model::Schema;
+
+ use Moose;
+ extends 'Catalyst::Model::DBIC::Schema';
+
+ __PACKAGE__->meta->make_immutable;
+ __PACKAGE__->config(
+ traits => ['FromMigration'],
+ schema_class => 'MyApp::Schema',
+ extra_migration_args => {
+ db_sandbox_class => 'DBIx::Class::Migration::MySQLSandbox'},
+ install_if_needed => {
+ on_install => sub {
+ my ($schema, $migration) = @_;
+ $migration->populate('all_tables')}},
+ );
=head1 Straightforward subclassing
@@ -61,6 +103,8 @@ to control and configure many aspects of the code using init arguments.
Extensively documented and ships with an end to end tutorial that covers everything
from creating your first migration, through testing and integration with L<Catalyst>
+L<DBIx::Class::Migration::Tutorial>
+
=head1 SEE ALSO
L<DBIx::Class::Migration>, L<DBIx::Class::Migration::Tutorial>
View
20 lib/DBIx/Class/Migration/Script.pm
@@ -146,6 +146,14 @@ sub cmd_populate {
->populate(@{$self->fixture_sets});
}
+sub cmd_help {
+ my ($self, $subhelp) = @_;
+ die "Help not yet finished.";
+ if($subhelp) {
+ } else {
+ }
+}
+
sub _import_libs {
my ($self, @libs) = @_;
require lib;
@@ -164,11 +172,13 @@ sub run {
$self->_import_libs(@{$self->includes})
if $self->has_includes;
- die "Must supply a command\n" unless $cmd;
- die "Extra argv detected - command only please\n" if @extra_argv;
- die "No such command ${cmd}\n" unless $self->can("cmd_${cmd}");
-
- $self->${\"cmd_${cmd}"};
+ if(!$cmd || $cmd eq 'help') {
+ $self->cmd_help(@extra_argv);
+ } else {
+ die "Extra argv detected - command only please\n" if @extra_argv;
+ die "No such command ${cmd}\n" unless $self->can("cmd_${cmd}");
+ $self->${\"cmd_${cmd}"};
+ }
}
sub run_with_options {
Please sign in to comment.
Something went wrong with that request. Please try again.