mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-29 16:11:05 +01:00
Add DropDatabase configuration setting
God help me...
This commit is contained in:
@@ -29,5 +29,10 @@
|
||||
/// If the database should use direct table creation instead of automatic migrations. Should not be used in production!
|
||||
/// </summary>
|
||||
public bool NoMigrations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the database should be deleted on application startup. Should not be used in production!
|
||||
/// </summary>
|
||||
public bool DropDatabase { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +140,12 @@ namespace Tgstation.Server.Host.Models
|
||||
{
|
||||
Logger.LogInformation("Migrating database...");
|
||||
|
||||
if (databaseConfiguration.DropDatabase)
|
||||
{
|
||||
Logger.LogCritical("DropDatabase configuration option set! Dropping any existing database...");
|
||||
await Database.EnsureDeletedAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
var wasEmpty = false;
|
||||
if (databaseConfiguration.NoMigrations)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
},
|
||||
"Database": {
|
||||
"NoMigrations": false,
|
||||
"DropDatabase": false,
|
||||
"DatabaseType": "SqlServer",
|
||||
"ResetAdminPassword": false,
|
||||
"ConnectionString": "Data Source=(local);Initial Catalog=TGS;Integrated Security=True"
|
||||
|
||||
Reference in New Issue
Block a user