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:
Or, if you are using Postgresql a lot, you can edit your
.bashrc to make the above permanent.
NOTE: You might find installing DBD::Pg to be easier if you edit the
$PATH before trying to install it.
In addition to the Postgresql sandbox, we create three helper scripts
use which can be used to start, stop and open shell level access to you mysql sandbox.
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:
If your schema class is
MyApp::Schema you should see helper scripts like
/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).
See DBIx::Class::Migration for author information
See DBIx::Class::Migration for copyright and license information