AltHeroes Bot v2
1using System;
2using AltBot.Core.Models;
3using Microsoft.EntityFrameworkCore.Migrations;
4
5#nullable disable
6
7namespace AltBot.Data.Migrations
8{
9 /// <inheritdoc />
10 public partial class Initial : Migration
11 {
12 /// <inheritdoc />
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 migrationBuilder.AlterDatabase()
16 .Annotation("Npgsql:Enum:label", "bronze,gold,hero,none,silver");
17
18 migrationBuilder.CreateTable(
19 name: "subscriber",
20 columns: table => new
21 {
22 did = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
23 seen_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
24 active = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
25 handle = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: true),
26 rkey = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
27 label = table.Column<LabelLevel>(type: "label", nullable: false)
28 },
29 constraints: table =>
30 {
31 table.PrimaryKey("pk_subscriber", x => x.did);
32 });
33
34 migrationBuilder.CreateTable(
35 name: "image_post",
36 columns: table => new
37 {
38 did = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
39 cid = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
40 rkey = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true),
41 valid_alt = table.Column<bool>(type: "boolean", nullable: false),
42 seen_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
43 },
44 constraints: table =>
45 {
46 table.PrimaryKey("pk_image_post", x => new { x.did, x.cid });
47 table.ForeignKey(
48 name: "fk_image_post_subscriber",
49 column: x => x.did,
50 principalTable: "subscriber",
51 principalColumn: "did",
52 onDelete: ReferentialAction.Cascade);
53 });
54 }
55
56 /// <inheritdoc />
57 protected override void Down(MigrationBuilder migrationBuilder)
58 {
59 migrationBuilder.DropTable(
60 name: "image_post");
61
62 migrationBuilder.DropTable(
63 name: "subscriber");
64 }
65 }
66}