Closed nemerle closed 9 years ago
Query - We have a function called create_default_database in the database_functions.c module, who's purpose is to create a default database structure at outset. Could this be replaced by an upgrade script ?
Query - How would we supply the upgrade script to the server, ie would it be a plain text file or some other means ?
ad 1. Yes, adding db_version to GAME_DATA_TABLE makes perfect sense ad 4. Assuming we do upgrades using properly registered in-server functions, ordering should be auto-magical :smile:
ad Query 1: Yup, just leave it in it as-is, and after running it, just run the whole upgrade process ad Query 2: Simplest approach, add db_version_upgrades.c to the project, and store each upgrade snippet as a standalone function.
Expanding answer to Query 2 : Having those upgrade procedures as a plain old 'c' functions instead of standalone SQL files, will allow for some pretty decent error checking and performing complex operations on existing database.
As an example: if we find the need to move few columns from one of the tables to another, using 'c' function would allow us to perform the necessary steps to preserve the existing data. In case we need to 'split' existing data ( like say supporting two different eye colors per-character ), we can transform existing data appropriately ( like copying existing eye-color, into eye-color-left, eye-color-right )
Sounds good to me :+1: Lets do it
Proposed approach: