Fix review findings: scrub committed password, restore migration namespace, document Npgsql version constraint
This commit is contained in:
@@ -7,9 +7,16 @@ public class DeepDrftContextFactory : IDesignTimeDbContextFactory<DeepDrftContex
|
||||
{
|
||||
public DeepDrftContext CreateDbContext(string[] args)
|
||||
{
|
||||
// For 'dotnet ef' commands, set ConnectionStrings__DefaultConnection in your environment.
|
||||
// Example: export ConnectionStrings__DefaultConnection="Host=localhost;Database=deepdrft_dev;Username=postgres;Password=yourpassword"
|
||||
var connectionString = Environment.GetEnvironmentVariable("ConnectionStrings__DefaultConnection")
|
||||
?? throw new InvalidOperationException(
|
||||
"Set ConnectionStrings__DefaultConnection environment variable to run dotnet ef commands. " +
|
||||
"Example: Host=localhost;Database=deepdrft_dev;Username=postgres;Password=yourpassword");
|
||||
|
||||
var optionsBuilder = new DbContextOptionsBuilder<DeepDrftContext>();
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Database=deepdrft_dev;Username=postgres;Password=postgres");
|
||||
|
||||
optionsBuilder.UseNpgsql(connectionString);
|
||||
|
||||
return new DeepDrftContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<!-- Npgsql 10.0.1 requires Microsoft.EntityFrameworkCore >= 10.0.4; keep in sync -->
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DeepDrftWeb.Services.Migrations
|
||||
namespace DeepDrftWeb.Migrations
|
||||
{
|
||||
[DbContext(typeof(DeepDrftContext))]
|
||||
[Migration("20260518025102_Initial")]
|
||||
|
||||
@@ -4,7 +4,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DeepDrftWeb.Services.Migrations
|
||||
namespace DeepDrftWeb.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
|
||||
@@ -8,7 +8,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DeepDrftWeb.Services.Migrations
|
||||
namespace DeepDrftWeb.Migrations
|
||||
{
|
||||
[DbContext(typeof(DeepDrftContext))]
|
||||
partial class DeepDrftContextModelSnapshot : ModelSnapshot
|
||||
|
||||
Reference in New Issue
Block a user