tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
20200807214754_SLAddDeploymentColumns.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.EntityFrameworkCore.Migrations;
4
6{
10 public partial class SLAddDeploymentColumns : Migration
11 {
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 ArgumentNullException.ThrowIfNull(migrationBuilder);
16
17 migrationBuilder.AddColumn<bool>(
18 name: "CreateGitHubDeployments",
19 table: "RepositorySettings",
20 nullable: false,
21 defaultValue: false);
22
23 migrationBuilder.AddColumn<int>(
24 name: "GitHubDeploymentId",
25 table: "CompileJobs",
26 nullable: true);
27
28 migrationBuilder.AddColumn<long>(
29 name: "GitHubRepoId",
30 table: "CompileJobs",
31 nullable: true);
32 }
33
35 protected override void Down(MigrationBuilder migrationBuilder)
36 {
37 ArgumentNullException.ThrowIfNull(migrationBuilder);
38
39 migrationBuilder.RenameTable(
40 name: "RepositorySettings",
41 newName: "RepositorySettings_down");
42
43 migrationBuilder.CreateTable(
44 name: "RepositorySettings",
45 columns: table => new
46 {
47 Id = table.Column<long>(nullable: false)
48 .Annotation("Sqlite:Autoincrement", true),
49 CommitterName = table.Column<string>(maxLength: 10000, nullable: false),
50 CommitterEmail = table.Column<string>(maxLength: 10000, nullable: false),
51 AccessUser = table.Column<string>(maxLength: 10000, nullable: true),
52 AccessToken = table.Column<string>(maxLength: 10000, nullable: true),
53 PushTestMergeCommits = table.Column<bool>(nullable: false),
54 ShowTestMergeCommitters = table.Column<bool>(nullable: false),
55 AutoUpdatesKeepTestMerges = table.Column<bool>(nullable: false),
56 AutoUpdatesSynchronize = table.Column<bool>(nullable: false),
57 PostTestMergeComment = table.Column<bool>(nullable: false),
58 InstanceId = table.Column<long>(nullable: false),
59 },
60 constraints: table =>
61 {
62 table.PrimaryKey("PK_RepositorySettings", x => x.Id);
63 table.ForeignKey(
64 name: "FK_RepositorySettings_Instances_InstanceId",
65 column: x => x.InstanceId,
66 principalTable: "Instances",
67 principalColumn: "Id",
68 onDelete: ReferentialAction.Cascade);
69 });
70
71 migrationBuilder.Sql(
72 $"INSERT INTO RepositorySettings SELECT Id,CommitterName,CommitterEmail,AccessUser,AccessToken,PushTestMergeCommits,ShowTestMergeCommitters,AutoUpdatesKeepTestMerges,AutoUpdatesSynchronize,PostTestMergeComment,InstanceId FROM RepositorySettings_down");
73
74 migrationBuilder.DropTable(
75 name: "RepositorySettings_down");
76
77 migrationBuilder.RenameTable(
78 name: "CompileJobs",
79 newName: "CompileJobs_down");
80
81 migrationBuilder.CreateTable(
82 name: "CompileJobs",
83 columns: table => new
84 {
85 Id = table.Column<long>(nullable: false)
86 .Annotation("Sqlite:Autoincrement", true),
87 DmeName = table.Column<string>(nullable: false),
88 Output = table.Column<string>(nullable: false),
89 DirectoryName = table.Column<Guid>(nullable: false),
90 MinimumSecurityLevel = table.Column<int>(nullable: true),
91 JobId = table.Column<long>(nullable: false),
92 RevisionInformationId = table.Column<long>(nullable: false),
93 ByondVersion = table.Column<string>(nullable: false),
94 DMApiMajorVersion = table.Column<int>(nullable: true),
95 DMApiMinorVersion = table.Column<int>(nullable: true),
96 DMApiPatchVersion = table.Column<int>(nullable: true),
97 },
98 constraints: table =>
99 {
100 table.PrimaryKey("PK_CompileJobs", x => x.Id);
101 table.ForeignKey(
102 name: "FK_CompileJobs_Jobs_JobId",
103 column: x => x.JobId,
104 principalTable: "Jobs",
105 principalColumn: "Id",
106 onDelete: ReferentialAction.Cascade);
107 table.ForeignKey(
108 name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
109 column: x => x.RevisionInformationId,
110 principalTable: "RevisionInformations",
111 principalColumn: "Id");
112 });
113
114 migrationBuilder.Sql(
115 $"INSERT INTO CompileJobs SELECT Id,DmeName,Output,DirectoryName,MinimumSecurityLevel,JobId,RevisionInformationId,ByondVersion,DMApiMajorVersion,DMApiMinorVersion,DMApiPatchVersion FROM CompileJobs_down");
116
117 migrationBuilder.DropTable(
118 name: "CompileJobs_down");
119 }
120 }
121}