Skip to content

Commit 5412fe4

Browse files
authored
Merge pull request #8222 from kenjis/docs-db-migration
docs: [Migration] clarify that `$db` is for testing purposes
2 parents 8b9529f + 0b47dfe commit 5412fe4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

system/Database/MigrationRunner.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,11 @@ class MigrationRunner
122122
protected $groupSkip = false;
123123

124124
/**
125-
* Constructor.
125+
* The migration can manage multiple databases. So it should always use the
126+
* default DB group so that it creates the `migrations` table in the default
127+
* DB group. Therefore, passing $db is for testing purposes only.
126128
*
127-
* When passing in $db, you may pass any of the following to connect:
128-
* - group name
129-
* - existing connection instance
130-
* - array of database configuration values
131-
*
132-
* @param array|ConnectionInterface|string|null $db
129+
* @param array|ConnectionInterface|string|null $db DB group. For testing purposes only.
133130
*
134131
* @throws ConfigException
135132
*/

user_guide_src/source/dbmgmt/migration.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Database Groups
6666
===============
6767

6868
A migration will only be run against a single database group. If you have multiple groups defined in
69-
**app/Config/Database.php**, then it will run against the ``$defaultGroup`` as specified
69+
**app/Config/Database.php**, then by default it will run against the ``$defaultGroup`` as specified
7070
in that same configuration file.
7171

7272
There may be times when you need different schemas for different
@@ -79,6 +79,9 @@ match the name of the database group exactly:
7979

8080
.. literalinclude:: migration/003.php
8181

82+
.. note:: The **migrations** table that tracks which migrations have already been
83+
run will be always created in the default database group.
84+
8285
Namespaces
8386
==========
8487

0 commit comments

Comments
 (0)