update entity id
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
import { Collection, Entity, Enum, ManyToOne, OneToMany, OptionalProps, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
import { FieldOption } from './field-option.entity';
|
||||
import { EntityType, FieldType } from '../interface/print';
|
||||
import { BaseEntity } from 'src/common/entities/base.entity';
|
||||
@@ -6,8 +6,7 @@ import { BaseEntity } from 'src/common/entities/base.entity';
|
||||
|
||||
@Entity({ tableName: 'field' })
|
||||
export class Field extends BaseEntity {
|
||||
@PrimaryKey({ type: 'bigint', autoincrement: true })
|
||||
id: number
|
||||
[OptionalProps]?: 'createdAt' | 'deletedAt'
|
||||
|
||||
@OneToMany(() => FieldOption, (attrValue) => attrValue.field)
|
||||
options = new Collection<FieldOption>(this)
|
||||
@@ -17,8 +16,8 @@ export class Field extends BaseEntity {
|
||||
entityType: EntityType;
|
||||
|
||||
// Foreign key based on entityType
|
||||
@Property({ type: 'bigint' })
|
||||
entityId: number;
|
||||
@Property({ type: 'string',columnType:'char(26)' })
|
||||
entityId: string;
|
||||
|
||||
@Property()
|
||||
name: string;
|
||||
|
||||
Reference in New Issue
Block a user