diff --git a/src/modules/im/Infrastructure/IM.Infrastructure.csproj b/src/modules/im/Infrastructure/IM.Infrastructure.csproj
index 5a7dbf6..cef3259 100644
--- a/src/modules/im/Infrastructure/IM.Infrastructure.csproj
+++ b/src/modules/im/Infrastructure/IM.Infrastructure.csproj
@@ -7,6 +7,7 @@
+
@@ -14,7 +15,7 @@
all
-
+
diff --git a/src/modules/workflow/Infrastructure/Persistence/WorkflowDbContextDesignTimeFactory.cs b/src/modules/workflow/Infrastructure/Persistence/WorkflowDbContextDesignTimeFactory.cs
index 246e6ca..29072e6 100644
--- a/src/modules/workflow/Infrastructure/Persistence/WorkflowDbContextDesignTimeFactory.cs
+++ b/src/modules/workflow/Infrastructure/Persistence/WorkflowDbContextDesignTimeFactory.cs
@@ -1,39 +1,17 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
-using Microsoft.Extensions.Configuration;
namespace Workflow.Infrastructure.Persistence;
-///
-/// EF Core 设计时工厂,供 dotnet ef migrations 命令使用。
-/// 关键:必须启用 UseSnakeCaseNamingConvention(与运行时一致),否则迁移会用 PascalCase 列名。
-///
+/// EF Core 设计时工厂。硬编码连接串,不依赖 appsettings 路径。
public class WorkflowDbContextDesignTimeFactory : IDesignTimeDbContextFactory
{
public WorkflowDbContext CreateDbContext(string[] args)
{
- // 向上查找 Api 项目的 appsettings.json(兼容不同工作目录)
- var basePath = Path.Combine(Directory.GetCurrentDirectory(), "..", "Workflow.Api");
- if (!Directory.Exists(basePath))
- {
- // 如果从 Infrastructure 目录运行,尝试另一种路径
- basePath = Path.Combine(Directory.GetCurrentDirectory(), "..", "Api");
- }
-
- var config = new ConfigurationBuilder()
- .SetBasePath(basePath)
- .AddJsonFile("appsettings.json", optional: true)
- .Build();
-
- var connectionString = config.GetConnectionString("Default")
- ?? config.GetConnectionString("Workflow")
- ?? "Host=localhost;Port=5432;Database=workflow;Username=rag;Password=REDACTED_DEV_PASSWORD";
-
var options = new DbContextOptionsBuilder()
- .UseNpgsql(connectionString)
+ .UseNpgsql("Host=localhost;Port=15432;Database=workflow;Username=rag;Password=dev")
.UseSnakeCaseNamingConvention()
.Options;
-
return new WorkflowDbContext(options);
}
}