import { MigrationInterface, QueryRunner } from 'typeorm'; export class ServerChannels1000000000002 implements MigrationInterface { name = 'ServerChannels1000000000002'; public async up(queryRunner: QueryRunner): Promise { const columns: { name: string }[] = await queryRunner.query(`PRAGMA table_info("servers")`); const hasChannels = columns.some(c => c.name === 'channels'); if (!hasChannels) { await queryRunner.query(`ALTER TABLE "servers" ADD COLUMN "channels" TEXT NOT NULL DEFAULT '[]'`); } } public async down(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "servers" DROP COLUMN "channels"`); } }