public static void CheckAndUpgradeSchema(Session session) { DatabaseManagement dbm = new DatabaseManagement(); DatabaseInformation.SQLState state = dbm.CheckDatabase(); if (state == DatabaseInformation.SQLState.OMLDBNotFound) { //MessageBox.Show("Detected SQL Server but cannot find the database. Click OK to create the database.", "Databse problem", MessageBoxButtons.OK); // OML Instance but OML database does not exist dbm.ConfigureSQL(ScriptsPath); dbm.UpgradeSchemaVersion(ScriptsPath); // Retest the connection state = dbm.CheckDatabase(); } if (state == DatabaseInformation.SQLState.OMLDBVersionUpgradeRequired) { //MessageBox.Show("Detected the OML Database but it requires updating. Click OK to update the database.", "Databse problem", MessageBoxButtons.OK); dbm.UpgradeSchemaVersion(ScriptsPath); // Retest the connection state = dbm.CheckDatabase(); } if (state == DatabaseInformation.SQLState.OK) { //MessageBox.Show("The database appears all fine.", "Database status", MessageBoxButtons.OK); return; } }
public static void ConfigureSQL(Session session) { DatabaseManagement dbm = new DatabaseManagement(); dbm.ConfigureSQL(ScriptsPath); }