Example #1
0
 /**
  * Update the database structure if needed. This function includes all
  * the incremental steps needed to bring the database up to the latest
  * standard.
  * Basically, this function is a big switch on the data version value
  * with each case falling through to the next one.
  */
 public static function updateTables($dataVersion)
 {
     switch ($dataVersion) {
         case "":
             // No data version yet - create initial table
             User::createUserTable();
             break;
         case "v0.1":
         case "v0.2":
         case "v0.3":
         case "v0.4":
         case "v0.5":
         case "v0.6":
         case "v0.7":
         case "v0.8":
         case "v0.9":
         case "v0.10":
             if (!User::addDeletedColumn()) {
                 return false;
             }
         case "v0.11":
         case "v0.12":
         case "v0.13":
             if (!User::addNotificationColumn()) {
                 return false;
             }
         case "v0.14":
         case "v0.15":
         case "v0.16":
             // current version
             break;
         default:
             // no provision for this version, should not happen
             print "User::updateTables({$dataVersion}): don't know this version.\n";
             return false;
     }
     return true;
 }