54 lines
2.3 KiB
C#
54 lines
2.3 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PlaylistShared.Api.Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddYandexAuthSessions : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "YandexAuthSessions",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
QrCodeUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
|
|
SerializedCookies = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
ConfirmedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
IsConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
|
TrackId = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
|
CsfrToken = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_YandexAuthSessions", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_YandexAuthSessions_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_YandexAuthSessions_UserId",
|
|
table: "YandexAuthSessions",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "YandexAuthSessions");
|
|
}
|
|
}
|
|
}
|