mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-08-25 01:59:36 +08:00
feat(DatabaseInitializer): add database migration logic and clean up initialization process
This commit is contained in:
@@ -38,7 +38,9 @@ public class AuthService(IDbContextFactory<MyDbContext> dbContextFactory, IConfi
|
||||
var userCount = await context.Users.CountAsync();
|
||||
if (userCount == 0)
|
||||
{
|
||||
var role = await context.Roles.FirstOrDefaultAsync(r => r.Id == 1);
|
||||
user.RoleId = 1;
|
||||
user.Role = role;
|
||||
}
|
||||
context.Users.Add(user);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
Reference in New Issue
Block a user