diff --git a/app/gen-server/entity/ServiceAccount.ts b/app/gen-server/entity/ServiceAccount.ts index daf07cc64e..db57aab5e3 100644 --- a/app/gen-server/entity/ServiceAccount.ts +++ b/app/gen-server/entity/ServiceAccount.ts @@ -7,11 +7,10 @@ export class ServiceAccount extends BaseEntity { @PrimaryGeneratedColumn() public id: number; - @Column({type: String}) public description: string; - @Column({type: Date, default: Date.now()}) + @Column({type: Date, nullable: false}) public endOfLife: string; @ManyToOne(type => User) diff --git a/app/gen-server/migration/1730215435023-ServiceAccounts.ts b/app/gen-server/migration/1730215435023-ServiceAccounts.ts index b2f1a9fdae..5b217365a1 100644 --- a/app/gen-server/migration/1730215435023-ServiceAccounts.ts +++ b/app/gen-server/migration/1730215435023-ServiceAccounts.ts @@ -1,8 +1,12 @@ import { MigrationInterface, QueryRunner, Table, TableColumn, TableForeignKey, TableIndex } from "typeorm"; +import * as sqlUtils from "app/gen-server/sqlUtils"; export class ServiceAccounts1730215435023 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { + const dbType = queryRunner.connection.driver.options.type; + const datetime = sqlUtils.datetime(dbType); + await queryRunner.addColumn('users', new TableColumn({ name: 'type', type: 'varchar', @@ -24,8 +28,8 @@ export class ServiceAccounts1730215435023 implements MigrationInterface { }, { name: 'endOfLife', - type: 'date', - default: 'now()', + type: datetime, + isNullable: false, }, ], })