tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
20190219042440_MYFixRevInfoIndex.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.EntityFrameworkCore.Migrations;
4
6{
10 public partial class MYFixRevInfoIndex : Migration
11 {
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 ArgumentNullException.ThrowIfNull(migrationBuilder);
16
17 migrationBuilder.DropForeignKey(
18 name: "FK_RevisionInformations_Instances_InstanceId",
19 table: "RevisionInformations");
20
21 migrationBuilder.DropIndex(
22 name: "IX_RevisionInformations_CommitSha",
23 table: "RevisionInformations");
24
25 migrationBuilder.DropIndex(
26 name: "IX_RevisionInformations_InstanceId",
27 table: "RevisionInformations");
28
29 migrationBuilder.CreateIndex(
30 name: "IX_RevisionInformations_InstanceId_CommitSha",
31 table: "RevisionInformations",
32 columns: new[] { "InstanceId", "CommitSha" },
33 unique: true);
34
35 migrationBuilder.AddForeignKey(
36 name: "FK_RevisionInformations_Instances_InstanceId",
37 table: "RevisionInformations",
38 column: "InstanceId",
39 principalTable: "Instances",
40 principalColumn: "Id",
41 onDelete: ReferentialAction.Cascade);
42 }
43
45 protected override void Down(MigrationBuilder migrationBuilder)
46 {
47 ArgumentNullException.ThrowIfNull(migrationBuilder);
48
49 migrationBuilder.DropForeignKey(
50 name: "FK_RevisionInformations_Instances_InstanceId",
51 table: "RevisionInformations");
52
53 migrationBuilder.DropIndex(
54 name: "IX_RevisionInformations_InstanceId_CommitSha",
55 table: "RevisionInformations");
56
57 migrationBuilder.CreateIndex(
58 name: "IX_RevisionInformations_CommitSha",
59 table: "RevisionInformations",
60 column: "CommitSha",
61 unique: true);
62
63 migrationBuilder.CreateIndex(
64 name: "IX_RevisionInformations_InstanceId",
65 table: "RevisionInformations",
66 column: "InstanceId");
67
68 migrationBuilder.AddForeignKey(
69 name: "FK_RevisionInformations_Instances_InstanceId",
70 table: "RevisionInformations",
71 column: "InstanceId",
72 principalTable: "Instances",
73 principalColumn: "Id",
74 onDelete: ReferentialAction.Cascade);
75 }
76 }
77}
Make commit shas non-unique per Instance for MySQL/MariaDB.