aboutsummaryrefslogtreecommitdiff
path: root/Migrations/20241011050136_v0.4-rc1.cs
blob: 6278225dc6d120dfeef509abe2b0efc75dad0eeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace PagerParser.Migrations
{
    /// <inheritdoc />
    public partial class v04rc1 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "DiscordAlertChannels",
                columns: table => new
                {
                    DiscordAlertChannelId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    GuildId = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
                    ChannelId = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
                    RequireMention = table.Column<bool>(type: "boolean", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DiscordAlertChannels", x => x.DiscordAlertChannelId);
                });

            migrationBuilder.CreateTable(
                name: "DiscordAlertSubscriptions",
                columns: table => new
                {
                    DiscordAlertSubscriptionId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    PageDestination = table.Column<string>(type: "text", nullable: false),
                    GuildId = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
                    PrincipalId = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
                    PrincipalType = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DiscordAlertSubscriptions", x => x.DiscordAlertSubscriptionId);
                });

            migrationBuilder.CreateIndex(
                name: "IX_DiscordAlertChannels_GuildId",
                table: "DiscordAlertChannels",
                column: "GuildId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_DiscordAlertSubscriptions_GuildId",
                table: "DiscordAlertSubscriptions",
                column: "GuildId");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "DiscordAlertChannels");

            migrationBuilder.DropTable(
                name: "DiscordAlertSubscriptions");
        }
    }
}