28 lines
922 B
TypeScript
28 lines
922 B
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|||
|
|
|
||
|
|
export class CreatePlatformSettings1789046700000 implements MigrationInterface {
|
||
|
|
name = 'CreatePlatformSettings1789046700000';
|
||
|
|
|
||
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||
|
|
await queryRunner.query(`
|
||
|
|
CREATE TABLE IF NOT EXISTS "platform_settings" (
|
||
|
|
"id" smallint NOT NULL DEFAULT 1,
|
||
|
|
"login_hero_image_url" character varying(500),
|
||
|
|
"updated_at" TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||
|
|
CONSTRAINT "PK_platform_settings" PRIMARY KEY ("id"),
|
||
|
|
CONSTRAINT "CHK_platform_settings_singleton" CHECK ("id" = 1)
|
||
|
|
)
|
||
|
|
`);
|
||
|
|
|
||
|
|
await queryRunner.query(`
|
||
|
|
INSERT INTO "platform_settings" ("id")
|
||
|
|
VALUES (1)
|
||
|
|
ON CONFLICT ("id") DO NOTHING
|
||
|
|
`);
|
||
|
|
}
|
||
|
|
|
||
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||
|
|
await queryRunner.query(`DROP TABLE IF EXISTS "platform_settings"`);
|
||
|
|
}
|
||
|
|
}
|