"Fix" SQLite down migration

This commit is contained in:
Jordan Brown
2022-08-11 17:21:19 -04:00
parent 5f4c368a10
commit 4dcd5da7f4
@@ -28,9 +28,51 @@ namespace Tgstation.Server.Host.Database.Migrations
if (migrationBuilder == null)
throw new ArgumentNullException(nameof(migrationBuilder));
migrationBuilder.DropColumn(
name: "DumpOnHeartbeatRestart",
table: "DreamDaemonSettings");
migrationBuilder.RenameTable(
name: "DreamDaemonSettings",
newName: "DreamDaemonSettings_down");
migrationBuilder.CreateTable(
name: "DreamDaemonSettings",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
AllowWebClient = table.Column<bool>(nullable: false),
SecurityLevel = table.Column<int>(nullable: false),
Port = table.Column<ushort>(nullable: false),
StartupTimeout = table.Column<uint>(nullable: false),
HeartbeatSeconds = table.Column<uint>(nullable: false),
AutoStart = table.Column<bool>(nullable: false),
InstanceId = table.Column<long>(nullable: false),
TopicRequestTimeout = table.Column<uint>(nullable: false),
AdditionalParameters = table.Column<string>(maxLength: 10000, nullable: false),
Visibility = table.Column<bool>(nullable: false),
},
constraints: table =>
{
table.PrimaryKey("PK_DreamDaemonSettings", x => x.Id);
table.ForeignKey(
name: "FK_DreamDaemonSettings_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.Sql(
$"INSERT INTO DreamDaemonSettings SELECT Id,AllowWebClient,SecurityLevel,Port,AutoStart,HeartbeatSeconds,StartupTimeout,InstanceId,TopicRequestTimeout,AdditionalParameters,Visibility FROM DreamDaemonSettings_down");
migrationBuilder.DropTable(
name: "DreamDaemonSettings_down");
migrationBuilder.RenameTable(
name: "DreamDaemonSettings",
newName: "DreamDaemonSettings_down");
migrationBuilder.RenameTable(
name: "DreamDaemonSettings_down",
newName: "DreamDaemonSettings");
}
}
}