using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace LootBoxSimulator.Migrations
{
///
public partial class InitialCreate : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Categories",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Categories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Rates",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column(type: "text", nullable: false),
Rate = table.Column(type: "numeric", nullable: false),
Color = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Rates", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Items",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column(type: "text", nullable: false),
Url = table.Column(type: "text", nullable: false),
CategoryId = table.Column(type: "integer", nullable: true),
RateId = table.Column(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Items", x => x.Id);
table.ForeignKey(
name: "FK_Items_Categories_CategoryId",
column: x => x.CategoryId,
principalTable: "Categories",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Items_Rates_RateId",
column: x => x.RateId,
principalTable: "Rates",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Items_CategoryId",
table: "Items",
column: "CategoryId");
migrationBuilder.CreateIndex(
name: "IX_Items_RateId",
table: "Items",
column: "RateId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Items");
migrationBuilder.DropTable(
name: "Categories");
migrationBuilder.DropTable(
name: "Rates");
}
}
}