@@ -15,11 +15,11 @@ Installation
15
15
16
16
Run this command in your terminal:
17
17
18
- .. code-block :: bash
18
+ .. code-block :: terminal
19
19
20
20
$ composer require doctrine/doctrine-migrations-bundle "^2.0"
21
21
22
- If you don't use Symfony Flex, you must enable the bundle manually in the application:
22
+ If you don't use ` Symfony Flex `_ , you must enable the bundle manually in the application:
23
23
24
24
.. code-block :: php
25
25
61
61
62
62
All of the migrations functionality is contained in a few console commands:
63
63
64
- .. code-block :: bash
64
+ .. code-block :: terminal
65
65
66
66
doctrine
67
67
doctrine:migrations:diff [diff] Generate a migration by comparing your current database to your mapping information.
@@ -78,7 +78,7 @@ All of the migrations functionality is contained in a few console commands:
78
78
Start by getting the status of migrations in your application by running
79
79
the ``status `` command:
80
80
81
- .. code-block:: bash
81
+ .. code-block :: terminal
82
82
83
83
$ php bin/console doctrine:migrations:status
84
84
@@ -106,7 +106,7 @@ Now, you can start working with migrations by generating a new blank migration
106
106
class. Later, you'll learn how Doctrine can generate migrations automatically
107
107
for you.
108
108
109
- .. code-block:: bash
109
+ .. code-block :: terminal
110
110
111
111
$ php bin/console doctrine:migrations:generate
112
112
Generated new migration class to "/path/to/project/app/Migrations/Version20180605025653.php"
@@ -153,7 +153,7 @@ like the following:
153
153
If you run the ``status `` command it will now show that you have one new
154
154
migration to execute:
155
155
156
- .. code-block:: bash
156
+ .. code-block :: terminal
157
157
158
158
$ php bin/console doctrine:migrations:status --show-versions
159
159
@@ -184,7 +184,7 @@ migration to execute:
184
184
Now you can add some migration code to the ``up() `` and ``down() `` methods and
185
185
finally migrate when you're ready:
186
186
187
- .. code-block:: bash
187
+ .. code-block :: terminal
188
188
189
189
$ php bin/console doctrine:migrations:migrate 20180605025653
190
190
@@ -193,6 +193,7 @@ fill in the ``up()`` and ``down()`` methods), see the official Doctrine Migratio
193
193
`documentation `_.
194
194
195
195
.. tip ::
196
+
196
197
If you need to use another database connection to execute migrations you may use option ``--db="doctrine-connection-name" ``
197
198
where ``doctrine-connection-name `` is valid Doctrine connection defined in doctrine.yaml
198
199
@@ -219,7 +220,7 @@ Skipping Migrations
219
220
220
221
You can skip single migrations by explicitly adding them to the ``migration_versions `` table:
221
222
222
- .. code-block:: bash
223
+ .. code-block :: terminal
223
224
224
225
$ php bin/console doctrine:migrations:version YYYYMMDDHHMMSS --add
225
226
@@ -301,7 +302,7 @@ With this information, Doctrine is now ready to help you persist your new
301
302
doesn't exist yet! Generate a new migration for this table automatically by
302
303
running the following command:
303
304
304
- .. code-block:: bash
305
+ .. code-block :: terminal
305
306
306
307
$ php bin/console doctrine:migrations:diff
307
308
@@ -310,7 +311,7 @@ the schema differences. If you open this file, you'll find that it has the
310
311
SQL code needed to create the ``user `` table. Next, run the migration
311
312
to add the table to your database:
312
313
313
- .. code-block:: bash
314
+ .. code-block :: terminal
314
315
315
316
$ php bin/console doctrine:migrations:migrate
316
317
@@ -327,7 +328,7 @@ for your project.
327
328
If you don't want to use this workflow and instead create your schema via
328
329
``doctrine:schema:create ``, you can tell Doctrine to skip all existing migrations:
329
330
330
- .. code-block:: bash
331
+ .. code-block :: terminal
331
332
332
333
$ php bin/console doctrine:migrations:version --add --all
333
334
@@ -338,7 +339,7 @@ Manual Tables
338
339
339
340
It is a common use case, that in addition to your generated database structure
340
341
based on your doctrine entities you might need custom tables. By default such
341
- tables will be removed by the doctrine:migrations:diff command.
342
+ tables will be removed by the `` doctrine:migrations:diff `` command.
342
343
343
344
If you follow a specific scheme you can configure doctrine/dbal to ignore those
344
345
tables. Let's say all custom tables will be prefixed by ``t_ ``. In this case you
@@ -375,3 +376,4 @@ will need to be placed per-connection.
375
376
.. _documentation : https://www.doctrine-project.org/projects/doctrine-migrations/en/current/index.html
376
377
.. _DoctrineMigrationsBundle : https://github.com/doctrine/DoctrineMigrationsBundle
377
378
.. _`Doctrine Database Migrations` : https://github.com/doctrine/migrations
379
+ .. _`Symfony Flex` : https://symfony.com/doc/current/setup/flex.html
0 commit comments