91 lines
4.4 KiB
C#
91 lines
4.4 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace LightlessSyncServer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class ChatReports : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "reported_chat_messages",
|
|
columns: table => new
|
|
{
|
|
report_id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
report_time_utc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
reporter_user_uid = table.Column<string>(type: "text", nullable: false),
|
|
reported_user_uid = table.Column<string>(type: "text", nullable: true),
|
|
channel_type = table.Column<byte>(type: "smallint", nullable: false),
|
|
world_id = table.Column<int>(type: "integer", nullable: false),
|
|
zone_id = table.Column<int>(type: "integer", nullable: false),
|
|
channel_key = table.Column<string>(type: "text", nullable: false),
|
|
message_id = table.Column<string>(type: "text", nullable: false),
|
|
message_sent_at_utc = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
message_content = table.Column<string>(type: "text", nullable: false),
|
|
sender_token = table.Column<string>(type: "text", nullable: false),
|
|
sender_hashed_cid = table.Column<string>(type: "text", nullable: true),
|
|
sender_display_name = table.Column<string>(type: "text", nullable: true),
|
|
sender_was_lightfinder = table.Column<bool>(type: "boolean", nullable: false),
|
|
snapshot_json = table.Column<string>(type: "text", nullable: true),
|
|
reason = table.Column<string>(type: "text", nullable: true),
|
|
additional_context = table.Column<string>(type: "text", nullable: true),
|
|
discord_message_id = table.Column<decimal>(type: "numeric(20,0)", nullable: true),
|
|
discord_message_posted_at_utc = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
|
resolved = table.Column<bool>(type: "boolean", nullable: false),
|
|
resolved_at_utc = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
|
resolution_notes = table.Column<string>(type: "text", nullable: true),
|
|
resolved_by_user_uid = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("pk_reported_chat_messages", x => x.report_id);
|
|
});
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "chat_banned",
|
|
table: "users",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_reported_chat_messages_discord_message_id",
|
|
table: "reported_chat_messages",
|
|
column: "discord_message_id");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_reported_chat_messages_message_id",
|
|
table: "reported_chat_messages",
|
|
column: "message_id",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_reported_chat_messages_reported_user_uid",
|
|
table: "reported_chat_messages",
|
|
column: "reported_user_uid");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_reported_chat_messages_reporter_user_uid",
|
|
table: "reported_chat_messages",
|
|
column: "reporter_user_uid");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "reported_chat_messages");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "chat_banned",
|
|
table: "users");
|
|
}
|
|
}
|
|
}
|