Name

CatalystX::Usul::Schema - Support for database schemas

Version

Describes v0.9.$Rev: 0 $

Synopsis

package YourApp::Schema;

use CatalystX::Usul::Moose;
use Class::Usul::Functions qw(arg_list);
use YourApp::Schema::Authentication;
use YourApp::Schema::Catalog;

extends qw(CatalystX::Usul::Schema);

my %ATTRS  = ( database          => q(library),
               schema_classes    => {
                  authentication => q(YourApp::Schema::Authentication),
                  catalog        => q(YourApp::Schema::Catalog), }, );

sub new_with_options {
   my ($self, @rest) = @_; my $attrs = arg_list @rest;

   return $self->next::method( %ATTRS, %{ $attrs } );
}

Description

Methods used to install and uninstall database applications

Configuration and Environment

Defines the following attributes

attrs

Hash ref which defaults to { add_drop_table => TRUE, no_comments => TRUE, }. It has an initialisation argument of dbattrs

database

String which is required

db_admin_ids

Hash ref which defaults to { mysql => q(root), pg => q(postgres), }

paragraph

Hash ref which defaults to { cl => TRUE, fill => TRUE, nl => TRUE }

preversion

String which defaults to null

rdbms

Array ref which defaults to [ qw(MySQL PostgreSQL) ]

schema_classes

Hash ref which defaults to {}

schema_version

String which defaults to 0.1

Boolean which defaults to false

Subroutines/Methods

create_database

$self->create_database;

Creates a database. Understands how to do this for different RDBMSs, e.g. MySQL and PostgreSQL

create_ddl

$self->create_ddl;

Dump the database schema definition

create_schema

$self->create_schema;

Creates a database then deploys and populates the schema

dbattrs

$self->dbattrs;

Merges the attrs attribute with the database attributes returned by the get_connect_info method

deploy_and_populate

$self->deploy_and_populate;

Create database tables and populate them with initial data. Called as part of the application install

driver

$self->driver;

The database driver string, derived from the "dsn" method

drop_database

$self->drop_database;

Drops the database that is selected by the call to database attribute

dsn

$self->dsn;

Returns the DSN from the call to get_connect_info

edit_credentials

$self->edit_credentials;

Edits the configuration file containing the database login information

host

$self->host;

Returns the hostname of the database server derived from the call to "dsn"

password

$self->password;

The unencrypted password used to connect to the database

user

$self->user;

The user id used to connect to the database

Diagnostics

None

Dependencies

CatalystX::Usul::TraitFor::ConnectInfo
CatalystX::Usul::TraitFor::PostInstallConfig
CatalystX::Usul::Moose
Class::Usul::Programs

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Peter Flanigan, <Support at RoxSoft.co.uk>

License and Copyright

Copyright (c) 2013 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE