tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
20210826214006_SLAddDeploymentTimeout.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.EntityFrameworkCore.Migrations;
4
6{
10 public partial class SLAddDeploymentTimeout : Migration
11 {
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 ArgumentNullException.ThrowIfNull(migrationBuilder);
16
17 migrationBuilder.AddColumn<TimeSpan>(
18 name: "Timeout",
19 table: "DreamMakerSettings",
20 nullable: false,
21 defaultValue: TimeSpan.FromHours(1));
22 }
23
25 protected override void Down(MigrationBuilder migrationBuilder)
26 {
27 ArgumentNullException.ThrowIfNull(migrationBuilder);
28
29 migrationBuilder.RenameTable(
30 name: "DreamMakerSettings",
31 newName: "DreamMakerSettings_down");
32
33 migrationBuilder.CreateTable(
34 name: "DreamMakerSettings",
35 columns: table => new
36 {
37 Id = table.Column<long>(nullable: false)
38 .Annotation("Sqlite:Autoincrement", true),
39 ProjectName = table.Column<string>(maxLength: 10000, nullable: true),
40 ApiValidationPort = table.Column<ushort>(nullable: false),
41 ApiValidationSecurityLevel = table.Column<int>(nullable: false),
42 InstanceId = table.Column<long>(nullable: false),
43 RequireDMApiValidation = table.Column<bool>(nullable: false),
44 },
45 constraints: table =>
46 {
47 table.PrimaryKey("PK_DreamMakerSettings", x => x.Id);
48 table.ForeignKey(
49 name: "FK_DreamMakerSettings_Instances_InstanceId",
50 column: x => x.InstanceId,
51 principalTable: "Instances",
52 principalColumn: "Id",
53 onDelete: ReferentialAction.Cascade);
54 });
55
56 migrationBuilder.Sql(
57 $"INSERT INTO DreamMakerSettings SELECT Id,ProjectName,ApiValidationPort,ApiValidationSecurityLevel,InstanceId,RequireDMApiValidation FROM DreamMakerSettings_down");
58
59 migrationBuilder.DropTable(
60 name: "DreamMakerSettings_down");
61
62 migrationBuilder.RenameTable(
63 name: "DreamMakerSettings",
64 newName: "DreamMakerSettings_down");
65
66 migrationBuilder.RenameTable(
67 name: "DreamMakerSettings_down",
68 newName: "DreamMakerSettings");
69 }
70 }
71}