UNPKG

dbgate-tools

Version:

Auxiliary tools for other DbGate packages.

47 lines (46 loc) 1.28 kB
import { TableInfo, DatabaseInfo } from 'dbgate-types'; export interface ColumnInfoYaml { name: string; type: string; notNull?: boolean; length?: number; autoIncrement?: boolean; references?: string; refDeleteAction?: string; refUpdateAction?: string; primaryKey?: boolean; default?: string; } export interface DatabaseModelFile { name: string; text: string; json: {}; } export interface IndexInfoYaml { name: string; unique?: boolean; filter?: string; columns: string[]; included?: string[]; } export interface UniqueInfoYaml { name: string; columns: string[]; } export interface TableInfoYaml { name: string; columns: ColumnInfoYaml[]; primaryKey?: string[]; sortingKey?: string[]; indexes?: IndexInfoYaml[]; uniques?: UniqueInfoYaml[]; insertKey?: string[]; insertOnly?: string[]; data?: any[]; } export interface ForeignKeyInfoYaml { deleteAction?: string; } export declare function tableInfoToYaml(table: TableInfo): TableInfoYaml; export declare function tableInfoFromYaml(table: TableInfoYaml, allTables: TableInfoYaml[]): TableInfo; export declare function databaseInfoFromYamlModel(filesOrDbInfo: DatabaseModelFile[] | DatabaseInfo): DatabaseInfo;