Bukkit persistence migrations

Discussion in 'Plugin Development' started by bluej100, Aug 21, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    bluej100

    Those of you who use Bukkit's built-in database system, how have you handled schema migrations across plugin versions? JavaPlugin.installDDL() is an awesome way to get started, but it seems like after that, you're on your own, and the HomeBukkit example would suggest that users have to delete their database if you ever make a change.

    How have you guys protected user data across schema changes? Have any of you used a Hibernate migration tool like Flyway?

    Would it be useful for me to try to build a JavaPlugin.updateDDL which added any missing tables and columns?
     
  2. Offline

    Jake6177

    I haven't personally needed to do this, but I've seen code that does this.

    Basically, keep the database version documented then check if the installed database version is equal to the current version on start. If not, run a method that checks what's missing and adds it (like you said there in your last sentence.)

    Now I'm sure there are more elegant ways to this, like using Flyway and I totally encourage you to try it out. If you do, let us know how it goes. :)
     
    bluej100 likes this.
  3. Offline

    bluej100

    Thanks for sharing your experience. :)
     
Thread Status:
Not open for further replies.

Share This Page