Moodle
Migrations for Mojo DB Drivers
use Moodle; use Mojo::Pg; use App::Migrator; my $migrator = App::Migrator->new; my $driver = Mojo::Pg->new('postgresql://postgres@/test'); my $self = Moodle->new(migrator => $migrator, driver => $driver); my $migration = $self->migrate('latest');
Moodle uses Doodle with Mojo database drivers to easily install and evolve database schema migrations. See Doodle::Migrator for help setting up Doodle migrations, and Mojo::Pg, Mojo::mysql or Mojo::SQLite for help configuring the DB driver.
This package implements the following methods.
content() : Str
The content method generates DB migration statements using the Doodle::Migrator and return a string containing "UP" and "DOWN" versioned migration strings suitable for use with the migration feature of Mojo database drivers.
my $content = $self->content;
migrate(Maybe[Str] $target) : Object
The migrate method generates DB migration statements using the Doodle::Migrator and installs them using one of the Mojo database drivers, i.e. Mojo::Pg, Mojo::mysql or Mojo::SQLite. The method returns a migration object relative to to the DB driver used.
my $migrate = $self->migrate; my $latest = $self->migrate('latest');
To install Moodle, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Moodle
CPAN shell
perl -MCPAN -e shell install Moodle
For more information on module installation, please visit the detailed CPAN module installation guide.