init
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { Entity, PrimaryKey, Property, OptionalProps } from '@mikro-orm/core';
|
||||
|
||||
@Entity({ tableName: 'admns' })
|
||||
export class Admin {
|
||||
[OptionalProps]?: 'id' | 'createdAt' | 'updatedAt';
|
||||
|
||||
@PrimaryKey()
|
||||
id!: number;
|
||||
|
||||
@Property({ nullable: true })
|
||||
firstName?: string;
|
||||
|
||||
@Property({ nullable: true })
|
||||
lastName?: string;
|
||||
|
||||
@Property({ unique: true })
|
||||
phone!: string;
|
||||
|
||||
@Property({ defaultRaw: 'now()', columnType: 'timestamptz' })
|
||||
createdAt: Date = new Date();
|
||||
|
||||
@Property({ onUpdate: () => new Date(), defaultRaw: 'now()', columnType: 'timestamptz' })
|
||||
updatedAt: Date = new Date();
|
||||
}
|
||||
Reference in New Issue
Block a user