From eafda29a27553a821c5625c1ca12432d28fdbadc Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 16 Nov 2023 08:35:38 +0900 Subject: [PATCH 1/2] docs: add note for migrations table --- user_guide_src/source/dbmgmt/migration.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/dbmgmt/migration.rst b/user_guide_src/source/dbmgmt/migration.rst index 4af207164b73..fd816e551c02 100644 --- a/user_guide_src/source/dbmgmt/migration.rst +++ b/user_guide_src/source/dbmgmt/migration.rst @@ -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 @@ -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 ========== From 0b47dfea28cbaf8e09ebc3cb31e5346d119242bc Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 16 Nov 2023 08:45:15 +0900 Subject: [PATCH 2/2] docs: clarify that $db is for testing purposes --- system/Database/MigrationRunner.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/system/Database/MigrationRunner.php b/system/Database/MigrationRunner.php index 241a9e6da5fa..a466a91462dc 100644 --- a/system/Database/MigrationRunner.php +++ b/system/Database/MigrationRunner.php @@ -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 */