using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace BackendPIA.Migrations
{
///
public partial class AddPrize : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Prizes",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RaffleId = table.Column(type: "bigint", nullable: false),
Name = table.Column(type: "text", nullable: false),
Tier = table.Column(type: "integer", nullable: false),
Category = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Prizes", x => x.Id);
table.ForeignKey(
name: "FK_Prizes_Raffles_RaffleId",
column: x => x.RaffleId,
principalTable: "Raffles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Prizes_RaffleId",
table: "Prizes",
column: "RaffleId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Prizes");
}
}
}