App::DH - Deploy your DBIx::Class Schema to DDL/Database via DBIx::Class::DeploymentHandler
version 0.004001
Basic usage:
#!/usr/bin/env perl # # dh.pl use App::DH; App::DH->new_with_options->run;
--
usage: dh.pl [-?cdfhIos] [long options...] (install|upgrade|write_ddl) -h -? --usage --help Prints this usage information. -c --connection_name either a valid DBI DSN or an alias configured by DBIx::Class::Schema::Config -f --force forcefully replace existing DDLs. [DANGER] -s --schema the class name of the schema to generate DDLs/deploy for -I --include paths to load into @INC -o --script_dir output path -d --database database backends to generate DDLs for. See SQL::Translator::Producer::* for valid values commands: install install to the specified database connection upgrade upgrade the specified database connection write_ddl only write ddl files
If you don't like any of the defaults, you can subclass to override
use App::DH; { package MyApp; use Moose; extends 'App::DH'; has '+connection_name' => ( default => sub { 'production' } ); has '+schema' => ( default => sub { 'MyApp::Schema' } ); __PACKAGE__->meta->make_immutable; } MyApp->new_with_options->run;
App::DH is a basic skeleton of a command line interface for the excellent DBIx::Class::DeploymentHandler, to make executing database deployment stages easier.
DBIx::Class::DeploymentHandler
Only generate ddls for deploy/upgrade
dh.pl [...params] write_ddl
Install to connection "--connection_name"
dh.pl [...params] install
Upgrade connection "--connection_name"
dh.pl [...params] upgrade
Report database_version of "--connection"
Report schema_version of "--schema"
dh.pl [...params] schema_version
-c/--connection_name
Specify the connection details to use for deployment. Can be a name of a configuration in a DBIx::Class::Schema::Config configuration if the "--schema" uses it.
DBIx::Class::Schema::Config
--connection_name 'dbi:SQLite:/path/to/db' -cdevelopment
Overwrite existing DDL files of the same version.
-f/--force
-s/--schema
The class name of the schema to load for DDL/Deployment
-sMyProject::Schema --schema MyProject::Schema
-I/--include
Add a given library path to @INC prior to loading schema
schema
-I../lib --include ../lib
May be specified multiple times.
-o/--script_dir
Specify where to write the per-backend DDL's.
Default is ./share/ddl
-o/tmp/ddl --script_dir /tmp/ddl
-d/--database
Specify the SQL::Translator::Producer::* backend to use for generating DDLs.
SQL::Translator::Producer::*
-dSQLite --database PostgreSQL
Can be specified multiple times.
Default is introspected from looking at whatever "--connection_name" connects to.
--target
Specify which version to install/upgrade to.
If not specified, defaults to the latest version.
This module is mostly code by mst, sponsored by nordaaker.com, and I've only tidied it up and made it more CPAN Friendly.
The authoring of the initial incarnation of this code is kindly sponsored by nordaaker.com.
kentnl - Kent Fredric (cpan:KENTNL) <kentnl@cpan.org>
mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>
This software is copyright (c) 2017 by The App::DH Authors, Contributors, and Sponsors.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::DH, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::DH
CPAN shell
perl -MCPAN -e shell install App::DH
For more information on module installation, please visit the detailed CPAN module installation guide.