using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Govor.Data.Migrations
{
///
public partial class inviteAdd : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
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(type: "uuid", nullable: false),
IsAdmin = table.Column(type: "boolean", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
EndDate = table.Column(type: "timestamp with time zone", nullable: false),
MaxParticipants = table.Column(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);
}
///
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");
}
}
}