2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00
books/backend/database/types.ts

49 lines
964 B
TypeScript
Raw Normal View History

import { Field, RawValue } from '../../schemas/types';
2022-03-25 10:12:39 +00:00
import { DatabaseManager } from './manager';
2022-03-23 06:16:13 +00:00
export type QueryFilter = Record<string, string | string[]>;
export interface GetQueryBuilderOptions {
2022-03-25 10:12:39 +00:00
offset?: number;
limit?: number;
groupBy?: string;
orderBy?: string;
order?: 'desc' | 'asc';
2022-03-23 06:16:13 +00:00
}
export interface GetAllOptions {
2022-03-25 10:12:39 +00:00
schemaName: string;
fields?: string[];
2022-03-25 10:12:39 +00:00
filters?: QueryFilter;
start?: number;
limit?: number;
groupBy?: string;
orderBy?: string;
order?: 'asc' | 'desc';
}
export type ColumnDiff = { added: Field[]; removed: string[] };
export type FieldValueMap = Record<
string,
RawValue | undefined | FieldValueMap[]
>;
export interface Patch {
name: string;
version: string;
patch: {
2022-03-25 10:12:39 +00:00
execute: (dm: DatabaseManager) => Promise<void>;
beforeMigrate?: boolean;
};
}
2022-03-25 10:12:39 +00:00
export type KnexColumnType =
| 'text'
| 'integer'
| 'float'
| 'boolean'
| 'date'
| 'datetime'
| 'time'
| 'binary';