using System;
using AltBot.Core.Models;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AltBot.Data.Migrations
{
///
public partial class Initial : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("Npgsql:Enum:label", "bronze,gold,hero,none,silver");
migrationBuilder.CreateTable(
name: "subscriber",
columns: table => new
{
did = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: false),
seen_at = table.Column(type: "timestamp with time zone", nullable: false),
active = table.Column(type: "boolean", nullable: false, defaultValue: true),
handle = table.Column(type: "character varying(250)", maxLength: 250, nullable: true),
rkey = table.Column(type: "character varying(100)", maxLength: 100, nullable: true),
label = table.Column(type: "label", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_subscriber", x => x.did);
});
migrationBuilder.CreateTable(
name: "image_post",
columns: table => new
{
did = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: false),
cid = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: false),
rkey = table.Column(type: "character varying(512)", maxLength: 512, nullable: true),
valid_alt = table.Column(type: "boolean", nullable: false),
seen_at = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_image_post", x => new { x.did, x.cid });
table.ForeignKey(
name: "fk_image_post_subscriber",
column: x => x.did,
principalTable: "subscriber",
principalColumn: "did",
onDelete: ReferentialAction.Cascade);
});
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "image_post");
migrationBuilder.DropTable(
name: "subscriber");
}
}
}