This repository has been archived on 2026-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
ServerSpacebarOld/util/src/migrations/1660689892073-mobileFixes2.ts
2022-08-21 20:00:35 +10:00

37 lines
1.2 KiB
TypeScript

import { MigrationInterface, QueryRunner } from "typeorm";
export class mobileFixes21660689892073 implements MigrationInterface {
name = 'mobileFixes21660689892073'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE \`user_settings\`
ADD \`banner_color\` varchar(255) NULL
`);
await queryRunner.query(`
UPDATE \`channels\` SET \`nsfw\` = 0 WHERE \`nsfw\` = NULL
`);
await queryRunner.query(`
ALTER TABLE \`channels\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL
`);
await queryRunner.query(`
UPDATE \`guilds\` SET \`nsfw\` = 0 WHERE \`nsfw\` = NULL
`);
await queryRunner.query(`
ALTER TABLE \`guilds\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE \`guilds\` CHANGE \`nsfw\` \`nsfw\` tinyint NULL
`);
await queryRunner.query(`
ALTER TABLE \`channels\` CHANGE \`nsfw\` \`nsfw\` tinyint NULL
`);
await queryRunner.query(`
ALTER TABLE \`user_settings\` DROP COLUMN \`banner_color\`
`);
}
}