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

Option to prevent migrations running automatically. #52

Open
f3cp opened this issue Dec 8, 2022 · 2 comments
Open

Option to prevent migrations running automatically. #52

f3cp opened this issue Dec 8, 2022 · 2 comments

Comments

@f3cp
Copy link

f3cp commented Dec 8, 2022

I'm trying to use this package alongside the multi-tenancy package https://github.com/archtechx/tenancy.

This package creates seperate databases for the tenants while using the default database as a 'central' database.

The SAML2 tables need to be added to the individual tenant DBs not this 'central' database, but because this package uses "loadMigrationsFrom" I do not have control over how these migrations are loaded and run.

The Multi tenancy package allows me to specify additional 'paths' to use for tenant migrations, so I can include the path to the laravel-saml2 migrations directly to get them to run where I need them. However they also still run on the 'central' DB.

What I am hoping is that an option can be added to this package to be able to disable the "loadMigrationsFrom" command, so that they do not need to be run automatically in situations like mine where they are being run by a different method.

Do you think this is something that could be included in this package (assuming a solution to this does not already exist)?

If so, I can make a PR for this.

@jwktje
Copy link

jwktje commented Jan 17, 2023

I too have this issue. A fix like Sanctum or Cashier would work best I think. So you put a Auth::ignoreMigrations() in the AppServiceProvider. This method is implemented like so: https://github.com/laravel/sanctum/blob/21676ec103ee074dcdf7385af978ee97c4543111/src/Sanctum.php#L130

This sets a runsMigrations property that is returned by a shouldRunMigrations method, that is checked here:
https://github.com/laravel/sanctum/blob/fae52063ea7fb1d916baba787918c40fd3d8ab62/src/SanctumServiceProvider.php#L70

A PR that adds this to the Auth class of this package would solve this issue I think.

@breart
Copy link
Member

breart commented Mar 8, 2023

Feel free to submit a PR.

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

3 participants