93 lines
3.6 KiB
C#
93 lines
3.6 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace LootBoxSimulator.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class InitialCreate : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "Categories",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|||
|
Name = table.Column<string>(type: "text", nullable: false)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_Categories", x => x.Id);
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "Rates",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|||
|
Name = table.Column<string>(type: "text", nullable: false),
|
|||
|
Rate = table.Column<decimal>(type: "numeric", nullable: false),
|
|||
|
Color = table.Column<string>(type: "text", nullable: false)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_Rates", x => x.Id);
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "Items",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|||
|
Name = table.Column<string>(type: "text", nullable: false),
|
|||
|
Url = table.Column<string>(type: "text", nullable: false),
|
|||
|
CategoryId = table.Column<int>(type: "integer", nullable: true),
|
|||
|
RateId = table.Column<int>(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");
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "Items");
|
|||
|
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "Categories");
|
|||
|
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "Rates");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|