diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index ae4489d387..351cb649ec 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -15,7 +15,6 @@ using System.IdentityModel.Tokens.Jwt; using System.Linq; using System.Reflection; using Tgstation.Server.Host.Components; -using Tgstation.Server.Host.Components.Chat; using Tgstation.Server.Host.Components.Chat.Commands; using Tgstation.Server.Host.Components.Watchdog; using Tgstation.Server.Host.Configuration; diff --git a/src/Tgstation.Server.Host/Models/DatabaseContext.cs b/src/Tgstation.Server.Host/Models/DatabaseContext.cs index e92934f70e..c75a8d9769 100644 --- a/src/Tgstation.Server.Host/Models/DatabaseContext.cs +++ b/src/Tgstation.Server.Host/Models/DatabaseContext.cs @@ -1,7 +1,9 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; using System; +#if !DEBUG using System.Linq; +#endif using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Host.Configuration; @@ -136,9 +138,14 @@ namespace Tgstation.Server.Host.Models /// public async Task Initialize(CancellationToken cancellationToken) { +#if DEBUG + await Database.EnsureCreatedAsync().ConfigureAwait(false); + var wasEmpty = (await Users.CountAsync().ConfigureAwait(false)) == 0; +#else var migrations = await Database.GetAppliedMigrationsAsync().ConfigureAwait(false); var wasEmpty = !migrations.Any(); await Database.MigrateAsync(cancellationToken).ConfigureAwait(false); +#endif if (wasEmpty) await databaseSeeder.SeedDatabase(this, cancellationToken).ConfigureAwait(false); } diff --git a/src/Tgstation.Server.Host/appsettings.json b/src/Tgstation.Server.Host/appsettings.json index f62fafa2f2..233a6dd6fa 100644 --- a/src/Tgstation.Server.Host/appsettings.json +++ b/src/Tgstation.Server.Host/appsettings.json @@ -8,6 +8,7 @@ }, "Console": { "LogLevel": { + "Microsoft.EntityFrameworkCore": "Warning", "Default": "Trace" } },