fix(db): 添加SQLite数据库自动创建逻辑
This commit is contained in:
@@ -41,7 +41,12 @@ public class DbContextFactory : IDbContextFactory
|
|||||||
optionsBuilder.EnableDetailedErrors();
|
optionsBuilder.EnableDetailedErrors();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return new WctMinerDbContext(optionsBuilder.Options);
|
var context = new WctMinerDbContext(optionsBuilder.Options);
|
||||||
|
|
||||||
|
// 确保数据库和表结构已创建(适用于 SQLite)
|
||||||
|
context.Database.EnsureCreated();
|
||||||
|
|
||||||
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string BuildPostgreSqlConnectionString()
|
private string BuildPostgreSqlConnectionString()
|
||||||
|
|||||||
Reference in New Issue
Block a user