summary refs log tree commit diff
path: root/src/util/migrations/1660689892073-mobileFixes2.ts
blob: 63e7e032ef5ab5cc694f943d4cd8b31515675fb1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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\`
        `);
	}
}