Add simple migration script

This commit is contained in:
runebaas 2018-05-11 00:36:29 +02:00
parent 9ecc224ae1
commit 32ae82ca8d
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
6 changed files with 341 additions and 12 deletions

View file

@ -33,6 +33,24 @@ namespace Geekbot.net.Commands.Admin
_database = database;
}
[Command("migrate", RunMode = RunMode.Async)]
public async Task Migrate()
{
await ReplyAsync("starting migration");
try
{
var redisMigration = new RedisMigration(_database, _redis, _logger, _client);
await redisMigration.Migrate();
}
catch (Exception e)
{
_errorHandler.HandleCommandException(e, Context);
}
await ReplyAsync("done");
}
[Command("youtubekey", RunMode = RunMode.Async)]
[Remarks(CommandCategories.Admin)]
[Summary("Set the youtube api key")]
@ -90,8 +108,14 @@ namespace Geekbot.net.Commands.Admin
[Summary("Throw an error un purpose")]
public void PurposefulError()
{
var e = new Exception("Error Generated by !owner error");
_errorHandler.HandleCommandException(e, Context);
try
{
throw new Exception("Error Generated by !owner error");
}
catch (Exception e)
{
_errorHandler.HandleCommandException(e, Context);
}
}
}
}