tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
20201122231219_MSAddOAuthConnections.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.EntityFrameworkCore.Migrations;
4
6{
10 public partial class MSAddOAuthConnections : Migration
11 {
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 ArgumentNullException.ThrowIfNull(migrationBuilder);
16
17 migrationBuilder.CreateTable(
18 name: "OAuthConnections",
19 columns: table => new
20 {
21 Id = table.Column<long>(nullable: false)
22 .Annotation("SqlServer:Identity", "1, 1"),
23 Provider = table.Column<int>(nullable: false),
24 ExternalUserId = table.Column<string>(nullable: false, maxLength: 100),
25 UserId = table.Column<long>(nullable: true),
26 },
27 constraints: table =>
28 {
29 table.PrimaryKey("PK_OAuthConnections", x => x.Id);
30 table.ForeignKey(
31 name: "FK_OAuthConnections_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_OAuthConnections_UserId",
40 table: "OAuthConnections",
41 column: "UserId");
42
43 migrationBuilder.CreateIndex(
44 name: "IX_OAuthConnections_Provider_ExternalUserId",
45 table: "OAuthConnections",
46 columns: new[] { "Provider", "ExternalUserId" },
47 unique: true);
48 }
49
51 protected override void Down(MigrationBuilder migrationBuilder)
52 {
53 ArgumentNullException.ThrowIfNull(migrationBuilder);
54
55 migrationBuilder.DropTable(
56 name: "OAuthConnections");
57 }
58 }
59}