amyboyd/mongrate-bundle

Symfony bundle for Mongrate

Installs: 934

Dependents: 0

Stars: 1

Watchers: 1

Forks: 2

Open Issues: 4

Language: PHP

1.3.1 2015-06-26 13:02 UTC

README

Build Status Code Coverage

A Symfony bundle for Mongrate.

Available Commands:

Installation

Mongrate Bundle is available via Composer.

composer require "amyboyd/mongrate"

Set your configuration in your Symfony application's config.yml:

mongrate:
    mongodb_server: 'mongodb://localhost:27017'
    mongodb_db: my_database
    migrations_directory: "%kernel.root_dir%/../migrations"

As always, you can use settings from parameters.yml with %...%. For example:

mongrate:
    mongodb_server: %mongodb_server%
    mongodb_db: %mongodb_db%_prod

Usage

See the commands available by running

app/console list mongrate

GenerateMigration Command

Generate a base migration backbone.

app/console mongrate:generate-migration <migration-name>

List Command

List all migrations and its statuses that indicates if the migrations was already applyed or not.

app/console mongrate:list-migrations

Test Command

Allow you to test your migrations up and down.

app/console mongrate:test <up|down> <migration-name>

Up Command

Apply your up migration.

app/console mongrate:up <migration-name>

Down Command

Apply your down migration that should rollback to previous state before applyed up migration.

app/console mongrate:down <migration-name>

Toggle Command

Toggle a migration up or down.

app/console mongrate:toggle <migration-name>

Contributing

Please submit pull requests on GitHub:

Install PHP-CS-Fixer:

sudo curl http://get.sensiolabs.org/php-cs-fixer.phar -o /usr/local/bin/php-cs-fixer

Install the Git pre-commit hook:

ln -s ../../resources/pre-commit .git/hooks/pre-commit
chmod a+x .git/hooks/pre-commit

To run the tests:

vendor/bin/phpunit