summary refs log tree commit diff
path: root/src/util/migrations/postgres/1661785263936-guild-member-profiles.ts
blob: af0f2a337f3a9b76b0c89e60b421e1e053cbd99a (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { MigrationInterface, QueryRunner } from "typeorm";

export class guildMemberProfiles1661785263936 implements MigrationInterface {
    name = 'guildMemberProfiles1661785263936'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`
            ALTER TABLE "connected_accounts" DROP COLUMN "external_id"
        `);
        await queryRunner.query(`
            ALTER TABLE "connected_accounts" DROP COLUMN "integrations"
        `);
        await queryRunner.query(`
            ALTER TABLE "members"
            ADD "avatar" character varying
        `);
        await queryRunner.query(`
            ALTER TABLE "members"
            ADD "banner" character varying
        `);
        await queryRunner.query(`
            ALTER TABLE "members"
            ADD "bio" character varying NOT NULL
        `);
        await queryRunner.query(`
            ALTER TABLE "members"
            ADD "communication_disabled_until" TIMESTAMP
        `);
        await queryRunner.query(`
            ALTER TABLE "connected_accounts"
            ALTER COLUMN "access_token"
            SET NOT NULL
        `);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`
            ALTER TABLE "connected_accounts"
            ALTER COLUMN "access_token" DROP NOT NULL
        `);
        await queryRunner.query(`
            ALTER TABLE "members" DROP COLUMN "communication_disabled_until"
        `);
        await queryRunner.query(`
            ALTER TABLE "members" DROP COLUMN "bio"
        `);
        await queryRunner.query(`
            ALTER TABLE "members" DROP COLUMN "banner"
        `);
        await queryRunner.query(`
            ALTER TABLE "members" DROP COLUMN "avatar"
        `);
        await queryRunner.query(`
            ALTER TABLE "connected_accounts"
            ADD "integrations" text NOT NULL
        `);
        await queryRunner.query(`
            ALTER TABLE "connected_accounts"
            ADD "external_id" character varying NOT NULL
        `);
    }

}