tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
20210828183954_SLAddUpdateSubmodules.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.EntityFrameworkCore.Migrations;
4
6{
10 public partial class SLAddUpdateSubmodules : Migration
11 {
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 ArgumentNullException.ThrowIfNull(migrationBuilder);
16
17 migrationBuilder.AddColumn<bool>(
18 name: "UpdateSubmodules",
19 table: "RepositorySettings",
20 nullable: false,
21 defaultValue: true);
22 }
23
25 protected override void Down(MigrationBuilder migrationBuilder)
26 {
27 ArgumentNullException.ThrowIfNull(migrationBuilder);
28
29 migrationBuilder.RenameTable(
30 name: "RepositorySettings",
31 newName: "RepositorySettings_down");
32
33 migrationBuilder.CreateTable(
34 name: "RepositorySettings",
35 columns: table => new
36 {
37 Id = table.Column<long>(nullable: false)
38 .Annotation("Sqlite:Autoincrement", true),
39 CommitterName = table.Column<string>(maxLength: 10000, nullable: false),
40 CommitterEmail = table.Column<string>(maxLength: 10000, nullable: false),
41 AccessUser = table.Column<string>(maxLength: 10000, nullable: true),
42 AccessToken = table.Column<string>(maxLength: 10000, nullable: true),
43 PushTestMergeCommits = table.Column<bool>(nullable: false),
44 ShowTestMergeCommitters = table.Column<bool>(nullable: false),
45 AutoUpdatesKeepTestMerges = table.Column<bool>(nullable: false),
46 AutoUpdatesSynchronize = table.Column<bool>(nullable: false),
47 PostTestMergeComment = table.Column<bool>(nullable: false),
48 InstanceId = table.Column<long>(nullable: false),
49 CreateGitHubDeployments = table.Column<bool>(nullable: false),
50 },
51 constraints: table =>
52 {
53 table.PrimaryKey("PK_RepositorySettings", x => x.Id);
54 table.ForeignKey(
55 name: "FK_RepositorySettings_Instances_InstanceId",
56 column: x => x.InstanceId,
57 principalTable: "Instances",
58 principalColumn: "Id",
59 onDelete: ReferentialAction.Cascade);
60 });
61
62 migrationBuilder.Sql(
63 $"INSERT INTO RepositorySettings SELECT Id,CommitterName,CommitterEmail,AccessUser,AccessToken,PushTestMergeCommits,ShowTestMergeCommitters,AutoUpdatesKeepTestMerges,AutoUpdatesSynchronize,PostTestMergeComment,InstanceId,CreateGitHubDeployments FROM RepositorySettings_down");
64
65 migrationBuilder.DropTable(
66 name: "RepositorySettings_down");
67
68 migrationBuilder.RenameTable(
69 name: "RepositorySettings",
70 newName: "RepositorySettings_down");
71
72 migrationBuilder.RenameTable(
73 name: "RepositorySettings_down",
74 newName: "RepositorySettings");
75 }
76 }
77}