NAME

DBIx::Class::Migration::MySQLSandbox - Autocreate a mysql sandbox

SYNOPSIS

    use DBIx::Class::Migration;

    my $migration = DBIx::Class::Migration->new(
      schema_class=>'Local::Schema',
      db_sandbox_class=>'DBIx::Class::Migration::MySQLSandbox'),

    $migration->prepare;
    $migration->install;

DESCRIPTION

This automatically creates a mysql 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::mysqld to your Makefile.PL or your dist.ini file, and get that installed properly. It also requires that you have MySQL installed locally (although MySQL does not need to be running, as long as we can find in $PATH the binary installation). If your copy of MySQL 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, mysqld is located at /usr/local/mysql/bin/mysqld so I could do something like this:

    PATH=/usr/local/mysqlbin:$PATH [command]

and alter the $PATH for one time running, or I could change the $PATH permanently by editing my .bashrc file (typically located in $HOME).

NOTE: You might find installing DBD::mysql to be easier if you edit the $PATH before trying to install it.

In addition to the MySQL 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.

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
            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 mysql shell (such as if you wish to review the database manually, and run native SQL queries).

SEE ALSO

DBIx::Class::Migration, DBD::mysql, Test::mysqld.

AUTHOR

See DBIx::Class::Migration for author information

COPYRIGHT & LICENSE

See DBIx::Class::Migration for copyright and license information