tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
20200511162912_SLRemoveSoftColumns.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.EntityFrameworkCore.Migrations;
4
6{
10 public partial class SLRemoveSoftColumns : Migration
11 {
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 ArgumentNullException.ThrowIfNull(migrationBuilder);
16
17 migrationBuilder.RenameTable(
18 name: "DreamDaemonSettings",
19 newName: "DreamDaemonSettings_up");
20
21 migrationBuilder.CreateTable(
22 name: "DreamDaemonSettings",
23 columns: table => new
24 {
25 Id = table.Column<long>(nullable: false)
26 .Annotation("Sqlite:Autoincrement", true),
27 AllowWebClient = table.Column<bool>(nullable: false),
28 SecurityLevel = table.Column<int>(nullable: false),
29 PrimaryPort = table.Column<ushort>(nullable: false),
30 SecondaryPort = table.Column<ushort>(nullable: false),
31 StartupTimeout = table.Column<uint>(nullable: false),
32 HeartbeatSeconds = table.Column<uint>(nullable: false),
33 AutoStart = table.Column<bool>(nullable: false),
34 InstanceId = table.Column<long>(nullable: false),
35 },
36 constraints: table =>
37 {
38 table.PrimaryKey("PK_DreamDaemonSettings", x => x.Id);
39 table.ForeignKey(
40 name: "FK_DreamDaemonSettings_Instances_InstanceId",
41 column: x => x.InstanceId,
42 principalTable: "Instances",
43 principalColumn: "Id",
44 onDelete: ReferentialAction.Cascade);
45 });
46
47 migrationBuilder.Sql(
48 $"INSERT INTO DreamDaemonSettings SELECT Id,AllowWebClient,SecurityLevel,PrimaryPort,SecondaryPort,AutoStart,HeartbeatSeconds,StartupTimeout,InstanceId FROM DreamDaemonSettings_up");
49
50 migrationBuilder.DropTable(
51 name: "DreamDaemonSettings_up");
52 }
53
55 protected override void Down(MigrationBuilder migrationBuilder)
56 {
57 ArgumentNullException.ThrowIfNull(migrationBuilder);
58
59 migrationBuilder.AddColumn<string>(
60 name: "AccessToken",
61 table: "DreamDaemonSettings",
62 nullable: true);
63
64 migrationBuilder.AddColumn<int>(
65 name: "ProcessId",
66 table: "DreamDaemonSettings",
67 nullable: true);
68
69 migrationBuilder.AddColumn<bool>(
70 name: "SoftRestart",
71 table: "DreamDaemonSettings",
72 nullable: false,
73 defaultValue: false);
74
75 migrationBuilder.AddColumn<bool>(
76 name: "SoftShutdown",
77 table: "DreamDaemonSettings",
78 nullable: false,
79 defaultValue: false);
80 }
81 }
82}