Jump to content

Auto SQL update  

24 members have voted

You do not have permission to vote in this poll, or see the poll results. Please sign in or register to vote in this poll.

Recommended Posts

Posted

I would like to suggest the addition of an auto update system for sql db updates, like:

  • We start with db_version 0
  • Something got modified in db so instead of devs adding a new .sql upgrade file (that noobs don't know a sh*t about, look at support and bugtracker for "favorite") they would add it to source and it would execute on server start and would change db_version to 1
  • etc etc
  • etc etc etc
  • for those who knows a bit about coding, take a look at this as example, it is from opentibia emulator
  • feel free to flame this thread, I don't care :P

It was just something that passed into my head after seeing all that topic/bugreports every time that a .sql upgrade goes out, it would be really nice IMO to have it implemented! but lets elaborate and give your point also (you guys are negative but whatever xD)

  • Upvote 1
Posted

this will cause problems for any custom modifications done in the db or the server...better this things be how it is...or a new addon to just add sql to db..like the map cache will do I guess...

Posted

I think it is possible to create an optional step: importing the whole item_db.txt or item_db.sql to sql at startup. But I don't really see the point in of this feature.

What would be more useful, and still possible to implement is: to create a post commit hook, that monitors for db changes, and if item_db or mob_db changes, do automatic conversion, and a commit. This way the sql files would be 100% percent up to date all time.

Posted

Yeah, as far as I can see, it would definitely involve giving the database some kind of version.

After that, there are 2 options:

* Hardcoded updates on startup

* Execute formatted .sql files from a folder on startup.

One must be able to disable this feature though, because it is a security hole, and you need to set less strict premissions to your server's mysql user. ( however I guess most user do not bother much with permission anyways )

  • Upvote 1
Posted

I would rather prefer, that the rAthena SVN version is merged into a file and this file is checked on startup and if there is a sql update file for that revision the server(s) should tell you at startup that you have to run these.

That would require to save two values though:

the last revision that was used

the current revision

So it can tell you all of the updates that have to be done to the database. But I would not run it automatically since you can never know if someone changes his database and these changes contradict to the newest updates.

Posted

Then we would have to give privileges to alter tables to the MySQL account used by the server =(

The database itself could have a row somewhere telling its version, and then when a dev changed the tables in a way that they would have to be updated using upgrade_rXXXXX.sql, he would also increment a constant, let's say, MIN_SQL_DB_VERSION, in mmo.h. The upgrade_rXXXXX.sql file would also change the version number. Then, whenever a server started, it would compare the database's version with MIN_SQL_DB_VERSION and it would print a message saying that the tables were changed and that they have to be updated manually.

  • 2 weeks later...
Posted

It is true, the server's sql account should remain at minimal privilege, it is not its task to update SQL table, but to display a warning on start-up is a good idea though.

  • Upvote 2

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...