Files
Govor/Govor.Data/Migrations/20250624071942_inviteAdd.cs
T
Artemy ce013eae49 Registration rework
+ InvitesRepository
+ AdminsRepository
+ rework jwt
2025-06-24 14:27:08 +07:00

70 lines
2.3 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Govor.Data.Migrations
{
/// <inheritdoc />
public partial class inviteAdd : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "InviteId",
table: "Users",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.CreateTable(
name: "Invitations",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
IsAdmin = table.Column<bool>(type: "boolean", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
EndDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
MaxParticipants = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Invitations", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Users_InviteId",
table: "Users",
column: "InviteId");
migrationBuilder.AddForeignKey(
name: "FK_Users_Invitations_InviteId",
table: "Users",
column: "InviteId",
principalTable: "Invitations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Users_Invitations_InviteId",
table: "Users");
migrationBuilder.DropTable(
name: "Invitations");
migrationBuilder.DropIndex(
name: "IX_Users_InviteId",
table: "Users");
migrationBuilder.DropColumn(
name: "InviteId",
table: "Users");
}
}
}