-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add-on with inverse relationships uninstall creates a problem when dropping the table #1901
Comments
Here's an example fieldtype that I made to demonstrate: https://github.com/gb-lin/Example-Fieldtype/ |
Looking at associated EE code, I see that the module is getting uninstalled prior to the fieldtype. Which might be what is expected - if the fieldtype is using custom table, it probably should exists when fieldtype is getting removed. So maybe you need to have |
Hey @intoeetive I actually tried putting the drop_table sequence in the |
to have the fieldtype dropped before dropping the related model fixes #1901 EECORE-1741
@gb-lin unfortunately the "fix" we made was not right. We have to revert it because it causes issues with other add-ons. Re-opening the issue until we get better fix for add-ons that use the (almost not documented) |
…l-revert Revert "Resolved #1901 where add-ons with related models were not properly uninstalled"
Working on a custom add-on (fieldtype and extension and module) here and I have a model with inverse relationships to ChannelEntry and ChannelField. When I uninstall, I'm also dropping the custom table that the model saves to. However, I tired putting the drop table sequence in the ft. and the upd. and both places will result in SQLSTATE[42S02]: Base table or view not found: 1146 Table 'playground.exp_gb_gated_content_keys' doesn't exist. From the trace I can see that it's the
uninstallFieldtype()
method that's calling for the deletion of the fieldtype which will trigger the deletion of the related custom model's rows. But somehow that's happening after the table is dropped. What is the last sequence that runs that I can use to delete my custom table? I also tried usingweak
in the model and it doesn't work.#0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(112): CI_DB_mysqli_connection->query()
#1 ee/legacy/database/DB_driver.php(260): CI_DB_mysqli_driver->_execute()
#2 ee/legacy/database/DB_driver.php(175): CI_DB_driver->simple_query()
#3 ee/legacy/database/DB_active_rec.php(1076): CI_DB_driver->query()
#4 ee/ExpressionEngine/Service/Model/Query/Select.php(51): CI_DB_active_record->get()
#5 ee/ExpressionEngine/Service/Model/DataStore.php(275): ExpressionEngine\Service\Model\Query\Select->run()
#6 ee/ExpressionEngine/Service/Model/DataStore.php(220): ExpressionEngine\Service\Model\DataStore->runQuery()
#7 ee/ExpressionEngine/Service/Model/Query/Builder.php(138): ExpressionEngine\Service\Model\DataStore->selectQuery()
#8 ee/ExpressionEngine/Service/Model/Query/Builder.php(63): ExpressionEngine\Service\Model\Query\Builder->fetch()
#9 ee/ExpressionEngine/Service/Model/Query/Delete.php(352): ExpressionEngine\Service\Model\Query\Builder->all()
#10 ee/ExpressionEngine/Service/Model/Query/Delete.php(67): ExpressionEngine\Service\Model\Query\Delete->ExpressionEngine\Service\Model\Query{closure}()
#11 ee/ExpressionEngine/Service/Model/DataStore.php(275): ExpressionEngine\Service\Model\Query\Delete->run()
#12 ee/ExpressionEngine/Service/Model/DataStore.php(250): ExpressionEngine\Service\Model\DataStore->runQuery()
#13 ee/ExpressionEngine/Service/Model/Query/Builder.php(87): ExpressionEngine\Service\Model\DataStore->deleteQuery()
#14 ee/legacy/libraries/addons/Addons_installer.php(314): ExpressionEngine\Service\Model\Query\Builder->delete()
#15 ee/legacy/libraries/addons/Addons_installer.php(51): Addons_installer->_update_addon()
#16 ee/ExpressionEngine/Controller/Addons/Addons.php(1415): Addons_installer->uninstall()
#17 ee/ExpressionEngine/Controller/Addons/Addons.php(670): ExpressionEngine\Controller\Addons\Addons->uninstallFieldtype()
#18 [internal function]: ExpressionEngine\Controller\Addons\Addons->remove()
The text was updated successfully, but these errors were encountered: