-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
A question about creating tables in database for plugins? #3258
Comments
What your OS? Plugin Manager simply remove a JAR file and reload all plugins when Uninstall button is clicked but it could fail to remove files on Windows platform. |
My previous comment answered the first part of this question. And yes for requiring manual removal of created tables and the entry in |
Yes, |
No. Tables created by plugins are not removed automatically even if plugins are uninstalled. |
@sdbbs Sorry for my late answering. I just noticed the issue today. I would close this issue as I think I answered all of your questions for now. Please raise a new issue or send a message on Gitter if you have further questions. |
I reopened the issue for visibility to plugin developers. |
I just wanted to note this, because it was difficult information for me to find - and to ask if I understand correctly.
I have an install of GitBucket 4.37.1 with H2 database. I am trying to experiment with plugins, and from https://github.com/takezoe/gitbucket-ci-plugin I realized that if you want to use
class CISystemConfigs
, a table calledCI_SYSTEM_CONFIG
needs to be created in the database - and it looks like, those databases are ultimately created by.xml
files like resources/update/gitbucket-ci_1.4.0.xml:So, I tried doing something similar in my own plugin example, and it compiled ... and no new table.
Then I found https://github.com/nodamushi/gitbucket-exprettify-plugin which uses something similar, and tried to compile it. These are the changes needed so it compiles for gitbucket 4.37.1:
Copied this to plugins/ - and new tables got immediately created!
However - then, for some reason, it is impossible to uninstall this gitbucket-exprettify-plugin from System administration/Plugins - and the Uninstall button to the right of the plugin; the plugin just stays there in the list, no matter how many times I click uninstall! And even the GitBucket log does not notice anything - it just prints this when I click Uninstall (and I also get the Info notification "gitbucket-exprettify-plugin was uninstalled." in the webpage):
So, I needed to delete gitbucket-exprettify-plugin manually; first from command line:
Then, note that for H2 database, you should not use double quotes ( https://stackoverflow.com/questions/35646432/org-h2-jdbc-jdbcsqlexception-column-salman-not-found ); knowing that, we can first manually delete (from System administration/Database viewer) the two tables gitbucket-exprettify-plugin adds:
... and then I have to delete manually the entry in table VERSIONS:
... and then, finally, t is seemingly uninstalled.
Then, I went to my plugin, and repeated this uninstall procedure - just the .jar file removal, and removal of entry from VERSIONS. Then I copied it to plugins/ again - and finally, I got my table created!
So, I was wondering:
The text was updated successfully, but these errors were encountered: