Some checks failed
Queue Release Build / prepare (push) Successful in 15s
Deploy Web Apps / deploy (push) Successful in 10m52s
Queue Release Build / build-windows (push) Failing after 7m46s
Queue Release Build / build-linux (push) Successful in 23m48s
Queue Release Build / finalize (push) Has been skipped
18 lines
684 B
TypeScript
18 lines
684 B
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
|
|
export class ServerChannels1000000000002 implements MigrationInterface {
|
|
name = 'ServerChannels1000000000002';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
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<void> {
|
|
await queryRunner.query(`ALTER TABLE "servers" DROP COLUMN "channels"`);
|
|
}
|
|
}
|