NAME

DBIx::Migration::Directories::Build - Build a package that includes a migration schema

SYNOPSIS

eval {
    require DBIx::Migration::Directories::Build;
};

if($@) {
    my $build = Module::Build->new(
        module_name         =>  'My::Module',
        license             =>  'perl',
        requires            =>  {
            'DBIx::Migration::Directories'  =>  '0.01',
        },
        create_makefile_pl  =>  'passthrough',
    );
    die "Can't proceed without DBIx::Migration::Directories!";
}

my $build = DBIx::Migration::Directories::Build->new(
    module_name     =>  'My::Module',
    license         =>  'perl',
    create_makefile_pl  =>  'passthrough',
    requires        =>  {
        'DBIx::Migration::Directories'  =>  '0.01',
        'perl'                          =>  '5.6.1',
    },
    schema_name     =>  'My-Module-Database',
    ...
);

$build->create_build_script;

DESCRIPTION

When DBIx::Migration::Directories is installed, the user is asked where they would like database migration schemas to live. (This usually defaults to something like "/usr/local/share/schemas".) Packages that use DBIx::Migration::Directories should then install their schemas into a sub-directory of this, named after their package or schema name. That way, the migration code can find and use these schemas easily.

DBIx::Migration::Directories::Build is a subclass of Module::Build, which ensures that your database schemas are installed in this manner.

USAGE

If your package only supplies one schema, you can simply create a schema directory structure (as described by "DIRECTORY STRUCTURE" in DBIx::Migration::Directories) in a "schema" directory in the base of your package. When "Build install" is run, this schema will be installed into the appropriate place.

If your package supplies multiple schemas, you can create a "schemas" directory instead, and create sub-directories for each schema below that. (Eg; schemas/My-Schema-Foo, schemas/My-Schema-Bar, etc.)

SCHEMA NAMING

When using the "schema" directory, by default, your schema will be named after your package, with double-colons (::) replaced by dashes, (-), as is the perl way. For example, if the package "My::Package" had a "schema" directory, that would be installed as /path/to/schemas/My-Package.

If you want your schema to be named something else when it is installed, you can override the default behaviour by passing the "schema_name" argument to the DBIx::Migration::Directories::Build constructor. This could be useful if it's a particular module inside your package that defines/versions the schema (see "desired_version_from" in DBIx::Migration::Directories).

AUTHOR

Tyler "Crackerjack" MacDonald <japh@crackerjack.net>

LICENSE

Copyright 2005 Tyler "Crackerjack" MacDonald <japh@crackerjack.net>

This is free software; You may distribute it under the same terms as perl itself.

SEE ALSO

DBIx::Migration::Directories, Module::Build