A standalone migrations framework that can also work as the foundation for your own PHP migrations library.
PHP
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
build
config
docs
src
test
.coveralls.yml
.gitattributes
.gitignore
.scrutinizer.yml
.travis.yml
CODE_OF_CONDUCT.md
LICENSE
README.md
build.xml
composer.json
phpunit.xml.dist

README.md

Baleen CLI

Build Status Code Coverage Scrutinizer Code Quality Packagist

Author License

Generic, customisable command-line wrapper for Baleen Migrations.

Installation

With Composer:

composer install baleen/cli

Baleen CLI is quite opinionated in its defaults, so it doesn't need extra configuration to run. So if you'd like to just test-drive the project, you can now jump straight to the "usage" section.

But you can customize almost anything through a configuration file. To create a configuration file, run the following:

./vendor/bin/baleen init

This will generate two files in your working directory:

  • .baleen.yml: the configuration file.
  • .baleen_versions: a simple file to keep track of which versions have been migrated. This can later be replaced with a database table. You may want to ignore this file in your VCS system (e.g. using Git's .gitignore file).

The .baleen_versions file will be created for you automatically if you use the default configuration values. You don't need to run baleen init in order for the file to be created.

If you don't want to type ./vendor/bin/baleen to run baleen commands then you can alternatively use Composer as a shortcut. Just edit your project's composer.json file to add the following:

{
   "scripts": {
       "baleen": "vendor/bin/baleen --ansi"
   }
}

Now you can run Baleen CLI easily by just typing composer baleen!

Usage

To see some help and a list of available commands, simply execute:

./vendor/bin/baleen

For more help on a specific command simply run ./vendor/bin/baleen help {command}, replacing {command} with the name of an available command.

Creating Migrations

Migrations are stored by default under the ./migrations directory, which will be automatically created every time your run a commend if it doesn't exist.

You can customise which directory to use for migrations, as well as the namespace for migration classes by editing the .baleen.yml config file.

To easily create a new Migration file run the following command:

./vendor/bin/baleen migrations:create

Running Migrations

Running migrations is as easy as executing:

./vendor/bin/baleen migrate

By default it will migrate up to the latest available version.

If you'd like to see a log instead of the progress-bar then just add the --no-progress option to the migrate command above.

Documentation

Documentation can be found either in the ./docs folder or compiled and online at Read The Docs: http://baleen-cli.readthedocs.org/en/latest/

License

Licensed under MIT - for more details please refer to the LICENSE file at the root directory.