Files
Sharpbin/SharpbinV3.Server/Migrations/20260221080317_EmailVerificationToken.cs
T

62 lines
2.2 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SharpbinV3.Server.Migrations
{
/// <inheritdoc />
public partial class EmailVerificationToken : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "EmailVerified",
table: "Users",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "EmailVerificationTokens",
columns: table => new
{
UUID = table.Column<Guid>(type: "TEXT", nullable: false),
UserUUID = table.Column<Guid>(type: "TEXT", nullable: false),
TokenHash = table.Column<string>(type: "TEXT", nullable: false),
CreatedAt = table.Column<long>(type: "INTEGER", nullable: false),
ExpiresAt = table.Column<long>(type: "INTEGER", nullable: false),
Type = table.Column<int>(type: "INTEGER", nullable: false),
Used = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EmailVerificationTokens", x => x.UUID);
table.ForeignKey(
name: "FK_EmailVerificationTokens_Users_UserUUID",
column: x => x.UserUUID,
principalTable: "Users",
principalColumn: "UUID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_EmailVerificationTokens_UserUUID",
table: "EmailVerificationTokens",
column: "UserUUID");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EmailVerificationTokens");
migrationBuilder.DropColumn(
name: "EmailVerified",
table: "Users");
}
}
}