mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-08 06:59:26 +08:00
22 lines
457 B
TypeScript
22 lines
457 B
TypeScript
import { DataTypes } from 'sequelize';
|
|
import { BaseColumnFieldOptions, Field, FieldContext } from './field';
|
|
|
|
export class UuidField extends Field {
|
|
constructor(options?: any, context?: FieldContext) {
|
|
super(
|
|
{
|
|
defaultValue: DataTypes.UUIDV4,
|
|
...options,
|
|
},
|
|
context,
|
|
);
|
|
}
|
|
get dataType() {
|
|
return DataTypes.UUID;
|
|
}
|
|
}
|
|
|
|
export interface UUIDFieldOptions extends BaseColumnFieldOptions {
|
|
type: 'uuid';
|
|
}
|