GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
DBIx::Class::Migration::PostgresqlSandbox(3) User Contributed Perl Documentation DBIx::Class::Migration::PostgresqlSandbox(3)

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::Postgresql58 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:

    PATH=Library/PostgreSQL/bin:$PATH [command]

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 several helper scripts "start", "stop" and "use" which can be used to start, stop and open shell level access to you mysql sandbox. "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 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).

DBIx::Class::Migration, DBD::Pg, Test::Postgresql58.

See DBIx::Class::Migration for author information

See DBIx::Class::Migration for copyright and license information
2020-06-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.