mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-06-04 21:35:19 -04:00
Still apply postgres migration on startuo
This commit is contained in:
@@ -61,6 +61,20 @@ namespace Kyoo.Postgresql
|
||||
_environment = env;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Migrate the database.
|
||||
/// </summary>
|
||||
/// <param name="provider">The service list to retrieve the database context</param>
|
||||
public static void Initialize(IServiceProvider provider)
|
||||
{
|
||||
DatabaseContext context = provider.GetRequiredService<DatabaseContext>();
|
||||
context.Database.Migrate();
|
||||
|
||||
using NpgsqlConnection conn = (NpgsqlConnection)context.Database.GetDbConnection();
|
||||
conn.Open();
|
||||
conn.ReloadTypes();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Configure(IServiceCollection services)
|
||||
{
|
||||
@@ -82,16 +96,5 @@ namespace Kyoo.Postgresql
|
||||
x.EnableDetailedErrors().EnableSensitiveDataLogging();
|
||||
}, ServiceLifetime.Transient);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Initialize(IServiceProvider provider)
|
||||
{
|
||||
DatabaseContext context = provider.GetRequiredService<DatabaseContext>();
|
||||
context.Database.Migrate();
|
||||
|
||||
using NpgsqlConnection conn = (NpgsqlConnection)context.Database.GetDbConnection();
|
||||
conn.Open();
|
||||
conn.ReloadTypes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user