Skip to content

Commit

Permalink
Added migration to startup (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
csharpfritz authored Aug 31, 2023
1 parent ecbe0b9 commit e80a2b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 52 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/TagzApp.yml

This file was deleted.

6 changes: 6 additions & 0 deletions src/TagzApp.Storage.Postgres/AppExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace Microsoft.Extensions.DependencyInjection;
public static class AppExtensions
{

private static Task _MigrateTask = Task.CompletedTask;

public static IServiceCollection AddPostgresServices(this IServiceCollection services, IConfiguration configuration)
{

Expand All @@ -21,6 +23,10 @@ public static IServiceCollection AddPostgresServices(this IServiceCollection ser

services.AddScoped<IModerationRepository, PostgresModerationRepository>();

using var builtServices = services.BuildServiceProvider();
var ctx = builtServices.GetRequiredService<TagzAppContext>();
_MigrateTask = ctx.Database.MigrateAsync();

return services;

}
Expand Down

0 comments on commit e80a2b7

Please sign in to comment.