Doctrine Migrations
TDBM integrates well with Symfony, as you are able to use the DoctrineMigrationsBundle.
TDBM provides wrappers around this library for:
- Building your database structure with fluid schemas (i.e.,
$x->foo()->bar()->baz()). - Defining your GraphQL types and their fields.
note
📣  All commands have to be run in the api service (make api).
Create a migration#
This command will generate a new empty migration in the src/api/migrations folder.
Add a meaningful description:
And throw the following exception in the down method:
You may now update the up method. For instance:
note
📣  A table name should be plural.
If you're updating an existing table, it would be better to edit the corresponding migration instead of creating a new migration.
note
📣  Do not edit a migration if a remote environment like your production did apply the migration.
Apply migrations#
This command will apply the new migrations to the database.
note
📣  In development, the api service does it on startup.
If you've edited an existing migration, you'll have to reset the database first:
note
📣  Reminder: Do not edit a migration if a remote environment like your production did apply the migration.