Introduction

The Doctrine Migrations project offers additional functionality on top of the DBAL and ORM for versioning your database schema. It makes it easy and safe to deploy changes to it in a way that can be reviewed and tested before being deployed to production.

Installation

You can use the Doctrine Migrations project by installing it with Composer or by downloading the latest PHAR from the releases page on GitHub.

For this documentation exercise we will assume you are starting a new project so create a new folder to work in:

$ mkdir /data/doctrine/migrations-docs-example
$ cd /data/doctrine/migrations-docs-example

Composer

Now to install with Composer it is as simple as running the following command in your project.

$ composer require "doctrine/migrations"

Now you will have a file in vendor/bin available to run the migrations console application:

$ ./vendor/bin/doctrine-migrations

PHAR

To install by downloading the PHAR, you just need to download the latest PHAR file from the releases page on GitHub.

Here is an example using the 2.0.0 release:

$ wget https://github.com/doctrine/migrations/releases/download/v2.0.0/doctrine-migrations.phar

Now you can execute the PHAR like this:

$ php doctrine-migrations.phar

Next Chapter: Configuration