DBIx::C...lSandbox(3)
π NAME π
okay so bestie, meet DBIx::Class::Migration::PostgresqlSandbox β aka the DBIx::C...lSandbox(3) page in the User Contributed Perl Documentation lineup β and its whole gig is autocreating a postgresql sandbox. π
β¨ SYNOPSIS β¨
Here's the group-chat recipe, copy it exactly:
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;
π¦ DESCRIPTION π¦
This module automatically creates a postgresql sandbox inside your target_dir so you have a cute little spot for initial prototyping, development and demonstration. π If you're gonna use it, you need to add Test::Postgresql58 to your Makefile.PL or your dist.ini file, and get it installed properly. It also needs Postgresql installed locally β but lowkey Postgresql does not need to be running, as long as the binary installation can be found in $PATH. πΈ
If your copy of Postgresql isn't installed in a normal location, you might need to locally alter $PATH so we can find it. For example, on my Mac, the Postgresql binaries are at /Library/PostgreSQL/bin, so you can alter the PATH for a single command like this β copy it exactly as shown, bestie:
PATH=Library/PostgreSQL/bin:$PATH [command]
Or, if you're using Postgresql a whole lot, you can edit your .bashrc to make the above permanent. π
NOTE: You might find installingDBD::Pgeasier if you edit$PATHbefore trying to install it. π
In addition to the Postgresql sandbox, we create several helper scripts start, stop and use which can be used to start, stop and open shell-level access to your mysql sandbox β yep, mysql, that's the word on the page, no cap π«Ά β dump lets you easily access pg_dump, and config is a Perl library that returns a hashref of the connection info, which is suitable to use in DBIx::Class Schema connect.
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:
[target_dir]/[schema_class]/bin/[start|stop|use]
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
config
dump
start
stop
use
This gives you a whole 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 using it by opening a native psql shell (such as if you wish to review the database manually and run native SQL queries). π
π₯ SEE ALSO π₯
DBIx::Class::Migration, DBD::Pg, Test::Postgresql58 β that's the whole squad. π
π«Ά AUTHOR π«Ά
See DBIx::Class::Migration for author information β that's where the author deets live. β
π COPYRIGHT & LICENSE π
See DBIx::Class::Migration for copyright and license information. Same place, same vibe. π§
mwah π this page is perl v5.42.0, dated 2020-06-03, and the footer calls it DBIx::C...lSandbox(3) β bye bestie! π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: perl-DBIx-Class-Migration 0.075-bp160.1.10 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms