laravel-saml2
laravel-saml2 copied to clipboard
Option to prevent migrations running automatically.
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.
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.
Feel free to submit a PR.