using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Backend.Migrations
{
///
public partial class AddArchivedWinners : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ArchivedWinners",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Year = table.Column(type: "integer", nullable: false),
Category = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
Subcategory = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
WinnerName = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
WinnerUrl = table.Column(type: "character varying(500)", maxLength: 500, nullable: false),
CreatedAt = table.Column(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ArchivedWinners", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_ArchivedWinners_Year_Category_Subcategory",
table: "ArchivedWinners",
columns: new[] { "Year", "Category", "Subcategory" },
unique: true);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ArchivedWinners");
}
}
}