I have written a small module and I've made Setup classes include InstallData, InstallSchema, UpgradeData, and UpgradeSchema and put them in Setup folder, For the first time I did run setup:upgrade command everything was ok.

A table created and some data inserted. But then I tried to edit UpgradeSchema.php and UpgradeData.php to change table schema and data, but nothing happened.

I also changed module.xml and increase setup_version to 0.0.3 or 0.0.4, but it didn't work!

I commented the "if (version_compare($context->getVersion(), '0.0.2', '<'))" condition, but nothing changed after setup:upgrade again!

Please help me what to do.

有帮助吗?

解决方案

I changed module.xml setup_version to 0.0.5 in UpgradeSchema.php

I changed the if clause

if (version_compare($context->getVersion(), '0.0.5', '<'))

And in setup_module table schema_version in 0.0.1. should I change the table?

许可以下: CC-BY-SA归因
scroll top