summary refs log tree commit diff
path: root/src/util/migration/postgres/1720628601997-badges.ts
blob: f7b9958bf85c8bb744f6a545f16474545fc743e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { MigrationInterface, QueryRunner } from "typeorm";

export class Badges1720628601997 implements MigrationInterface {
	name = "Badges1720628601997";

	public async up(queryRunner: QueryRunner): Promise<void> {
		await queryRunner.query(
			`CREATE TABLE "badges" ("id" character varying NOT NULL, "description" character varying NOT NULL, "icon" character varying NOT NULL, "link" character varying, CONSTRAINT "PK_8a651318b8de577e8e217676466" PRIMARY KEY ("id"))`,
		);
		await queryRunner.query(`ALTER TABLE "users" ADD "badge_ids" text`);
	}

	public async down(queryRunner: QueryRunner): Promise<void> {
		await queryRunner.query(`ALTER TABLE "users" DROP COLUMN "badge_ids"`);
	}
}