export class RestoreShogi1783660000000 {
    name = "RestoreShogi1783660000000";
    async up(queryRunner) {
        await queryRunner.query(`CREATE TABLE IF NOT EXISTS "shogi_game" ("id" character varying(32) NOT NULL, "startedAt" TIMESTAMP WITH TIME ZONE, "endedAt" TIMESTAMP WITH TIME ZONE, "user1Id" character varying(32) NOT NULL, "user2Id" character varying(32) NOT NULL, "user1Ready" boolean NOT NULL DEFAULT false, "user2Ready" boolean NOT NULL DEFAULT false, "sente" integer, "isStarted" boolean NOT NULL DEFAULT false, "isEnded" boolean NOT NULL DEFAULT false, "winnerId" character varying(32), "surrenderedUserId" character varying(32), "sfen" text NOT NULL, "logs" jsonb NOT NULL DEFAULT '[]', CONSTRAINT "PK_shogi_game" PRIMARY KEY ("id"))`);
        await queryRunner.query(`DO $$ BEGIN ALTER TABLE "shogi_game" ADD CONSTRAINT "FK_shogi_game_user1" FOREIGN KEY ("user1Id") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION; EXCEPTION WHEN duplicate_object THEN NULL; END $$`);
        await queryRunner.query(`DO $$ BEGIN ALTER TABLE "shogi_game" ADD CONSTRAINT "FK_shogi_game_user2" FOREIGN KEY ("user2Id") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION; EXCEPTION WHEN duplicate_object THEN NULL; END $$`);
    }
    async down(queryRunner) {
        await queryRunner.query(`DROP TABLE IF EXISTS "shogi_game"`);
    }
}
