Signature ingestor database update is now a background task (#121)
* Updated background task code to support options and self clearing * Moved background safe database upgrade code to a background task
This commit is contained in:
@@ -5,26 +5,43 @@ namespace gaseous_tools
|
||||
{
|
||||
public static class DatabaseMigration
|
||||
{
|
||||
public static void PreUpgradeScript(int TargetSchemaVersion, gaseous_tools.Database.databaseType? DatabaseType) {
|
||||
public static List<int> BackgroundUpgradeTargetSchemaVersions = new List<int>();
|
||||
|
||||
public static void PreUpgradeScript(int TargetSchemaVersion, gaseous_tools.Database.databaseType? DatabaseType)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void PostUpgradeScript(int TargetSchemaVersion, gaseous_tools.Database.databaseType? DatabaseType) {
|
||||
public static void PostUpgradeScript(int TargetSchemaVersion, gaseous_tools.Database.databaseType? DatabaseType)
|
||||
{
|
||||
switch(DatabaseType)
|
||||
{
|
||||
case gaseous_tools.Database.databaseType.MySql:
|
||||
case Database.databaseType.MySql:
|
||||
switch (TargetSchemaVersion)
|
||||
{
|
||||
case 1002:
|
||||
MySql_1002_MigrateMetadataVersion();
|
||||
// this is a safe background task
|
||||
BackgroundUpgradeTargetSchemaVersions.Add(1002);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void MySql_1002_MigrateMetadataVersion() {
|
||||
public static void UpgradeScriptBackgroundTasks()
|
||||
{
|
||||
foreach (int TargetSchemaVersion in BackgroundUpgradeTargetSchemaVersions)
|
||||
{
|
||||
switch (TargetSchemaVersion)
|
||||
{
|
||||
case 1002:
|
||||
MySql_1002_MigrateMetadataVersion();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void MySql_1002_MigrateMetadataVersion() {
|
||||
Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||
string sql = "";
|
||||
Dictionary<string, object> dbDict = new Dictionary<string, object>();
|
||||
|
Reference in New Issue
Block a user