tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
20210825163612_SLAddDreamDaemonVisibility.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.EntityFrameworkCore.Migrations;
4
6{
11 {
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 ArgumentNullException.ThrowIfNull(migrationBuilder);
16
17 migrationBuilder.AddColumn<int>(
18 name: "LaunchVisibility",
19 table: "ReattachInformations",
20 nullable: false,
21 defaultValue: 0);
22
23 migrationBuilder.AddColumn<int>(
24 name: "Visibility",
25 table: "DreamDaemonSettings",
26 nullable: false,
27 defaultValue: 0);
28 }
29
31 protected override void Down(MigrationBuilder migrationBuilder)
32 {
33 ArgumentNullException.ThrowIfNull(migrationBuilder);
34
35 migrationBuilder.RenameTable(
36 name: "ReattachInformations",
37 newName: "ReattachInformations_down");
38
39 migrationBuilder.CreateTable(
40 name: "ReattachInformations",
41 columns: table => new
42 {
43 Id = table.Column<long>(nullable: false)
44 .Annotation("Sqlite:Autoincrement", true),
45 AccessIdentifier = table.Column<string>(nullable: false),
46 ProcessId = table.Column<int>(nullable: false),
47 Port = table.Column<ushort>(nullable: false),
48 RebootState = table.Column<int>(nullable: false),
49 LaunchSecurityLevel = table.Column<int>(nullable: false),
50 CompileJobId = table.Column<long>(nullable: false),
51 },
52 constraints: table =>
53 {
54 table.PrimaryKey("PK_ReattachInformations", x => x.Id);
55 table.ForeignKey(
56 name: "FK_ReattachInformations_CompileJobs_CompileJobId",
57 column: x => x.CompileJobId,
58 principalTable: "CompileJobs",
59 principalColumn: "Id",
60 onDelete: ReferentialAction.Cascade);
61 });
62
63 migrationBuilder.Sql(
64 $"INSERT INTO ReattachInformations SELECT Id,AccessIdentifier,ProcessId,Port,RebootState,LaunchSecurityLevel,CompileJobId FROM ReattachInformations_down");
65
66 migrationBuilder.DropTable(
67 name: "ReattachInformations_down");
68
69 migrationBuilder.RenameTable(
70 name: "ReattachInformations",
71 newName: "ReattachInformations_down");
72
73 migrationBuilder.RenameTable(
74 name: "ReattachInformations_down",
75 newName: "ReattachInformations");
76
77 migrationBuilder.RenameTable(
78 name: "DreamDaemonSettings",
79 newName: "DreamDaemonSettings_down");
80
81 migrationBuilder.CreateTable(
82 name: "DreamDaemonSettings",
83 columns: table => new
84 {
85 Id = table.Column<long>(nullable: false)
86 .Annotation("Sqlite:Autoincrement", true),
87 AllowWebClient = table.Column<bool>(nullable: false),
88 SecurityLevel = table.Column<int>(nullable: false),
89 Port = table.Column<ushort>(nullable: false),
90 StartupTimeout = table.Column<uint>(nullable: false),
91 HeartbeatSeconds = table.Column<uint>(nullable: false),
92 AutoStart = table.Column<bool>(nullable: false),
93 InstanceId = table.Column<long>(nullable: false),
94 TopicRequestTimeout = table.Column<uint>(nullable: false),
95 AdditionalParameters = table.Column<string>(maxLength: 10000, nullable: false),
96 },
97 constraints: table =>
98 {
99 table.PrimaryKey("PK_DreamDaemonSettings", x => x.Id);
100 table.ForeignKey(
101 name: "FK_DreamDaemonSettings_Instances_InstanceId",
102 column: x => x.InstanceId,
103 principalTable: "Instances",
104 principalColumn: "Id",
105 onDelete: ReferentialAction.Cascade);
106 });
107
108 migrationBuilder.Sql(
109 $"INSERT INTO DreamDaemonSettings SELECT Id,AllowWebClient,SecurityLevel,Port,AutoStart,HeartbeatSeconds,StartupTimeout,InstanceId,TopicRequestTimeout,AdditionalParameters FROM DreamDaemonSettings_down");
110
111 migrationBuilder.DropTable(
112 name: "DreamDaemonSettings_down");
113
114 migrationBuilder.RenameTable(
115 name: "DreamDaemonSettings",
116 newName: "DreamDaemonSettings_down");
117
118 migrationBuilder.RenameTable(
119 name: "DreamDaemonSettings_down",
120 newName: "DreamDaemonSettings");
121 }
122 }
123}