62 lines
2.5 KiB
C#
62 lines
2.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace gehGassi.Persistence.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AppUserBlockAdded : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "AppUserBlocks",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
BlockingAppUserId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
|
|
BlockedAppUserId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
|
|
BlockedUntil = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
|
AppUserReportId = table.Column<long>(type: "bigint", nullable: true),
|
|
CreatedBy = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
Created = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AppUserBlocks", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_AppUserBlocks_AppUsers_BlockedAppUserId",
|
|
column: x => x.BlockedAppUserId,
|
|
principalTable: "AppUsers",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_AppUserBlocks_AppUsers_BlockingAppUserId",
|
|
column: x => x.BlockingAppUserId,
|
|
principalTable: "AppUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AppUserBlocks_BlockedAppUserId",
|
|
table: "AppUserBlocks",
|
|
column: "BlockedAppUserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AppUserBlocks_BlockingAppUserId",
|
|
table: "AppUserBlocks",
|
|
column: "BlockingAppUserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AppUserBlocks");
|
|
}
|
|
}
|
|
}
|