Add Notification entity to database in one migration

This commit is contained in:
rockstardev 2020-06-13 19:25:46 -05:00
parent b973c0ab82
commit b9807aac56
2 changed files with 672 additions and 586 deletions

View file

@ -0,0 +1,48 @@
using System;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20200614002524_AddNotificationDataEntity")]
public partial class AddNotificationDataEntity : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Notifications",
columns: table => new
{
Id = table.Column<string>(maxLength: 36, nullable: false),
Created = table.Column<DateTimeOffset>(nullable: false),
ApplicationUserId = table.Column<string>(maxLength: 50, nullable: true),
NotificationType = table.Column<string>(maxLength: 100, nullable: true),
Seen = table.Column<bool>(nullable: false),
Blob = table.Column<byte[]>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Notifications", x => x.Id);
table.ForeignKey(
name: "FK_Notifications_AspNetUsers_ApplicationUserId",
column: x => x.ApplicationUserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Notifications_ApplicationUserId",
table: "Notifications",
column: "ApplicationUserId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Notifications");
}
}
}