59 lines
2.0 KiB
C#
59 lines
2.0 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace BlueLaminate.EFCore.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddScrapeRunAndWeaponNameIndex : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "scrape_runs",
|
|
schema: "skintracker",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
source = table.Column<string>(type: "text", nullable: false),
|
|
ran_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
item_count = table.Column<int>(type: "integer", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("pk_scrape_runs", x => x.id);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_weapons_name",
|
|
schema: "skintracker",
|
|
table: "weapons",
|
|
column: "name",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_scrape_runs_source_ran_at",
|
|
schema: "skintracker",
|
|
table: "scrape_runs",
|
|
columns: new[] { "source", "ran_at" });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "scrape_runs",
|
|
schema: "skintracker");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "ix_weapons_name",
|
|
schema: "skintracker",
|
|
table: "weapons");
|
|
}
|
|
}
|
|
}
|