request-migrations icon indicating copy to clipboard operation
request-migrations copied to clipboard

Support for Overriding Versions

Open sixlive opened this issue 8 years ago • 1 comments

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
        ],
    ],
],
...

sixlive avatar Aug 31 '17 14:08 sixlive

I've got most of this implementation done, will PR soon 🤙🏻!

sixlive avatar Sep 06 '17 13:09 sixlive