HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How to remove a table column in vanilla
rloyola
New
Hi
I have a plugin that adds column in a table, how do I remove it when the plugin is disabled
Thanks
0
Comments
Look in here for some really nice things
\applications\vanilla\settings\structure.php
I am guessing it goes like this... emphasis on
set($Explicit, $Drop);
I did not test it because I did not want to blow up anything :)
I would probably never use this self cleanup method in a private or public plugin just because...
I go to the DB directly and do it manually.
Normally you do not do that. A recommended way of updating a Vanilla installation is to disable all plugins. If plugins would delete data connected to them when disabled, the data could get lost. It's not the expected behaviour that columns are deleted automatically.
Okay, I think it has been long enough to be counted as a dramatic pause and it may be clear now why I think it shouldn't be done automatically. But if you need to delete a column, there is a way:
You might want to include an option in the plugin settings to clear all traces of this plugin and deactivate it at the end of the process and thus create a custom way to disable your plugin which informs/warns you about the consequences. In such a context you might need the code above.
My experimental plugin need this in the development environment, Thanks!