DBIx::Class::Migration::PostgresqlSandbox - Autocreate a postgresql sandbox
use DBIx::Class::Migration; my $migration = DBIx::Class::Migration->new( schema_class=>'Local::Schema', db_sandbox_class=>'DBIx::Class::Migration::PostgresqlSandbox'), $migration->prepare; $migration->install;
This automatically creates a postgresql sandbox in your target_dir that you can use for initial prototyping, development and demonstration. If you want to use this, you will need to add Test::postgresql to your Makefile.PL or your dist.ini file, and get that installed properly. It also requires that you have Postgresql installed locally (although Postgresql does not need to be running, as long as we can find in $PATH the binary installation). If your copy of Postgresql is not installed in a normal location, you might need to locally alter $PATH so that we can find it. For example, on my Mac, the path to Postgresql binaries are at /Library/PostgreSQL/bin so you can alter the PATH for a single command like so:
target_dir
Makefile.PL
dist.ini
/Library/PostgreSQL/bin
PATH=Library/PostgreSQL/bin:$PATH [command]
Or, if you are using Postgresql a lot, you can edit your .bashrc to make the above permanent.
.bashrc
NOTE: You might find installing DBD::Pg to be easier if you edit the $PATH before trying to install it.
$PATH
In addition to the Postgresql sandbox, we create three helper scripts start, stop and use which can be used to start, stop and open shell level access to you mysql sandbox.
start
stop
use
These helper scripts will be located in a child directory of your target_dir (which defaults to share under your project root directory). For example:
share
[target_dir]/[schema_class]/bin/[start|stop|use]
If your schema class is MyApp::Schema you should see helper scripts like
MyApp::Schema
/MyApp-Web /lib /MyApp Schema.pm /Schema ... /share /migrations /fixtures /myapp-schema /bin start stop use
This give you a system for installing a sandbox locally for development, starting and stopping it for use (for example in a web application like one you might create with Catalyst) and for using it by opening a native psql shell (such as if you wish to review the database manually, and run native SQL queries).
psql
DBIx::Class::Migration, DBD::Pg, Test::postgresql.
See DBIx::Class::Migration for author information
See DBIx::Class::Migration for copyright and license information
To install DBIx::Class::Migration, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Class::Migration
CPAN shell
perl -MCPAN -e shell install DBIx::Class::Migration
For more information on module installation, please visit the detailed CPAN module installation guide.