Migrations are located in one or more directories (called groups). Unless configured otherwise, Nextras Migrations define three groups.
structures
CREATE TABLE ...
,
ALTER TABLE ...
) and for data migrations queries required to
support the structural changesbasic-data
dummy-data
Migrations are executed in alphabetical order (by filename), e.g.
structures/2015-03-17-aaa.sql
is executed before
dummy-data/2015-03-17-zzz.sql
. The following structure is
recommended and used by Symfony Console Commands by default:
migrations
├── basic-data # for both development and production
│ ├── 2015-03-16-170342-languages.sql # YYYY-MM-DD-HHMMSS-label.extension
│ └── ...
├── dummy-data # for development on localhost
│ ├── 2015-03-17-104235-users.sql
│ └── ...
└── structures # create, alter tables...
├── 2015-03-17-155419-users.sql
└── ...
Optionally you can use deep directory structure which is suitable if you have a lot of migrations:
migrations/
├── basic-data/
│ └── 2015/
│ ├── 03/
│ │ ├── 2015-03-16-170342-languages.sql
│ │ └── ...
│ └── 04/
│ └── ...
└── ...
Migrations can written as file with any extension that has defined extension
handler. The two built-in extension handlers are SQL and PHP. Migrations can be
written manually or generated through diff generator. The only built-in diff
generator is a structures
generator for Doctrine.