Closed mdominguez closed 2 years ago
Just so I'm clear, are you uninstalling the plugin locally, and then pushing to production, to let project config take over? Or are you uninstalling the plugin on production directly?
In either case, does the plugin uninstall correctly without errors? As in - it shows as disabled on the plugins page.
If you have allowAdminChanges
set to false
on production, you won't be able to check the plugins page, so I might recommend you turn that on temporarily so you can double check on production everything is okay.
I'm not sure what you mean by a migration error when you remove the tables manually? If the plugin is uninstalled correctly, deleting the tables shouldn't be an issue. If it is, it sounds like the plugin isn't uninstalled correctly.
Yep I'm uninstalling / installing locally, then deploying to production and let project-config sync/apply the cp nav settings I setup locally, unfortunately without the desired result...
If I check with allowAdminChanges set to false, the plugin doesn't even get activated anymore, while locally it's definitely activated...
Screenshot of the tables locally / production => screenshot
Hmm, so just to confirm, the plugin on production is correctly uninstalled? I have just tested with this normal workflow setup, and can't reproduce (tables and project config get dropped correctly). I'll continue looking into it.
I have the same issue (Craft 3.6.17, CP Nav 3.0.16). Control Panel Navigation plugin has been removed in production manually via the control panel. It no longer shows up the in the UI and is not present when querying select * from plugins.
However, the following DB tables are left behind:
I've had a lot of issues with CP Nav and the same workflow @mdominguez describes:
This flow is required, otherwise you wipe out your navigation on each deployment. My hunch is that a previous upgrade migration possibly failed?
Hmmm, I'm not sure how much more explicit I can get in the uninstall migration:
Which removed all database tables and project config data when uninstalling.
The project-config/apply
on production should run that migration. I'm not sure what's going on, as testing on a few environments (staging/local/production) this is working correctly.
Thanks for confirming though, I'll have to keep digging. All I can think of is that somewhere along the line, your project config has gotten confused (which happens to me on projects a lot and has become out of sync).
@engram-design Thanks for the reply. No clue how I got it to this state but I got it sorted.
The uninstall code was never running but because the plugin wasn't actually installing (presumably due to the tables already existing). Since this was happening via Project Config I didn't get any insight.
Composer would add the package so it'd show up in the Control Panel, but only with the INSTALL and REMOVE options. REMOVE would get rid of the code package but wasn't running your removeTables and dropProjectConfig.
The fix for me in case anybody else does something similar (back everything up of course):
# disable foreign keys so you can drop tables
SET FOREIGN_KEY_CHECKS = 0;
# drop zombie tables
DROP TABLES cpnav_layout;
DROP TABLES cpnav_navigation;
DROP TABLES cpnav_pending_navigations;
# enable foreign keys
SET FOREIGN_KEY_CHECKS = 1;
# check your work
SELECT @@GLOBAL.foreign_key_checks, @@SESSION.foreign_key_checks;
Thanks @juddlyon
Should be fixed in 4.0.0-beta.2 for Craft 4.
Description cp-nav tables on the production database don't get removed after uninstalling / removing plugin and after applying project-config changes on production. If I remove these tables manually I get a migration error so that's not an option too..
When I try to reinstall the plugin the old cp-nav tables don't get overwritten with the fresh installed ones, so if you could just help us out here what to undertake in order to remove all of the cp-nav stuff in our production database, that would be great :)
Steps to reproduce Updated from Craft 3.3 to 3.5 and the plugin 2.X to 3.X
Additional info
Additional context