@@ -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
59
59
60
60
All of the migrations functionality is contained in a few console commands:
61
61
62
- .. code-block :: bash
62
+ .. code-block :: terminal
63
63
64
64
doctrine
65
65
doctrine:migrations:diff [diff] Generate a migration by comparing your current database to your mapping information.
@@ -76,7 +76,7 @@ All of the migrations functionality is contained in a few console commands:
76
76
Start by getting the status of migrations in your application by running
77
77
the ``status `` command:
78
78
79
- .. code-block:: bash
79
+ .. code-block :: terminal
80
80
81
81
$ php bin/console doctrine:migrations:status
82
82
@@ -89,7 +89,7 @@ the ``status`` command:
89
89
>> Configuration Source: manually configured
90
90
>> Version Table Name: migration_versions
91
91
>> Version Column Name: version
92
- >> Migrations Namespace: App \M igrations
92
+ >> Migrations Namespace: DoctrineMigrations
93
93
>> Migrations Directory: /path/to/project/app/Migrations
94
94
>> Previous Version: Already at first version
95
95
>> Current Version: 0
@@ -104,7 +104,7 @@ Now, you can start working with migrations by generating a new blank migration
104
104
class. Later, you'll learn how Doctrine can generate migrations automatically
105
105
for you.
106
106
107
- .. code-block:: bash
107
+ .. code-block :: terminal
108
108
109
109
$ php bin/console doctrine:migrations:generate
110
110
Generated new migration class to "/path/to/project/app/Migrations/Version20180605025653.php"
@@ -120,7 +120,7 @@ like the following:
120
120
121
121
declare(strict_types=1);
122
122
123
- namespace App\Migrations ;
123
+ namespace DoctrineMigrations ;
124
124
125
125
use Doctrine\DBAL\Schema\Schema;
126
126
use Doctrine\Migrations\AbstractMigration;
@@ -151,7 +151,7 @@ like the following:
151
151
If you run the ``status `` command it will now show that you have one new
152
152
migration to execute:
153
153
154
- .. code-block:: bash
154
+ .. code-block :: terminal
155
155
156
156
$ php bin/console doctrine:migrations:status --show-versions
157
157
@@ -182,7 +182,7 @@ migration to execute:
182
182
Now you can add some migration code to the ``up() `` and ``down() `` methods and
183
183
finally migrate when you're ready:
184
184
185
- .. code-block:: bash
185
+ .. code-block :: terminal
186
186
187
187
$ php bin/console doctrine:migrations:migrate 20180605025653
188
188
@@ -191,6 +191,7 @@ fill in the ``up()`` and ``down()`` methods), see the official Doctrine Migratio
191
191
`documentation `_.
192
192
193
193
.. tip ::
194
+
194
195
If you need to use another database connection to execute migrations you may use option ``--db="doctrine-connection-name" ``
195
196
where ``doctrine-connection-name `` is valid Doctrine connection defined in doctrine.yaml
196
197
@@ -217,7 +218,7 @@ Skipping Migrations
217
218
218
219
You can skip single migrations by explicitly adding them to the ``migration_versions `` table:
219
220
220
- .. code-block:: bash
221
+ .. code-block :: terminal
221
222
222
223
$ php bin/console doctrine:migrations:version YYYYMMDDHHMMSS --add
223
224
@@ -299,7 +300,7 @@ With this information, Doctrine is now ready to help you persist your new
299
300
doesn't exist yet! Generate a new migration for this table automatically by
300
301
running the following command:
301
302
302
- .. code-block:: bash
303
+ .. code-block :: terminal
303
304
304
305
$ php bin/console doctrine:migrations:diff
305
306
@@ -308,7 +309,7 @@ the schema differences. If you open this file, you'll find that it has the
308
309
SQL code needed to create the ``user `` table. Next, run the migration
309
310
to add the table to your database:
310
311
311
- .. code-block:: bash
312
+ .. code-block :: terminal
312
313
313
314
$ php bin/console doctrine:migrations:migrate
314
315
@@ -325,7 +326,7 @@ for your project.
325
326
If you don't want to use this workflow and instead create your schema via
326
327
``doctrine:schema:create ``, you can tell Doctrine to skip all existing migrations:
327
328
328
- .. code-block:: bash
329
+ .. code-block :: terminal
329
330
330
331
$ php bin/console doctrine:migrations:version --add --all
331
332
@@ -336,7 +337,7 @@ Manual Tables
336
337
337
338
It is a common use case, that in addition to your generated database structure
338
339
based on your doctrine entities you might need custom tables. By default such
339
- tables will be removed by the doctrine:migrations:diff command.
340
+ tables will be removed by the `` doctrine:migrations:diff `` command.
340
341
341
342
If you follow a specific scheme you can configure doctrine/dbal to ignore those
342
343
tables. Let's say all custom tables will be prefixed by ``t_ ``. In this case you
@@ -373,3 +374,4 @@ will need to be placed per-connection.
373
374
.. _documentation : https://www.doctrine-project.org/projects/doctrine-migrations/en/current/index.html
374
375
.. _DoctrineMigrationsBundle : https://github.com/doctrine/DoctrineMigrationsBundle
375
376
.. _`Doctrine Database Migrations` : https://github.com/doctrine/migrations
377
+ .. _`Symfony Flex` : https://symfony.com/doc/current/setup/flex.html
0 commit comments