Refactored database references
continuous-integration/drone/pr Build is passing

This commit is contained in:
Khwezi Mngoma
2026-05-09 16:58:34 +02:00
parent 6db6228bc9
commit ff34326a53
55 changed files with 73 additions and 73 deletions
@@ -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);
}
}
@@ -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
{
@@ -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
{
@@ -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
{
@@ -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
{
@@ -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
{
@@ -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
{
@@ -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
{
@@ -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
{
@@ -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
{
@@ -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)
@@ -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)
{