2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 23:00:56 +00:00
books/backend/database/types.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

58 lines
1.1 KiB
TypeScript
Raw Normal View History

import { Field, RawValue } from '../../schemas/types';
import DatabaseCore from './core';
2022-03-25 10:12:39 +00:00
import { DatabaseManager } from './manager';
2022-03-23 06:16:13 +00:00
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 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;
};
priority?: number;
}
2022-03-25 10:12:39 +00:00
export type KnexColumnType =
| 'text'
| 'integer'
| 'float'
| 'boolean'
| 'date'
| 'datetime'
| 'time'
| 'binary';
2022-03-28 10:01:29 +00:00
// Returned by pragma table_info
export interface SqliteTableInfo {
pk: number;
cid: number;
name: string;
type: string;
notnull: number; // 0 | 1
dflt_value: string | null;
}
export type BespokeFunction = (
db: DatabaseCore,
...args: unknown[]
) => Promise<unknown>;
export type SingleValue<T> = {
fieldname: string;
parent: string;
value: T;
}[];