Fix database errors on first startup
This commit is contained in:
parent
64b633e6b4
commit
66eb012e4a
@ -57,6 +57,11 @@ namespace PluralKit {
|
|||||||
_logger.Information("Current schema version is {CurrentVersion}, applying migration {MigrationId}", currentVersion, migrationId);
|
_logger.Information("Current schema version is {CurrentVersion}, applying migration {MigrationId}", currentVersion, migrationId);
|
||||||
await conn.ExecuteAsync(migrationQuery, transaction: tx);
|
await conn.ExecuteAsync(migrationQuery, transaction: tx);
|
||||||
tx.Commit();
|
tx.Commit();
|
||||||
|
|
||||||
|
// If the above migration creates new enum/composite types, we must tell Npgsql to reload the internal type caches
|
||||||
|
// This will propagate to every other connection as well, since it marks the global type mapper collection dirty.
|
||||||
|
// TODO: find a way to get around the cast to our internal tracker wrapper... this could break if that ever changes
|
||||||
|
((PerformanceTrackingConnection) conn)._impl.ReloadTypes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -451,7 +451,7 @@ namespace PluralKit
|
|||||||
public class PerformanceTrackingConnection: IDbConnection
|
public class PerformanceTrackingConnection: IDbConnection
|
||||||
{
|
{
|
||||||
// Simple delegation of everything.
|
// Simple delegation of everything.
|
||||||
private NpgsqlConnection _impl;
|
internal NpgsqlConnection _impl;
|
||||||
|
|
||||||
private DbConnectionCountHolder _countHolder;
|
private DbConnectionCountHolder _countHolder;
|
||||||
private ILogger _logger;
|
private ILogger _logger;
|
||||||
|
Loading…
Reference in New Issue
Block a user