SYNC: Merge branch 'feature/audit-logs'

This commit is contained in:
SPRINX0\prochazka
2025-06-27 13:05:26 +02:00
committed by Diflow
parent e3c6d05a0a
commit 90bbdd563b
24 changed files with 781 additions and 63 deletions

View File

@@ -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 = {