wiki:Upgrade_Database

Version 2 (modified by Pan Luo, 14 years ago) ( diff )

--

This page describes the steps for developer to change the database structure and creating the upgrade files.

When user installed a new version of iPeer, in which the database structures changed, user will be notified to run the upgrade script to upgrade database.

To do a database upgrade, please follow the steps below:

  • Make the database changes and do the development. Remember the changes.
  • Create a file under app/config/sql, name it as delta_#.sql, where # is the next database version. To find out the current version, check the line "define('DATABASE_VERSION', #);" in app/config/core.php. The next version will be current version +1.
  • Copy the SQL statements for changing the database in to delta file.
  • Change the database version in app/config/core.php from:
    define('DATABASE_VERSION', #);
    
    To
    define('DATABASE_VERSION', #+1);
    
    Replace "#+1" with the real number
  • Change the database version (#) in line
    (19, 'database.version', '#', 'I', 'database version', 'A', 0, NOW(), NULL , NOW());
    
    in app/config/sql/ipeer.sql to current version (#+1)
  • Done
Note: See TracWiki for help on using the wiki.