using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace SVSim.Database.Migrations
{
///
public partial class PackStarterClass : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ViewerPackStarterClass",
columns: table => new
{
ViewerId = table.Column(type: "bigint", nullable: false),
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PackId = table.Column(type: "integer", nullable: false),
ClassId = table.Column(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ViewerPackStarterClass", x => new { x.ViewerId, x.Id });
table.ForeignKey(
name: "FK_ViewerPackStarterClass_Viewers_ViewerId",
column: x => x.ViewerId,
principalTable: "Viewers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ViewerPackStarterClass_ViewerId_PackId",
table: "ViewerPackStarterClass",
columns: new[] { "ViewerId", "PackId" },
unique: true);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ViewerPackStarterClass");
}
}
}