I was writing a plugin for a client, so that we could make use of some models. I had created the migrations (I'm used to these from Laravel), and so on using
php artisan create:model etc..
Nothing I did, however, would run the migrations, until I came across a post mentioning that you had to add it to the
version.yaml file as follows:
1.0.2: - create_products_table.php
This is not explicitly stated in the documentation (and was a bit of a headache). Could I request a proper tutorial / workflow is documented on the docs site so that this stuff is clear for those who didn't develop October?
Did you miss Plugins - Registration & Versions - Migrations and version history in the docs?
Admittedly I skim read
The version.yaml file, called the Plugin version file, contains the version comments and refers to database scripts in the correct order.
but since Laravel has never needed you to actually reference migrations since it automatically finds them, I still think it could be more helpfully (and explicitly) put as a sort of workflow/use case.
Maybe this will be useful in the future, The Builder Idea, will hopefully take a lot of the mundane stuff out of building plugins. I took got stuck on this when first building plugins, not 100% sure why it's needed unless you're using the database, in which case you are, but a lot of plugins don't require DB access, so it's only needed for version purposes.
$pluginVersion variable in the
plugin.php would be a better option, then you could just use the
version.yaml file for DB migrations, and map the version number in the
YAML file to the version number in the
plugin.php, that way you won't always need the
YAML file to build a plugin - just a thought for the devs
1-4 of 4