# NAME

Moodle

# ABSTRACT

Migrations for Mojo DB Drivers

# SYNOPSIS

    use Moodle;
    use Mojo::Pg;
    use Migrator;

    my $migrator = Migrator->new;
    my $dbdriver = Mojo::Pg->new('postgresql://postgres@/test');

    my $self = Moodle->new(migrator => $migrator, driver => $dbdriver);

    my $migration = $self->migrate('latest');

# DESCRIPTION

Moodle uses [Doodle](https://metacpan.org/pod/Doodle) with [Mojo](https://metacpan.org/pod/Mojo) database drivers to easily install and
evolve database schema migrations. See [Doodle::Migrator](https://metacpan.org/pod/Doodle::Migrator) for help setting up
[Doodle](https://metacpan.org/pod/Doodle) migrations, and [Mojo::Pg](https://metacpan.org/pod/Mojo::Pg), [Mojo::mysql](https://metacpan.org/pod/Mojo::mysql) or [Mojo::SQLite](https://metacpan.org/pod/Mojo::SQLite) for
help configuring the DB driver.

# METHODS

This package implements the following methods.

## content

    content() : Str

The content method generates DB migration statements using the
[Doodle::Migrator](https://metacpan.org/pod/Doodle::Migrator) and return a string containing "UP" and "DOWN" versioned
migration strings suitable for use with the migration feature of [Mojo](https://metacpan.org/pod/Mojo)
database drivers.

- content example

        my $content = $self->content;

## migrate

    migrate(Maybe[Str] $target) : Object

The migrate method generates DB migration statements using the
[Doodle::Migrator](https://metacpan.org/pod/Doodle::Migrator) and installs them using one of the [Mojo](https://metacpan.org/pod/Mojo) database
drivers, i.e. [Mojo::Pg](https://metacpan.org/pod/Mojo::Pg), [Mojo::mysql](https://metacpan.org/pod/Mojo::mysql) or [Mojo::SQLite](https://metacpan.org/pod/Mojo::SQLite). The method
returns a migration object relative to the DB driver used.

- migrate example

        my $migrate = $self->migrate;
