feat(app.entity): add exposed and domain fields
This commit is contained in:
parent
f0607b5db0
commit
015e168634
2 changed files with 30 additions and 0 deletions
|
@ -0,0 +1,22 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AppExposedDomain1662036689477 implements MigrationInterface {
|
||||
name = 'AppExposedDomain1662036689477';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query('ALTER TABLE "app" ADD "exposed" boolean DEFAULT false');
|
||||
// populate all apps with exposed to false
|
||||
await queryRunner.query('UPDATE "app" SET "exposed" = false');
|
||||
// add NOT NULL constraint
|
||||
await queryRunner.query('ALTER TABLE "app" ALTER COLUMN "exposed" SET NOT NULL');
|
||||
|
||||
await queryRunner.query('ALTER TABLE "app" ADD "domain" character varying');
|
||||
await queryRunner.query('ALTER TABLE "app" ALTER COLUMN "version" SET DEFAULT \'1\'');
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query('ALTER TABLE "app" ALTER COLUMN "version" SET DEFAULT \'0\'');
|
||||
await queryRunner.query('ALTER TABLE "app" DROP COLUMN "domain"');
|
||||
await queryRunner.query('ALTER TABLE "app" DROP COLUMN "exposed"');
|
||||
}
|
||||
}
|
|
@ -55,6 +55,14 @@ class App extends BaseEntity {
|
|||
@UpdateDateColumn()
|
||||
updatedAt!: Date;
|
||||
|
||||
@Field(() => Boolean)
|
||||
@Column({ type: 'boolean', default: false, nullable: false })
|
||||
exposed!: boolean;
|
||||
|
||||
@Field(() => String)
|
||||
@Column({ type: 'varchar', nullable: true })
|
||||
domain?: string;
|
||||
|
||||
@Field(() => AppInfo, { nullable: true })
|
||||
info(): AppInfo | null {
|
||||
return getAppInfo(this.id);
|
||||
|
|
Loading…
Add table
Reference in a new issue