Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bivanbi opened this issue Jan 6, 2020 · 0 comments

Comments

@bivanbi
Copy link
Contributor

bivanbi commented Jan 6, 2020

(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
MGatner added a commit that referenced this issue Jan 31, 2020
Restore namespace after regress. Fixes #2474
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant