Support for Overriding Versions
Use Cases
- Major API Versioning (e.g.
api.example.com/v1) - Alternative storage for migration versions
Implementation
So I'm thinking an elegant solution for this would be some way of over riding the versions array, similar to ResposeMigrations::setVersion(). This would provide plenty of flexibility to pull the versions in from wherever you please, just using modifying the config as an example.
We would need a way to override the current version as well RequestMigrations::setCurrentVersion('YYYY-MM-DD') so we know what the current version is depending on which subset you use. We should also add it to RequestMigrations::setMigrations($migrations, $currentVersion). (open to some input here)
ExampleMiddleware.php
ResponseMigrations::setMigrations(config('request-migrations.versions.version_2'))`
config/request-migrations.php
...
'versions' => [
'version_1' => [
'YYYY-MM-DD' => [
\App\Http\Migrations\ExampleChangeFieldName::class
],
],
'version_2' => [
'YYYY-MM-DD' => [
\App\Http\Migrations\ExampleChangeFieldName::class
],
],
],
...
I've got most of this implementation done, will PR soon 🤙🏻!