diff --git a/database/entity/System.ts b/database/entity/System.ts new file mode 100644 index 0000000..7dd7243 --- /dev/null +++ b/database/entity/System.ts @@ -0,0 +1,47 @@ +import {Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, Unique} from "typeorm" + +@Entity({name: "System", synchronize: true}) +@Unique("UQ_System_userid", ['userid']) +@Unique("UQ_System_shortid", ['shortid']) +export class System { + + @PrimaryGeneratedColumn() + id: number + + @Column({ + nullable: true, + }) + shortid: string + + @Column() + userid: string + + @Column({ + length: 100, + nullable: true + }) + name: string + + @Column({ + type: "varchar", + nullable: true, + length: 100 + }) + fronter: string + + @Column({ + nullable: true, + }) + grouptag: string + + @Column({ + nullable: true, + }) + autoproxy: string + + @CreateDateColumn({ type: 'timestamptz' }) + createdAt: Date + + @UpdateDateColumn({ type: 'timestamptz' }) + updatedAt: Date +} diff --git a/database/migrations/1773670748825-update.ts b/database/migrations/1773670748825-update.ts new file mode 100644 index 0000000..d61b9b4 --- /dev/null +++ b/database/migrations/1773670748825-update.ts @@ -0,0 +1,14 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class Update1773670748825 implements MigrationInterface { + name = 'Update1773670748825' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`CREATE TABLE "System" ("id" SERIAL NOT NULL, "shortid" character varying, "userid" character varying NOT NULL, "name" character varying(100), "fronter" character varying(100), "grouptag" character varying, "autoproxy" character varying, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "UQ_System_shortid" UNIQUE ("shortid"), CONSTRAINT "UQ_System_userid" UNIQUE ("userid"), CONSTRAINT "PK_b8e3f6855de5a4758fcb59e5567" PRIMARY KEY ("id"))`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP TABLE "System"`); + } + +}