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