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