using System.Collections.Generic;
using Catalogger.Backend.Database.Models;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace Catalogger.Backend.Database.Migrations
{
///
public partial class Init : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "guilds",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false),
channels = table.Column(type: "jsonb", nullable: false),
banned_systems = table.Column>(type: "text[]", nullable: false),
key_roles = table.Column>(type: "bigint[]", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_guilds", x => x.id);
});
migrationBuilder.CreateTable(
name: "ignored_messages",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_ignored_messages", x => x.id);
});
migrationBuilder.CreateTable(
name: "invites",
columns: table => new
{
code = table.Column(type: "text", nullable: false),
guild_id = table.Column(type: "bigint", nullable: false),
name = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_invites", x => x.code);
});
migrationBuilder.CreateTable(
name: "messages",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false),
original_id = table.Column(type: "bigint", nullable: true),
user_id = table.Column(type: "bigint", nullable: false),
channel_id = table.Column(type: "bigint", nullable: false),
guild_id = table.Column(type: "bigint", nullable: false),
member = table.Column(type: "text", nullable: true),
system = table.Column(type: "text", nullable: true),
username = table.Column(type: "bytea", nullable: false),
content = table.Column(type: "bytea", nullable: false),
metadata = table.Column(type: "bytea", nullable: true),
attachment_size = table.Column(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_messages", x => x.id);
});
migrationBuilder.CreateTable(
name: "watchlists",
columns: table => new
{
guild_id = table.Column(type: "bigint", nullable: false),
user_id = table.Column(type: "bigint", nullable: false),
added_at = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
moderator_id = table.Column(type: "bigint", nullable: false),
reason = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_watchlists", x => new { x.guild_id, x.user_id });
});
migrationBuilder.CreateIndex(
name: "ix_invites_guild_id",
table: "invites",
column: "guild_id");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "guilds");
migrationBuilder.DropTable(
name: "ignored_messages");
migrationBuilder.DropTable(
name: "invites");
migrationBuilder.DropTable(
name: "messages");
migrationBuilder.DropTable(
name: "watchlists");
}
}
}