Add system and member privacy support

This commit is contained in:
Ske 2020-01-11 16:49:20 +01:00
parent f0cc5c5961
commit 98613c4287
17 changed files with 317 additions and 59 deletions

View file

@ -1,5 +1,4 @@
using System;
using System.Data;
using System.IO;
using System.Threading.Tasks;
using Dapper;
@ -11,7 +10,7 @@ using Serilog;
namespace PluralKit {
public class SchemaService
{
private const int TargetSchemaVersion = 1;
private const int TargetSchemaVersion = 2;
private DbConnectionFactory _conn;
private ILogger _logger;
@ -22,6 +21,13 @@ namespace PluralKit {
_logger = logger.ForContext<SchemaService>();
}
public static void Initialize()
{
// Without these it'll still *work* but break at the first launch + probably cause other small issues
NpgsqlConnection.GlobalTypeMapper.MapComposite<ProxyTag>("proxy_tag");
NpgsqlConnection.GlobalTypeMapper.MapEnum<PrivacyLevel>("privacy_level");
}
public async Task ApplyMigrations()
{
for (var version = 0; version <= TargetSchemaVersion; version++)