Works for me

This commit is contained in:
Kwoth 2016-10-12 01:34:35 +02:00
parent e3b087415d
commit 373e4c0ad9

View File

@ -37,7 +37,7 @@ namespace NadekoBot.Modules.Administration
[OwnerOnly] [OwnerOnly]
public async Task MigrateData(IUserMessage umsg) public async Task MigrateData(IUserMessage umsg)
{ {
var channel = (ITextChannel) umsg.Channel; var channel = (ITextChannel)umsg.Channel;
var version = 0; var version = 0;
using (var uow = DbHandler.UnitOfWork()) using (var uow = DbHandler.UnitOfWork())
@ -88,7 +88,7 @@ namespace NadekoBot.Modules.Administration
com.CommandText = "SELECT * FROM Announcement"; com.CommandText = "SELECT * FROM Announcement";
var reader = com.ExecuteReader(); var reader = com.ExecuteReader();
while(reader.Read()) while (reader.Read())
{ {
var gid = (ulong)reader["ServerId"]; var gid = (ulong)reader["ServerId"];
var greet = (bool)reader["Greet"]; var greet = (bool)reader["Greet"];
@ -99,7 +99,7 @@ namespace NadekoBot.Modules.Administration
var byeDM = (bool)reader["ByePM"]; var byeDM = (bool)reader["ByePM"];
var byeChannel = (ulong)reader["ByeChannelId"]; var byeChannel = (ulong)reader["ByeChannelId"];
var byeMsg = (string)reader["ByeText"]; var byeMsg = (string)reader["ByeText"];
bool grdel = (bool)reader["DeleteGreetMessages"]; bool grdel = (bool)reader["DeleteGreetMessages"];
var byedel = grdel; var byedel = grdel;
var gc = uow.GuildConfigs.For(gid); var gc = uow.GuildConfigs.For(gid);
@ -118,7 +118,7 @@ namespace NadekoBot.Modules.Administration
} }
var com2 = db.CreateCommand(); var com2 = db.CreateCommand();
com.CommandText = "SELECT * FROM Announcement"; com.CommandText = "SELECT * FROM CurrencyState";
var reader2 = com.ExecuteReader(); var reader2 = com.ExecuteReader();
while (reader2.Read()) while (reader2.Read())
@ -130,6 +130,7 @@ namespace NadekoBot.Modules.Administration
}); });
} }
db.Close(); db.Close();
try { File.Move("data/nadekobot.sqlite", "data/DELETE_ME_nadekobot.sqlite"); } catch { }
} }
private void MigrateServerSpecificConfigs0_9(IUnitOfWork uow) private void MigrateServerSpecificConfigs0_9(IUnitOfWork uow)