DBIx::C...lSandbox(3)

πŸ“¦ version 0.075, in opensuse-leap 16.0

πŸ’… 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 installing DBD::Pg easier if you edit $PATH before 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. ⭐

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