Skip to content

Run mutliple Migration sets on same Connection (3.next / Migrator) #513

@swiffer

Description

@swiffer

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • CakePHP Version: 4.3.0-RC3

  • Migrations plugin version: 3.next

  • Database server (MySQL, SQLite, Postgres): Postgres 13.4

  • PHP Version: 8.0.8

  • Platform / OS: Ubuntu 20.04

What you did

I'm trying to run Migrations for my Application and one Plugin that is used within the application via the new Migrator.

I tried different things in tests/bootstrap.php

$migrator->run();
$migrator->run([['plugin' => 'AuditStash']]);
$migrator->run([['connection' => 'test'], ['plugin' => 'AuditStash', 'connection' => 'test']]);

On execution the verbose logs show:

Reading migrations status for connection "test"...
New migration(s) found.
Dropping Constraints 1 tables for connection test
Dropping 1 tables for connection test
Migrations for connection "test" successfully run.
Truncating 33 tables for connection test
Reading migrations status for connection "test", plugin "AuditStash"...
New migration(s) found.
Dropping Constraints 1 tables for connection test
Dropping 1 tables for connection test
Migrations for connection "test", plugin "AuditStash" successfully run.
Truncating 1 tables for connection test

Expected Behavior

Both Migration sets should run and all tables should be available in the database as for Plugins the phinxlog is prefixed via audit_stash_phinxlog.

Actual Behavior

The migrations of the app itself are not available in the TestSuite once the Migration set for the AuditStash Plugin is added.

The first test is complaining of a missing table which is part of the App Migration Set.

Cake\Core\Exception\CakeException: Cannot describe schema for table `companies` for fixture `App\Test\Fixture\CompaniesFixture`: the table does not exist.```

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions