Skip to content

Commit

Permalink
Fix SQL not initializing when using migrate cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
TomGrobbe committed Mar 19, 2019
1 parent 2dfbea5 commit 4707fba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vMenuServer/BanManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class BanManager : BaseScript
{
private static bool readingOrWritingToBanFile = false;
internal static bool useJson = !vMenuShared.ConfigManager.GetSettingsBool(vMenuShared.ConfigManager.Setting.vmenu_bans_use_database);
private static string bansDbFilePath = vMenuShared.ConfigManager.GetSettingsString(vMenuShared.ConfigManager.Setting.vmenu_bans_database_filepath) ?? "";
private static readonly string bansDbFilePath = vMenuShared.ConfigManager.GetSettingsString(vMenuShared.ConfigManager.Setting.vmenu_bans_database_filepath) ?? "";
private const string bansDbFileName = "vmenu_bans.db";

/// <summary>
Expand Down Expand Up @@ -132,7 +132,6 @@ public static async Task<List<BanRecord>> GetBanList()
}
db.Close();
}

return bans;
}
}
Expand Down Expand Up @@ -809,6 +808,9 @@ public static async void MigrateBansToDatabase()
}
else
{
useJson = false;
InitializeDbConnection();
useJson = true;
var bans = await GetBanList();
Debug.WriteLine($"[vMenu] Migrating {bans.Count} bans from the bans.json file to the vmenu_bans.db database!");
AddSqlBanRange(bans, true);
Expand Down

0 comments on commit 4707fba

Please sign in to comment.