a88567fea6
Force-add the EF migration excluded by the Migrations/ gitignore rule, so the UserInvitations table migration is versioned alongside the feature. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
60 lines
2.5 KiB
C#
60 lines
2.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace ROLAC.API.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddUserInvitations : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "UserInvitations",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
UserId = table.Column<string>(type: "character varying(450)", maxLength: 450, nullable: false),
|
|
TokenHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
|
ExpiresAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
CreatedBy = table.Column<string>(type: "character varying(450)", maxLength: 450, nullable: false),
|
|
UsedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
|
RevokedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_UserInvitations", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_UserInvitations_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserInvitations_TokenHash",
|
|
table: "UserInvitations",
|
|
column: "TokenHash",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserInvitations_UserId",
|
|
table: "UserInvitations",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "UserInvitations");
|
|
}
|
|
}
|
|
}
|