0

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.

6
  • did you try to if (version_compare($context->getVersion(), '0.0.3', '<'))? Commented Sep 5, 2017 at 9:24
  • In module.xml I have setup_version=0.0.3, in UpdateSchema I have if (version_compare($context->getVersion(), '0.0.3', '<')) and I commented all upgrade method in UpgradeData Class
    – M Taheri
    Commented Sep 5, 2017 at 10:00
  • in the UpgradeSchema change the if Commented Sep 5, 2017 at 10:01
  • Ok I changed it but UpdateSchema does not work
    – M Taheri
    Commented Sep 5, 2017 at 10:02
  • try changing to 0.0.5 everywhere and run setup:upgrade. Commented Sep 5, 2017 at 10:03

1 Answer 1

0

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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