Skip to content

Commit

Permalink
Merge pull request #8222 from kenjis/docs-db-migration
Browse files Browse the repository at this point in the history
docs: [Migration] clarify that `$db` is for testing purposes
  • Loading branch information
kenjis authored Nov 22, 2023
2 parents 8b9529f + 0b47dfe commit 5412fe4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
11 changes: 4 additions & 7 deletions system/Database/MigrationRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,11 @@ class MigrationRunner
protected $groupSkip = false;

/**
* Constructor.
* The migration can manage multiple databases. So it should always use the
* default DB group so that it creates the `migrations` table in the default
* DB group. Therefore, passing $db is for testing purposes only.
*
* When passing in $db, you may pass any of the following to connect:
* - group name
* - existing connection instance
* - array of database configuration values
*
* @param array|ConnectionInterface|string|null $db
* @param array|ConnectionInterface|string|null $db DB group. For testing purposes only.
*
* @throws ConfigException
*/
Expand Down
5 changes: 4 additions & 1 deletion user_guide_src/source/dbmgmt/migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Database Groups
===============

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

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

.. literalinclude:: migration/003.php

.. note:: The **migrations** table that tracks which migrations have already been
run will be always created in the default database group.

Namespaces
==========

Expand Down

0 comments on commit 5412fe4

Please sign in to comment.