export type FieldType = 'string' | 'text' | 'integer' | 'bigint' | 'smallint' | 'decimal' | 'float' | 'double' | 'uuid' | 'boolean' | 'date' | 'time' | 'datetime' | 'timestamp' | 'binary' | 'blob' | 'json' | 'object' | 'array' | 'enum'; export interface IFieldDefinition { name: string; type: FieldType; nullable?: boolean; unique?: boolean; primaryKey?: boolean; autoGenerate?: boolean; defaultValue?: unknown; maxLength?: number; precision?: number; scale?: number; enumValues?: string[]; arrayElementType?: FieldType; } export interface ICreateCollectionOp { type: 'createCollection'; name: string; fields: IFieldDefinition[]; ifNotExists?: boolean; } export interface IDropCollectionOp { type: 'dropCollection'; name: string; ifExists?: boolean; cascade?: boolean; } export interface IAddFieldOp { type: 'addField'; collection: string; field: IFieldDefinition; } export interface IDropFieldOp { type: 'dropField'; collection: string; fieldName: string; cascade?: boolean; } export interface ICreateIndexOp { type: 'createIndex'; collection: string; name: string; fields: Array<{ name: string; order?: 'asc' | 'desc'; }>; unique?: boolean; sparse?: boolean; ifNotExists?: boolean; sqlOptions?: { method?: string; where?: string; include?: string[]; concurrent?: boolean; }; mongoOptions?: { expireAfterSeconds?: number; partialFilterExpression?: Record; collation?: Record; }; } export interface IDropIndexOp { type: 'dropIndex'; collection: string; name: string; ifExists?: boolean; } export type IMigrationOperation = ICreateCollectionOp | IDropCollectionOp | IAddFieldOp | IDropFieldOp | ICreateIndexOp | IDropIndexOp; export interface IMigration { tag: string; name: string; description?: string; up: IMigrationOperation[]; down: IMigrationOperation[]; dependencies?: string[]; createdAt?: string; } export interface IMigrationHistory { tag: string; name: string; checksum?: string; appliedAt?: string; }