mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 23:35:59 +00:00
SYNC: Merge branch 'feature/audit-logs'
This commit is contained in:
committed by
Diflow
parent
e3c6d05a0a
commit
90bbdd563b
@@ -31,6 +31,11 @@ export interface IndexInfoYaml {
|
||||
included?: string[];
|
||||
}
|
||||
|
||||
export interface UniqueInfoYaml {
|
||||
name: string;
|
||||
columns: string[];
|
||||
}
|
||||
|
||||
export interface TableInfoYaml {
|
||||
name: string;
|
||||
// schema?: string;
|
||||
@@ -38,6 +43,7 @@ export interface TableInfoYaml {
|
||||
primaryKey?: string[];
|
||||
sortingKey?: string[];
|
||||
indexes?: IndexInfoYaml[];
|
||||
uniques?: UniqueInfoYaml[];
|
||||
|
||||
insertKey?: string[];
|
||||
insertOnly?: string[];
|
||||
@@ -121,6 +127,12 @@ export function tableInfoToYaml(table: TableInfo): TableInfoYaml {
|
||||
return idx;
|
||||
});
|
||||
}
|
||||
if (tableCopy.uniques?.length > 0) {
|
||||
res.uniques = tableCopy.uniques.map(unique => ({
|
||||
name: unique.constraintName,
|
||||
columns: unique.columns.map(x => x.columnName),
|
||||
}));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -165,6 +177,12 @@ export function tableInfoFromYaml(table: TableInfoYaml, allTables: TableInfoYaml
|
||||
...(index.included || []).map(columnName => ({ columnName, isIncludedColumn: true })),
|
||||
],
|
||||
})),
|
||||
uniques: table.uniques?.map(unique => ({
|
||||
constraintName: unique.name,
|
||||
pureName: table.name,
|
||||
constraintType: 'unique',
|
||||
columns: unique.columns.map(columnName => ({ columnName })),
|
||||
})),
|
||||
};
|
||||
if (table.primaryKey) {
|
||||
res.primaryKey = {
|
||||
|
||||
Reference in New Issue
Block a user