function migrate() { #---------------------------------------------------------------------- #--- Leave if we've done this migration already. if (!databaseTableExists('ResultsStatus')) { noticeBox(false, "You need to apply migation 1 first."); return; } #--- Leave if we are already up-to-date $number = dbQuery("\n SELECT value FROM ResultsStatus\n WHERE id = 'migration'\n "); $number = $number[0]['value']; if ($number != '4') { noticeBox(false, "Wrong version number : " . $number . ". Must be 4"); return; } #--- ResultsStatus table: Update migration number. reportAction("ResultsStatus", "Set migration number to 5"); dbCommand("\n UPDATE ResultsStatus\n SET value = '5'\n WHERE id = 'migration'\n "); #--- Apply the migration changes. alterTableCompetitions(); alterTableCountries(); alterTableContinents(); #--- Yippie, we did it! noticeBox(true, "Migration completed."); }
function migrate() { #---------------------------------------------------------------------- #--- Leave if we've done this migration already. if (databaseTableExists('ResultsStatus')) { noticeBox(false, "This migration has already been applied."); return; } #--- ResultsStatus table: Create it. reportAction("ResultsStatus", "Create"); dbCommand("\n CREATE TABLE ResultsStatus (\n id VARCHAR(50) NOT NULL,\n value VARCHAR(50) NOT NULL\n )\n "); #--- ResultsStatus table: Set migration number. reportAction("ResultsStatus", "Set migration number to 1"); dbCommand("INSERT INTO ResultsStatus (id, value) VALUES ('migration', '1')"); #--- Apply the migration changes. alterTableCompetitions(); #--- Yippie, we did it! noticeBox(true, "Migration completed."); }