1

I have a custom plugin which is added via path repository on local. I have some migrations in the src folder.

My problem is if I uninstall the plugin and install it again, I can see all of the migrations in the migration table, but only Install migration is applied.

If I change the version and schema version of the plugin and remove and require the plugin again, I get update plugin notification on the dashboard and all of the migrations are applied correctly.

also if i create and apply these migrations via command i can see change in databases.

i don't why migrations aren't applied on plugin install -except Install migration-?

1

It sounds like it's working as expected.

When you add a new migration for your plugin, you're expected to update your plugin's Install.php migration with the new schema changes as well.

You can see the relevant code here: https://github.com/craftcms/cms/blob/develop/src/base/Plugin.php#L149-L161

|improve this answer|||||
  • thanks. so when we change database schema, we have to create a separate migration for current installations and update install.php for new installations? what is the point of this special install.php migration anyway? – user677900 Sep 14 '19 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.