Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kentnl/app-dh

Deploy your DBIx::Class Schema to DDL/Database via DBIx::Class::DeploymentHandler
https://github.com/kentnl/app-dh

perl

Last synced: 14 days ago
JSON representation

Deploy your DBIx::Class Schema to DDL/Database via DBIx::Class::DeploymentHandler

Awesome Lists containing this project

README

        

# NAME

App::DH - Deploy your DBIx::Class Schema to DDL/Database via DBIx::Class::DeploymentHandler

# VERSION

version 0.004001

# SYNOPSIS

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;

# DESCRIPTION

App::DH is a basic skeleton of a command line interface for the excellent
[`DBIx::Class::DeploymentHandler`](https://metacpan.org/pod/DBIx::Class::DeploymentHandler), to make executing database deployment stages easier.

# COMMANDS

## write\_ddl

Only generate ddls for deploy/upgrade

dh.pl [...params] write_ddl

## install

Install to connection ["--connection\_name"](#connection_name)

dh.pl [...params] install

## upgrade

Upgrade connection ["--connection\_name"](#connection_name)

dh.pl [...params] upgrade

## database\_version

Report database\_version of ["--connection"](#connection)

## schema\_version

Report schema\_version of ["--schema"](#schema)

dh.pl [...params] schema_version

# PARAMETERS

## --connection\_name

-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"](#schema) uses it.

--connection_name 'dbi:SQLite:/path/to/db'

-cdevelopment

## --force

Overwrite existing DDL files of the same version.

-f/--force

## --schema

-s/--schema

The class name of the schema to load for DDL/Deployment

-sMyProject::Schema
--schema MyProject::Schema

## --include

-I/--include

Add a given library path to @INC prior to loading `schema`

-I../lib
--include ../lib

May be specified multiple times.

## --script\_dir

-o/--script_dir

Specify where to write the per-backend DDL's.

Default is ./share/ddl

-o/tmp/ddl
--script_dir /tmp/ddl

## --database

-d/--database

Specify the `SQL::Translator::Producer::*` backend to use for generating DDLs.

-dSQLite
--database PostgreSQL

Can be specified multiple times.

Default is introspected from looking at whatever ["--connection\_name"](#connection_name) connects to.

## --target

--target

Specify which version to install/upgrade to.

If not specified, defaults to the latest version.

# CREDITS

This module is mostly code by mst, sponsored by [nordaaker.com](http://nordaaker.com), and I've only tidied it up and made it
more CPAN Friendly.

# SPONSORS

The authoring of the initial incarnation of this code is kindly sponsored by [nordaaker.com](http://nordaaker.com).

# AUTHORS

- kentnl - Kent Fredric (cpan:KENTNL)
- mst - Matt S. Trout (cpan:MSTROUT)

# COPYRIGHT AND LICENSE

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.