pk, fk analyse, show in structure tab

This commit is contained in:
Jan Prochazka
2020-02-02 16:43:41 +01:00
parent 2a74718544
commit b76c12c7d7
10 changed files with 202 additions and 42 deletions

58
types/dbinfo.d.ts vendored
View File

@@ -1,24 +1,50 @@
export interface NamedObjectInfo {
pureName: string;
schemaName: string;
pureName: string;
schemaName: string;
}
export interface ColumnReference {
columnName: string;
refColumnName?: string;
}
export interface ConstraintInfo {
constraintName: string;
constraintType: string;
}
export interface ColumnsConstraintInfo extends ConstraintInfo {
columns: ConstraintInfo[];
}
export interface PrimaryKeyInfo extends ColumnsConstraintInfo {}
export interface ForeignKeyInfo extends ColumnsConstraintInfo {
refSchemaName: string;
refTableName: string;
updateAction: string;
deleteAction: string;
}
export interface ColumnInfo {
columnName: string;
notNull: boolean;
autoIncrement: boolean;
dataType: string;
precision: number;
scale: number;
length: number;
computedExpression: string;
isPersisted: boolean;
isSparse: boolean;
defaultValue: string;
defaultConstraint: string;
columnName: string;
notNull: boolean;
autoIncrement: boolean;
dataType: string;
precision: number;
scale: number;
length: number;
computedExpression: string;
isPersisted: boolean;
isSparse: boolean;
defaultValue: string;
defaultConstraint: string;
}
export interface TableInfo extends NamedObjectInfo {
columns: ColumnInfo[];
columns: ColumnInfo[];
primaryKey?: PrimaryKeyInfo;
foreignKeys: ForeignKeyInfo[];
}
export interface DatabaseInfo {
tables: TableInfo[];
tables: TableInfo[];
}

35
types/engines.d.ts vendored
View File

@@ -1,16 +1,25 @@
import { QueryResult } from "./query";
export interface EngineDriver {
connect({ server, port, user, password }: {
server: any;
port: any;
user: any;
password: any;
}): any;
query(pool: any, sql: string): Promise<QueryResult>;
getVersion(pool: any): Promise<string>;
listDatabases(pool: any): Promise<{
name: string;
}[]>;
analyseFull(pool: any): Promise<void>;
analyseIncremental(pool: any): Promise<void>;
connect({
server,
port,
user,
password
}: {
server: any;
port: any;
user: any;
password: any;
}): any;
query(pool: any, sql: string): Promise<QueryResult>;
getVersion(pool: any): Promise<string>;
listDatabases(
pool: any
): Promise<
{
name: string;
}[]
>;
analyseFull(pool: any): Promise<void>;
analyseIncremental(pool: any): Promise<void>;
}

9
types/index.d.ts vendored
View File

@@ -1,11 +1,10 @@
/// <reference types="node" />
import { ChildProcess } from "child_process";
import { DatabaseInfo } from "./dbinfo";
export interface OpenedDatabaseConnection {
conid: string;
database: string;
structure: DatabaseInfo;
subprocess: ChildProcess;
conid: string;
database: string;
structure: DatabaseInfo;
subprocess: ChildProcess;
}
export * from "./engines";
export * from "./dbinfo";