This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
namespace LiteCharms.Infrastructure.Database;
|
||||
|
||||
public class LeadGeneratorDbContextFactory : IDesignTimeDbContextFactory<LeadGeneratorDbContext>
|
||||
{
|
||||
public LeadGeneratorDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddUserSecrets(typeof(LeadGeneratorDbContext).Assembly)
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddEnvironmentVariables()
|
||||
.Build();
|
||||
|
||||
var optionsBuilder = new DbContextOptionsBuilder<LeadGeneratorDbContext>();
|
||||
optionsBuilder.UseNpgsql(configuration.GetConnectionString("PostgresLeadGenerator"));
|
||||
|
||||
return new LeadGeneratorDbContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260502231708_Init")]
|
||||
partial class Init
|
||||
{
|
||||
|
||||
Generated
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260503002123_DefinedEntityRelationships")]
|
||||
partial class DefinedEntityRelationships
|
||||
{
|
||||
|
||||
Generated
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260503003624_RemovedLeadIdFromLead")]
|
||||
partial class RemovedLeadIdFromLead
|
||||
{
|
||||
|
||||
Generated
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260503012708_AddedStatusToLead")]
|
||||
partial class AddedStatusToLead
|
||||
{
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260503133855_CorrectedAttributionHashColumnOnLead")]
|
||||
partial class CorrectedAttributionHashColumnOnLead
|
||||
{
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260505120450_GeneralisedLead")]
|
||||
partial class GeneralisedLead
|
||||
{
|
||||
|
||||
Generated
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260505123745_AddedNotifications")]
|
||||
partial class AddedNotifications
|
||||
{
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260505124135_AddedProcessedColumnToNotifications")]
|
||||
partial class AddedProcessedColumnToNotifications
|
||||
{
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260505202859_AddedQuoteShoppingCartalteredOrderCustomer")]
|
||||
partial class AddedQuoteShoppingCartalteredOrderCustomer
|
||||
{
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
partial class LeadGeneratorDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database;
|
||||
|
||||
public class LeadGeneratorDbContext(DbContextOptions<LeadGeneratorDbContext> options) : DbContext(options)
|
||||
public class ShopDbContext(DbContextOptions<ShopDbContext> options) : DbContext(options)
|
||||
{
|
||||
public DbSet<Customer> Customers { get; set; }
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace LiteCharms.Infrastructure.Database;
|
||||
|
||||
public class ShopDbContextFactory : IDesignTimeDbContextFactory<ShopDbContext>
|
||||
{
|
||||
public ShopDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddUserSecrets(typeof(ShopDbContext).Assembly)
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddEnvironmentVariables()
|
||||
.Build();
|
||||
|
||||
var optionsBuilder = new DbContextOptionsBuilder<ShopDbContext>();
|
||||
optionsBuilder.UseNpgsql(configuration.GetConnectionString("PostgresShop"));
|
||||
|
||||
return new ShopDbContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public class PostgresHealthCheck(IConfiguration configuration) : IHealthCheck
|
||||
{
|
||||
private readonly string connectionString = configuration.GetConnectionString("PostgresLeadGenerator")!;
|
||||
private readonly string connectionString = configuration.GetConnectionString("PostgresShop")!;
|
||||
|
||||
public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user