added system model and migration

This commit is contained in:
Aster Fialla
2026-03-17 09:17:15 -04:00
parent 96c2abc06a
commit ff4dba3dfd
2 changed files with 61 additions and 0 deletions

47
database/entity/System.ts Normal file
View File

@@ -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
}

View File

@@ -0,0 +1,14 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class Update1773670748825 implements MigrationInterface {
name = 'Update1773670748825'
public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
await queryRunner.query(`DROP TABLE "System"`);
}
}