-
Notifications
You must be signed in to change notification settings - Fork 121
Closed
Description
This is a (multiple allowed):
-
bug
-
CakePHP Version: 4.4.6
-
Migrations plugin version: 3.6.0
-
Database server (MySQL, SQLite, Postgres): MySQL 8.0.29
-
PHP Version: 8.1.14
-
Platform / OS: Linux
What you did
- define migrations of the application (create
users) and theTestPluginplugin (createtest_plugin_entities). - put in
tests/bootstrap.php:(new Migrator())->runMany([ ['skip' => ['test_plugin_entities']], ['plugin' => 'TestPlugin', 'skip' => ['[!t]*', 't[!e]*']], ]);
- run tests.
- add an application migration.
- run tests.
- run tests.
- run tests.
Expected Behavior
All runs succeed.
On second run,
- application tables are dropped and re-created by migrations.
TestPlugintables are not dropped.
On third and forth runs, no tables are dropped.
Actual Behavior
Second run failed:
Error in bootstrap script: PDOException:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'test_plugin_entities' already exists
- application tables are dropped and re-created by migrations.
TestPlugintables are not dropped, buttest_plugin_phinxlogis empty.
Third run failed:
Error in bootstrap script: PDOException:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists
- application tables are not dropped, but
phinxlogis empty.
Forth run succeeded.
- application tables are dropped and re-created by migrations.
TestPlugintables are dropped and re-created by migrations.
Cause
migrations/src/TestSuite/Migrator.php
Lines 217 to 220 in 792cc07
| $phinxTables = $this->getPhinxTables($connection); | |
| if (count($phinxTables)) { | |
| $this->helper->truncateTables($connection, $phinxTables); | |
| } |
This truncates phinxlog of unrelated migration sets.
Workaround
This problem doesn't occur if we don't use the skip option, but tables are truncated twice in one run.
Reactions are currently unavailable