1013 lines
		
	
	
		
			52 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			1013 lines
		
	
	
		
			52 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using DysonNetwork.Shared.Models;
 | 
						|
using DysonNetwork.Sphere.WebReader;
 | 
						|
using Microsoft.EntityFrameworkCore.Migrations;
 | 
						|
using NodaTime;
 | 
						|
using NpgsqlTypes;
 | 
						|
 | 
						|
#nullable disable
 | 
						|
 | 
						|
namespace DysonNetwork.Sphere.Migrations
 | 
						|
{
 | 
						|
    /// <inheritdoc />
 | 
						|
    public partial class InitialMigration : Migration
 | 
						|
    {
 | 
						|
        /// <inheritdoc />
 | 
						|
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
						|
        {
 | 
						|
            migrationBuilder.AlterDatabase()
 | 
						|
                .Annotation("Npgsql:PostgresExtension:postgis", ",,");
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "post_categories",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
 | 
						|
                    name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_post_categories", x => x.id);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "post_tags",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
 | 
						|
                    name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_post_tags", x => x.id);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "realms",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    slug = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
 | 
						|
                    name = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
 | 
						|
                    description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
 | 
						|
                    is_community = table.Column<bool>(type: "boolean", nullable: false),
 | 
						|
                    is_public = table.Column<bool>(type: "boolean", nullable: false),
 | 
						|
                    picture_id = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
 | 
						|
                    background_id = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
 | 
						|
                    picture = table.Column<SnCloudFileReferenceObject>(type: "jsonb", nullable: true),
 | 
						|
                    background = table.Column<SnCloudFileReferenceObject>(type: "jsonb", nullable: true),
 | 
						|
                    verification = table.Column<SnVerificationMark>(type: "jsonb", nullable: true),
 | 
						|
                    account_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_realms", x => x.id);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "tags",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_tags", x => x.id);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "chat_rooms",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    name = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
 | 
						|
                    description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
 | 
						|
                    type = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    is_community = table.Column<bool>(type: "boolean", nullable: false),
 | 
						|
                    is_public = table.Column<bool>(type: "boolean", nullable: false),
 | 
						|
                    picture_id = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
 | 
						|
                    background_id = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
 | 
						|
                    picture = table.Column<SnCloudFileReferenceObject>(type: "jsonb", nullable: true),
 | 
						|
                    background = table.Column<SnCloudFileReferenceObject>(type: "jsonb", nullable: true),
 | 
						|
                    realm_id = table.Column<Guid>(type: "uuid", nullable: true),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_chat_rooms", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_chat_rooms_realms_realm_id",
 | 
						|
                        column: x => x.realm_id,
 | 
						|
                        principalTable: "realms",
 | 
						|
                        principalColumn: "id");
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "publishers",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    type = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
 | 
						|
                    nick = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
 | 
						|
                    bio = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
 | 
						|
                    picture_id = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
 | 
						|
                    background_id = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
 | 
						|
                    picture = table.Column<SnCloudFileReferenceObject>(type: "jsonb", nullable: true),
 | 
						|
                    background = table.Column<SnCloudFileReferenceObject>(type: "jsonb", nullable: true),
 | 
						|
                    verification = table.Column<SnVerificationMark>(type: "jsonb", nullable: true),
 | 
						|
                    account_id = table.Column<Guid>(type: "uuid", nullable: true),
 | 
						|
                    realm_id = table.Column<Guid>(type: "uuid", nullable: true),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_publishers", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_publishers_realms_realm_id",
 | 
						|
                        column: x => x.realm_id,
 | 
						|
                        principalTable: "realms",
 | 
						|
                        principalColumn: "id");
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "realm_members",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    realm_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    account_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    role = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    joined_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    leave_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_realm_members", x => new { x.realm_id, x.account_id });
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_realm_members_realms_realm_id",
 | 
						|
                        column: x => x.realm_id,
 | 
						|
                        principalTable: "realms",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "realm_tags",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    realm_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    tag_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_realm_tags", x => new { x.realm_id, x.tag_id });
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_realm_tags_realms_realm_id",
 | 
						|
                        column: x => x.realm_id,
 | 
						|
                        principalTable: "realms",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_realm_tags_tags_tag_id",
 | 
						|
                        column: x => x.tag_id,
 | 
						|
                        principalTable: "tags",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "chat_members",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    chat_room_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    account_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    nick = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
 | 
						|
                    role = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    notify = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    last_read_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    joined_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    leave_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    is_bot = table.Column<bool>(type: "boolean", nullable: false),
 | 
						|
                    break_until = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    timeout_until = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    timeout_cause = table.Column<ChatTimeoutCause>(type: "jsonb", nullable: true),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_chat_members", x => x.id);
 | 
						|
                    table.UniqueConstraint("ak_chat_members_chat_room_id_account_id", x => new { x.chat_room_id, x.account_id });
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_chat_members_chat_rooms_chat_room_id",
 | 
						|
                        column: x => x.chat_room_id,
 | 
						|
                        principalTable: "chat_rooms",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "custom_apps",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    slug = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
 | 
						|
                    name = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
 | 
						|
                    description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
 | 
						|
                    status = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    picture = table.Column<SnCloudFileReferenceObject>(type: "jsonb", nullable: true),
 | 
						|
                    background = table.Column<SnCloudFileReferenceObject>(type: "jsonb", nullable: true),
 | 
						|
                    verification = table.Column<SnVerificationMark>(type: "jsonb", nullable: true),
 | 
						|
                    publisher_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_custom_apps", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_custom_apps_publishers_publisher_id",
 | 
						|
                        column: x => x.publisher_id,
 | 
						|
                        principalTable: "publishers",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "post_collections",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
 | 
						|
                    name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
 | 
						|
                    description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
 | 
						|
                    publisher_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_post_collections", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_post_collections_publishers_publisher_id",
 | 
						|
                        column: x => x.publisher_id,
 | 
						|
                        principalTable: "publishers",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "posts",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    title = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
 | 
						|
                    description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
 | 
						|
                    language = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
 | 
						|
                    edited_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    published_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    visibility = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    content = table.Column<string>(type: "text", nullable: true),
 | 
						|
                    type = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
 | 
						|
                    sensitive_marks = table.Column<List<ContentSensitiveMark>>(type: "jsonb", nullable: true),
 | 
						|
                    views_unique = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    views_total = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    upvotes = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    downvotes = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    replied_post_id = table.Column<Guid>(type: "uuid", nullable: true),
 | 
						|
                    forwarded_post_id = table.Column<Guid>(type: "uuid", nullable: true),
 | 
						|
                    attachments = table.Column<List<SnCloudFileReferenceObject>>(type: "jsonb", nullable: false),
 | 
						|
                    search_vector = table.Column<NpgsqlTsVector>(type: "tsvector", nullable: false)
 | 
						|
                        .Annotation("Npgsql:TsVectorConfig", "simple")
 | 
						|
                        .Annotation("Npgsql:TsVectorProperties", new[] { "title", "description", "content" }),
 | 
						|
                    publisher_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_posts", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_posts_posts_forwarded_post_id",
 | 
						|
                        column: x => x.forwarded_post_id,
 | 
						|
                        principalTable: "posts",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Restrict);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_posts_posts_replied_post_id",
 | 
						|
                        column: x => x.replied_post_id,
 | 
						|
                        principalTable: "posts",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Restrict);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_posts_publishers_publisher_id",
 | 
						|
                        column: x => x.publisher_id,
 | 
						|
                        principalTable: "publishers",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "publisher_features",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    flag = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
 | 
						|
                    expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    publisher_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_publisher_features", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_publisher_features_publishers_publisher_id",
 | 
						|
                        column: x => x.publisher_id,
 | 
						|
                        principalTable: "publishers",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "publisher_members",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    publisher_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    account_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    role = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    joined_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_publisher_members", x => new { x.publisher_id, x.account_id });
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_publisher_members_publishers_publisher_id",
 | 
						|
                        column: x => x.publisher_id,
 | 
						|
                        principalTable: "publishers",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "publisher_subscriptions",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    publisher_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    account_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    status = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    tier = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_publisher_subscriptions", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_publisher_subscriptions_publishers_publisher_id",
 | 
						|
                        column: x => x.publisher_id,
 | 
						|
                        principalTable: "publishers",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "sticker_packs",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    name = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
 | 
						|
                    description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
 | 
						|
                    prefix = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
 | 
						|
                    publisher_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_sticker_packs", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_sticker_packs_publishers_publisher_id",
 | 
						|
                        column: x => x.publisher_id,
 | 
						|
                        principalTable: "publishers",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "web_feeds",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    url = table.Column<string>(type: "character varying(8192)", maxLength: 8192, nullable: false),
 | 
						|
                    title = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
 | 
						|
                    description = table.Column<string>(type: "character varying(8192)", maxLength: 8192, nullable: true),
 | 
						|
                    preview = table.Column<LinkEmbed>(type: "jsonb", nullable: true),
 | 
						|
                    config = table.Column<WebFeedConfig>(type: "jsonb", nullable: false),
 | 
						|
                    publisher_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_web_feeds", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_web_feeds_publishers_publisher_id",
 | 
						|
                        column: x => x.publisher_id,
 | 
						|
                        principalTable: "publishers",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "chat_messages",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    type = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
 | 
						|
                    content = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
 | 
						|
                    meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
 | 
						|
                    members_mentioned = table.Column<List<Guid>>(type: "jsonb", nullable: true),
 | 
						|
                    nonce = table.Column<string>(type: "character varying(36)", maxLength: 36, nullable: false),
 | 
						|
                    edited_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    attachments = table.Column<List<SnCloudFileReferenceObject>>(type: "jsonb", nullable: false),
 | 
						|
                    replied_message_id = table.Column<Guid>(type: "uuid", nullable: true),
 | 
						|
                    forwarded_message_id = table.Column<Guid>(type: "uuid", nullable: true),
 | 
						|
                    sender_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    chat_room_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_chat_messages", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_chat_messages_chat_members_sender_id",
 | 
						|
                        column: x => x.sender_id,
 | 
						|
                        principalTable: "chat_members",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_chat_messages_chat_messages_forwarded_message_id",
 | 
						|
                        column: x => x.forwarded_message_id,
 | 
						|
                        principalTable: "chat_messages",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Restrict);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_chat_messages_chat_messages_replied_message_id",
 | 
						|
                        column: x => x.replied_message_id,
 | 
						|
                        principalTable: "chat_messages",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Restrict);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_chat_messages_chat_rooms_chat_room_id",
 | 
						|
                        column: x => x.chat_room_id,
 | 
						|
                        principalTable: "chat_rooms",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "chat_realtime_call",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    ended_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    sender_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    room_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    provider_name = table.Column<string>(type: "text", nullable: true),
 | 
						|
                    session_id = table.Column<string>(type: "text", nullable: true),
 | 
						|
                    upstream = table.Column<string>(type: "jsonb", nullable: true),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_chat_realtime_call", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_chat_realtime_call_chat_members_sender_id",
 | 
						|
                        column: x => x.sender_id,
 | 
						|
                        principalTable: "chat_members",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_chat_realtime_call_chat_rooms_room_id",
 | 
						|
                        column: x => x.room_id,
 | 
						|
                        principalTable: "chat_rooms",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "custom_app_secrets",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    secret = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
 | 
						|
                    description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
 | 
						|
                    expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    is_oidc = table.Column<bool>(type: "boolean", nullable: false),
 | 
						|
                    app_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_custom_app_secrets", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_custom_app_secrets_custom_apps_app_id",
 | 
						|
                        column: x => x.app_id,
 | 
						|
                        principalTable: "custom_apps",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "post_category_links",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    categories_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    posts_id = table.Column<Guid>(type: "uuid", nullable: false)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_post_category_links", x => new { x.categories_id, x.posts_id });
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_post_category_links_post_categories_categories_id",
 | 
						|
                        column: x => x.categories_id,
 | 
						|
                        principalTable: "post_categories",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_post_category_links_posts_posts_id",
 | 
						|
                        column: x => x.posts_id,
 | 
						|
                        principalTable: "posts",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "post_collection_links",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    collections_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    posts_id = table.Column<Guid>(type: "uuid", nullable: false)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_post_collection_links", x => new { x.collections_id, x.posts_id });
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_post_collection_links_post_collections_collections_id",
 | 
						|
                        column: x => x.collections_id,
 | 
						|
                        principalTable: "post_collections",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_post_collection_links_posts_posts_id",
 | 
						|
                        column: x => x.posts_id,
 | 
						|
                        principalTable: "posts",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "post_reactions",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    symbol = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
 | 
						|
                    attitude = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    post_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    account_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_post_reactions", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_post_reactions_posts_post_id",
 | 
						|
                        column: x => x.post_id,
 | 
						|
                        principalTable: "posts",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "post_tag_links",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    posts_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    tags_id = table.Column<Guid>(type: "uuid", nullable: false)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_post_tag_links", x => new { x.posts_id, x.tags_id });
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_post_tag_links_post_tags_tags_id",
 | 
						|
                        column: x => x.tags_id,
 | 
						|
                        principalTable: "post_tags",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_post_tag_links_posts_posts_id",
 | 
						|
                        column: x => x.posts_id,
 | 
						|
                        principalTable: "posts",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "stickers",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
 | 
						|
                    image_id = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
 | 
						|
                    image = table.Column<SnCloudFileReferenceObject>(type: "jsonb", nullable: true),
 | 
						|
                    pack_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_stickers", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_stickers_sticker_packs_pack_id",
 | 
						|
                        column: x => x.pack_id,
 | 
						|
                        principalTable: "sticker_packs",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "web_articles",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    title = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
 | 
						|
                    url = table.Column<string>(type: "character varying(8192)", maxLength: 8192, nullable: false),
 | 
						|
                    author = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
 | 
						|
                    meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
 | 
						|
                    preview = table.Column<LinkEmbed>(type: "jsonb", nullable: true),
 | 
						|
                    content = table.Column<string>(type: "text", nullable: true),
 | 
						|
                    published_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
 | 
						|
                    feed_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_web_articles", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_web_articles_web_feeds_feed_id",
 | 
						|
                        column: x => x.feed_id,
 | 
						|
                        principalTable: "web_feeds",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateTable(
 | 
						|
                name: "chat_reactions",
 | 
						|
                columns: table => new
 | 
						|
                {
 | 
						|
                    id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    message_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    sender_id = table.Column<Guid>(type: "uuid", nullable: false),
 | 
						|
                    symbol = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
 | 
						|
                    attitude = table.Column<int>(type: "integer", nullable: false),
 | 
						|
                    created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
 | 
						|
                    deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
 | 
						|
                },
 | 
						|
                constraints: table =>
 | 
						|
                {
 | 
						|
                    table.PrimaryKey("pk_chat_reactions", x => x.id);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_chat_reactions_chat_members_sender_id",
 | 
						|
                        column: x => x.sender_id,
 | 
						|
                        principalTable: "chat_members",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                    table.ForeignKey(
 | 
						|
                        name: "fk_chat_reactions_chat_messages_message_id",
 | 
						|
                        column: x => x.message_id,
 | 
						|
                        principalTable: "chat_messages",
 | 
						|
                        principalColumn: "id",
 | 
						|
                        onDelete: ReferentialAction.Cascade);
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_chat_messages_chat_room_id",
 | 
						|
                table: "chat_messages",
 | 
						|
                column: "chat_room_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_chat_messages_forwarded_message_id",
 | 
						|
                table: "chat_messages",
 | 
						|
                column: "forwarded_message_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_chat_messages_replied_message_id",
 | 
						|
                table: "chat_messages",
 | 
						|
                column: "replied_message_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_chat_messages_sender_id",
 | 
						|
                table: "chat_messages",
 | 
						|
                column: "sender_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_chat_reactions_message_id",
 | 
						|
                table: "chat_reactions",
 | 
						|
                column: "message_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_chat_reactions_sender_id",
 | 
						|
                table: "chat_reactions",
 | 
						|
                column: "sender_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_chat_realtime_call_room_id",
 | 
						|
                table: "chat_realtime_call",
 | 
						|
                column: "room_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_chat_realtime_call_sender_id",
 | 
						|
                table: "chat_realtime_call",
 | 
						|
                column: "sender_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_chat_rooms_realm_id",
 | 
						|
                table: "chat_rooms",
 | 
						|
                column: "realm_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_custom_app_secrets_app_id",
 | 
						|
                table: "custom_app_secrets",
 | 
						|
                column: "app_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_custom_app_secrets_secret",
 | 
						|
                table: "custom_app_secrets",
 | 
						|
                column: "secret",
 | 
						|
                unique: true);
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_custom_apps_publisher_id",
 | 
						|
                table: "custom_apps",
 | 
						|
                column: "publisher_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_post_category_links_posts_id",
 | 
						|
                table: "post_category_links",
 | 
						|
                column: "posts_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_post_collection_links_posts_id",
 | 
						|
                table: "post_collection_links",
 | 
						|
                column: "posts_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_post_collections_publisher_id",
 | 
						|
                table: "post_collections",
 | 
						|
                column: "publisher_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_post_reactions_post_id",
 | 
						|
                table: "post_reactions",
 | 
						|
                column: "post_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_post_tag_links_tags_id",
 | 
						|
                table: "post_tag_links",
 | 
						|
                column: "tags_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_posts_forwarded_post_id",
 | 
						|
                table: "posts",
 | 
						|
                column: "forwarded_post_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_posts_publisher_id",
 | 
						|
                table: "posts",
 | 
						|
                column: "publisher_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_posts_replied_post_id",
 | 
						|
                table: "posts",
 | 
						|
                column: "replied_post_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_posts_search_vector",
 | 
						|
                table: "posts",
 | 
						|
                column: "search_vector")
 | 
						|
                .Annotation("Npgsql:IndexMethod", "GIN");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_publisher_features_publisher_id",
 | 
						|
                table: "publisher_features",
 | 
						|
                column: "publisher_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_publisher_subscriptions_publisher_id",
 | 
						|
                table: "publisher_subscriptions",
 | 
						|
                column: "publisher_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_publishers_name",
 | 
						|
                table: "publishers",
 | 
						|
                column: "name",
 | 
						|
                unique: true);
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_publishers_realm_id",
 | 
						|
                table: "publishers",
 | 
						|
                column: "realm_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_realm_tags_tag_id",
 | 
						|
                table: "realm_tags",
 | 
						|
                column: "tag_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_realms_slug",
 | 
						|
                table: "realms",
 | 
						|
                column: "slug",
 | 
						|
                unique: true);
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_sticker_packs_prefix",
 | 
						|
                table: "sticker_packs",
 | 
						|
                column: "prefix",
 | 
						|
                unique: true);
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_sticker_packs_publisher_id",
 | 
						|
                table: "sticker_packs",
 | 
						|
                column: "publisher_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_stickers_pack_id",
 | 
						|
                table: "stickers",
 | 
						|
                column: "pack_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_stickers_slug",
 | 
						|
                table: "stickers",
 | 
						|
                column: "slug");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_web_articles_feed_id",
 | 
						|
                table: "web_articles",
 | 
						|
                column: "feed_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_web_articles_url",
 | 
						|
                table: "web_articles",
 | 
						|
                column: "url",
 | 
						|
                unique: true);
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_web_feeds_publisher_id",
 | 
						|
                table: "web_feeds",
 | 
						|
                column: "publisher_id");
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "ix_web_feeds_url",
 | 
						|
                table: "web_feeds",
 | 
						|
                column: "url",
 | 
						|
                unique: true);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <inheritdoc />
 | 
						|
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
						|
        {
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "chat_reactions");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "chat_realtime_call");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "custom_app_secrets");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "post_category_links");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "post_collection_links");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "post_reactions");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "post_tag_links");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "publisher_features");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "publisher_members");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "publisher_subscriptions");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "realm_members");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "realm_tags");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "stickers");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "web_articles");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "chat_messages");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "custom_apps");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "post_categories");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "post_collections");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "post_tags");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "posts");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "tags");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "sticker_packs");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "web_feeds");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "chat_members");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "publishers");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "chat_rooms");
 | 
						|
 | 
						|
            migrationBuilder.DropTable(
 | 
						|
                name: "realms");
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |