Skip to content

system\Database\MigrationRunner->regress() resets instance variable $namespace to null #2474

Description

@bivanbi

(In v4.0.0rc3), method MigrationRunner->regress() has a side effect: it resets variable $namespace to null, which causes subsequent calls to MigrationRunner not to operate on the intended namespace:

308        // Get all migrations
309        $this->namespace = null;

Can be triggered like this:

  1. Have a valid Migration file in app/Database/Migration
  2. create a database test case (extend CIDatabaseTestCase), specify $namespace = 'App' to use App/Database/Migrations; set $refresh = true
  3. run test case twice.
  4. the second time around, MigrationRunner->regress() will be called to roll back migrations from first run, invalidating $namespace setting, causing subsequent latest() call not to be namespaced, which leads it to include tests/_support/DatabaseTestMigrations/Database/Migrations

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions