Before you can use migrations, you'll need to provide the configuration describing
what database connection to use, in which table to store migration history, where to
store migration classes, etc. To do that,
add the following lines to your config/autoload/global.php
file:
<?php
return [
'doctrine' => [
// migrations configuration
'migrations_configuration' => [
'orm_default' => [
'directory' => 'data/Migrations',
'name' => 'Doctrine Database Migrations',
'namespace' => 'Migrations',
'table' => 'migrations',
],
],
],
// ...
];
As you can see, we have the doctrine
key and its migrations_configuration
subkey (line 5). Under this subkey we
provide the configuration for migrations:
In line 6, we provide the name of entity manager to use (orm_default
).
In line 7, we tell Doctrine that we want to store migrations under the APP_DIR/data/Migrations
directory.
In line 8, we provide a user-friendly name for our migrations.
In line 9, we tell Doctrine that we want that our migration classes live in Migrations
namespace.
You can specify a namespace of your choice.
In line 10, we tell Doctrine that want to store migration history inside of migrations
database table.
Doctrine will create and manage that table automatically.