If announcement table can't be found, migration will skip it
This commit is contained in:
parent
3d71e550ce
commit
e4bcb5a713
@ -89,10 +89,12 @@ namespace NadekoBot.Modules.Administration
|
||||
db.Open();
|
||||
|
||||
var com = db.CreateCommand();
|
||||
var i = 0;
|
||||
try
|
||||
{
|
||||
com.CommandText = "SELECT * FROM Announcement";
|
||||
|
||||
var reader = com.ExecuteReader();
|
||||
var i = 0;
|
||||
while (reader.Read())
|
||||
{
|
||||
var gid = (ulong)(long)reader["ServerId"];
|
||||
@ -122,11 +124,16 @@ namespace NadekoBot.Modules.Administration
|
||||
gc.AutoDeleteGreetMessagesTimer = gc.AutoDeleteByeMessagesTimer = grdel ? 30 : 0;
|
||||
_log.Info(++i);
|
||||
}
|
||||
|
||||
}
|
||||
catch {
|
||||
_log.Warn("Greet/bye messages won't be migrated");
|
||||
}
|
||||
var com2 = db.CreateCommand();
|
||||
com.CommandText = "SELECT * FROM CurrencyState GROUP BY UserId";
|
||||
|
||||
i = 0;
|
||||
try
|
||||
{
|
||||
var reader2 = com.ExecuteReader();
|
||||
while (reader2.Read())
|
||||
{
|
||||
@ -138,6 +145,11 @@ namespace NadekoBot.Modules.Administration
|
||||
};
|
||||
uow.Currency.Add(curr);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
_log.Warn("Currency won't be migrated");
|
||||
}
|
||||
db.Close();
|
||||
try { File.Move("data/nadekobot.sqlite", "data/DELETE_ME_nadekobot.sqlite"); } catch { }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user