using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace LightlessSyncServer.Migrations
{
///
public partial class ChatReports : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "reported_chat_messages",
columns: table => new
{
report_id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
report_time_utc = table.Column(type: "timestamp with time zone", nullable: false),
reporter_user_uid = table.Column(type: "text", nullable: false),
reported_user_uid = table.Column(type: "text", nullable: true),
channel_type = table.Column(type: "smallint", nullable: false),
world_id = table.Column(type: "integer", nullable: false),
zone_id = table.Column(type: "integer", nullable: false),
channel_key = table.Column(type: "text", nullable: false),
message_id = table.Column(type: "text", nullable: false),
message_sent_at_utc = table.Column(type: "timestamp with time zone", nullable: false),
message_content = table.Column(type: "text", nullable: false),
sender_token = table.Column(type: "text", nullable: false),
sender_hashed_cid = table.Column(type: "text", nullable: true),
sender_display_name = table.Column(type: "text", nullable: true),
sender_was_lightfinder = table.Column(type: "boolean", nullable: false),
snapshot_json = table.Column(type: "text", nullable: true),
reason = table.Column(type: "text", nullable: true),
additional_context = table.Column(type: "text", nullable: true),
discord_message_id = table.Column(type: "numeric(20,0)", nullable: true),
discord_message_posted_at_utc = table.Column(type: "timestamp with time zone", nullable: true),
resolved = table.Column(type: "boolean", nullable: false),
resolved_at_utc = table.Column(type: "timestamp with time zone", nullable: true),
resolution_notes = table.Column(type: "text", nullable: true),
resolved_by_user_uid = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_reported_chat_messages", x => x.report_id);
});
migrationBuilder.AddColumn(
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");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "reported_chat_messages");
migrationBuilder.DropColumn(
name: "chat_banned",
table: "users");
}
}
}