#264 adding db migration
This commit is contained in:
parent
332dc1e4d0
commit
8618e1dc61
3554
RMuseum/Migrations/20211218155310_RecitationUserUpVotes.Designer.cs
generated
Normal file
3554
RMuseum/Migrations/20211218155310_RecitationUserUpVotes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
56
RMuseum/Migrations/20211218155310_RecitationUserUpVotes.cs
Normal file
56
RMuseum/Migrations/20211218155310_RecitationUserUpVotes.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace RMuseum.Migrations
|
||||
{
|
||||
public partial class RecitationUserUpVotes : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RecitationUserUpVotes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
RecitationId = table.Column<int>(type: "int", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
DateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RecitationUserUpVotes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RecitationUserUpVotes_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_RecitationUserUpVotes_Recitations_RecitationId",
|
||||
column: x => x.RecitationId,
|
||||
principalTable: "Recitations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RecitationUserUpVotes_RecitationId_UserId",
|
||||
table: "RecitationUserUpVotes",
|
||||
columns: new[] { "RecitationId", "UserId" },
|
||||
unique: true,
|
||||
filter: "[UserId] IS NOT NULL");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RecitationUserUpVotes_UserId",
|
||||
table: "RecitationUserUpVotes",
|
||||
column: "UserId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "RecitationUserUpVotes");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user