tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
20200629184803_MSRemoveExperimentalWatchdog.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.DropTable(
18 name: "WatchdogReattachInformations");
19
20 migrationBuilder.DropColumn(
21 name: "IsPrimary",
22 table: "ReattachInformations");
23
24 migrationBuilder.DropColumn(
25 name: "SecondaryPort",
26 table: "DreamDaemonSettings");
27
28 migrationBuilder.RenameColumn(
29 name: "PrimaryPort",
30 table: "DreamDaemonSettings",
31 newName: "Port");
32 }
33
35 protected override void Down(MigrationBuilder migrationBuilder)
36 {
37 ArgumentNullException.ThrowIfNull(migrationBuilder);
38
39 migrationBuilder.RenameColumn(
40 name: "Port",
41 table: "DreamDaemonSettings",
42 newName: "PrimaryPort");
43
44 migrationBuilder.AddColumn<int>(
45 name: "SecondaryPort",
46 table: "DreamDaemonSettings",
47 type: "int",
48 nullable: false,
49 defaultValue: 1338);
50
51 migrationBuilder.AddColumn<bool>(
52 name: "IsPrimary",
53 table: "ReattachInformations",
54 type: "bit",
55 nullable: false,
56 defaultValue: true);
57
58 migrationBuilder.CreateTable(
59 name: "WatchdogReattachInformations",
60 columns: table => new
61 {
62 Id = table.Column<long>(type: "bigint", nullable: false)
63 .Annotation("SqlServer:Identity", "1, 1"),
64 AlphaId = table.Column<long>(type: "bigint", nullable: true),
65 AlphaIsActive = table.Column<bool>(type: "bit", nullable: false),
66 BravoId = table.Column<long>(type: "bigint", nullable: true),
67 InstanceId = table.Column<long>(type: "bigint", nullable: false),
68 },
69 constraints: table =>
70 {
71 table.PrimaryKey("PK_WatchdogReattachInformations", x => x.Id);
72 table.ForeignKey(
73 name: "FK_WatchdogReattachInformations_ReattachInformations_AlphaId",
74 column: x => x.AlphaId,
75 principalTable: "ReattachInformations",
76 principalColumn: "Id",
77 onDelete: ReferentialAction.Restrict);
78 table.ForeignKey(
79 name: "FK_WatchdogReattachInformations_ReattachInformations_BravoId",
80 column: x => x.BravoId,
81 principalTable: "ReattachInformations",
82 principalColumn: "Id",
83 onDelete: ReferentialAction.Restrict);
84 table.ForeignKey(
85 name: "FK_WatchdogReattachInformations_Instances_InstanceId",
86 column: x => x.InstanceId,
87 principalTable: "Instances",
88 principalColumn: "Id",
89 onDelete: ReferentialAction.Cascade);
90 });
91
92 migrationBuilder.CreateIndex(
93 name: "IX_WatchdogReattachInformations_AlphaId",
94 table: "WatchdogReattachInformations",
95 column: "AlphaId");
96
97 migrationBuilder.CreateIndex(
98 name: "IX_WatchdogReattachInformations_BravoId",
99 table: "WatchdogReattachInformations",
100 column: "BravoId");
101
102 migrationBuilder.CreateIndex(
103 name: "IX_WatchdogReattachInformations_InstanceId",
104 table: "WatchdogReattachInformations",
105 column: "InstanceId",
106 unique: true);
107 }
108 }
109}
Removes the WatchdogReattachInformations table, SecondaryPort column, and renames the primary port co...