tgstation-server 6.16.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
20250302232601_MYAddOidcConnections.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.EntityFrameworkCore.Metadata;
4using Microsoft.EntityFrameworkCore.Migrations;
5
7{
9 public partial class MYAddOidcConnections : Migration
10 {
12 protected override void Up(MigrationBuilder migrationBuilder)
13 {
14 ArgumentNullException.ThrowIfNull(migrationBuilder);
15
16 migrationBuilder.CreateTable(
17 name: "OidcConnections",
18 columns: table => new
19 {
20 Id = table.Column<long>(type: "bigint", nullable: false)
21 .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
22 UserId = table.Column<long>(type: "bigint", nullable: false),
23 SchemeKey = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
24 .Annotation("MySql:CharSet", "utf8mb4"),
25 ExternalUserId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
26 .Annotation("MySql:CharSet", "utf8mb4"),
27 },
28 constraints: table =>
29 {
30 table.PrimaryKey("PK_OidcConnections", x => x.Id);
31 table.ForeignKey(
32 name: "FK_OidcConnections_Users_UserId",
33 column: x => x.UserId,
34 principalTable: "Users",
35 principalColumn: "Id",
36 onDelete: ReferentialAction.Cascade);
37 })
38 .Annotation("MySql:CharSet", "utf8mb4");
39
40 migrationBuilder.CreateIndex(
41 name: "IX_OidcConnections_SchemeKey_ExternalUserId",
42 table: "OidcConnections",
43 columns: new[] { "SchemeKey", "ExternalUserId" },
44 unique: true);
45
46 migrationBuilder.CreateIndex(
47 name: "IX_OidcConnections_UserId",
48 table: "OidcConnections",
49 column: "UserId");
50 }
51
53 protected override void Down(MigrationBuilder migrationBuilder)
54 {
55 ArgumentNullException.ThrowIfNull(migrationBuilder);
56
57 migrationBuilder.DropTable(
58 name: "OidcConnections");
59 }
60 }
61}