"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddChatMessagingSystem1755817306222 = void 0;
class AddChatMessagingSystem1755817306222 {
    constructor() {
        this.name = 'AddChatMessagingSystem1755817306222';
    }
    async up(queryRunner) {
        await queryRunner.query(`CREATE TABLE "ChatArchives" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "chatId" uuid NOT NULL, "archivedMessages" json NOT NULL, "archivedAt" TIMESTAMP NOT NULL, "createDate" TIMESTAMP NOT NULL DEFAULT now(), "chatType" character varying(50) NOT NULL, "chatName" character varying(255), "gameId" uuid, "participants" uuid array NOT NULL, CONSTRAINT "PK_fe62979fc2061d7afe278d3f14e" PRIMARY KEY ("id"))`);
        await queryRunner.query(`ALTER TABLE "Chats" ADD "type" character varying(50) NOT NULL DEFAULT 'direct'`);
        await queryRunner.query(`ALTER TABLE "Chats" ADD "name" character varying(255)`);
        await queryRunner.query(`ALTER TABLE "Chats" ADD "gameId" uuid`);
        await queryRunner.query(`ALTER TABLE "Chats" ADD "createdBy" uuid`);
        await queryRunner.query(`ALTER TABLE "Chats" ADD "lastActivity" TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE "Chats" ADD "createDate" TIMESTAMP NOT NULL DEFAULT now()`);
        await queryRunner.query(`ALTER TABLE "Chats" ADD "archiveDate" TIMESTAMP`);
        await queryRunner.query(`ALTER TABLE "Chats" ALTER COLUMN "messages" SET DEFAULT '[]'`);
    }
    async down(queryRunner) {
        await queryRunner.query(`ALTER TABLE "Chats" ALTER COLUMN "messages" DROP DEFAULT`);
        await queryRunner.query(`ALTER TABLE "Chats" DROP COLUMN "archiveDate"`);
        await queryRunner.query(`ALTER TABLE "Chats" DROP COLUMN "createDate"`);
        await queryRunner.query(`ALTER TABLE "Chats" DROP COLUMN "lastActivity"`);
        await queryRunner.query(`ALTER TABLE "Chats" DROP COLUMN "createdBy"`);
        await queryRunner.query(`ALTER TABLE "Chats" DROP COLUMN "gameId"`);
        await queryRunner.query(`ALTER TABLE "Chats" DROP COLUMN "name"`);
        await queryRunner.query(`ALTER TABLE "Chats" DROP COLUMN "type"`);
        await queryRunner.query(`DROP TABLE "ChatArchives"`);
    }
}
exports.AddChatMessagingSystem1755817306222 = AddChatMessagingSystem1755817306222;
//# sourceMappingURL=1755817306222-AddChatMessagingSystem.js.map