Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Extension database tables - creation and deletion
Is there a best practice or de facto standard by which extensions should add database tables? I am preparing an extension for release and want to make it as clean as possible, including this step. Right now, I have a .sql file that would be bundled with it, along with instructions to pipe the file into a mysql client. If there is a better way, I'm all ears.
Also, I don't suppose there is any delegate or other way for an extension to perform actions when it is removed, such as dropping tables that only exist for its benefit. If there is, let me know that, too.
I'm excited about releasing my first extension here. Thanks for the help! :)
0
This discussion has been closed.
Comments
The usual way handle new table setup is with something like this at the beginning of your default.php:
if ( !isset($Configuration['MYEXTENSION_VERSION']) ) { ... create tables, define default settings, etc... AddConfigurationSetting($Context, 'MYEXTENSION_VERSION'); }
As for removing it, put some instructions for manual removal into your README. That way anyone who is truly concerned about cleanup has the info to take care of it themselves.