relq 1.0.92 → 1.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -431,6 +431,19 @@ function tableToAST(table) {
|
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
+
for (const col of columns) {
|
|
435
|
+
if (!col.isUnique)
|
|
436
|
+
continue;
|
|
437
|
+
const hasUniqueConstraint = constraints.some(c => c.type === 'UNIQUE' && c.columns.length === 1 && c.columns[0] === col.name);
|
|
438
|
+
if (!hasUniqueConstraint) {
|
|
439
|
+
constraints.push({
|
|
440
|
+
name: `${table.$name}_${col.name}_key`,
|
|
441
|
+
type: 'UNIQUE',
|
|
442
|
+
columns: [col.name],
|
|
443
|
+
trackingId: `${table.$name}_${col.name}_key`,
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
}
|
|
434
447
|
return {
|
|
435
448
|
name: table.$name,
|
|
436
449
|
schema: table.$schema || 'public',
|
|
@@ -14,7 +14,8 @@ function createTargetColumnRefs(table) {
|
|
|
14
14
|
const actualTableName = table.$name;
|
|
15
15
|
for (const colName of Object.keys(table.$columns)) {
|
|
16
16
|
const colDef = table.$columns[colName];
|
|
17
|
-
const
|
|
17
|
+
const config = colDef?.$config || colDef;
|
|
18
|
+
const actualColName = config?.$sqlName || config?.$columnName || colDef?.$sqlName || colDef?.$columnName || colName;
|
|
18
19
|
refs[colName] = createColumnRef(actualTableName, actualColName, colName);
|
|
19
20
|
}
|
|
20
21
|
return refs;
|
|
@@ -40,7 +41,8 @@ function createReferenceToBuilder(schema, currentTableKey) {
|
|
|
40
41
|
const toSqlColumnName = (tsColName) => {
|
|
41
42
|
const colDef = currentTable.$columns?.[tsColName];
|
|
42
43
|
if (colDef) {
|
|
43
|
-
|
|
44
|
+
const config = colDef.$config || colDef;
|
|
45
|
+
return config.$sqlName || config.$columnName || colDef.$sqlName || colDef.$columnName || tsColName;
|
|
44
46
|
}
|
|
45
47
|
return tsColName;
|
|
46
48
|
};
|
|
@@ -397,6 +397,19 @@ export function tableToAST(table) {
|
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
+
for (const col of columns) {
|
|
401
|
+
if (!col.isUnique)
|
|
402
|
+
continue;
|
|
403
|
+
const hasUniqueConstraint = constraints.some(c => c.type === 'UNIQUE' && c.columns.length === 1 && c.columns[0] === col.name);
|
|
404
|
+
if (!hasUniqueConstraint) {
|
|
405
|
+
constraints.push({
|
|
406
|
+
name: `${table.$name}_${col.name}_key`,
|
|
407
|
+
type: 'UNIQUE',
|
|
408
|
+
columns: [col.name],
|
|
409
|
+
trackingId: `${table.$name}_${col.name}_key`,
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
}
|
|
400
413
|
return {
|
|
401
414
|
name: table.$name,
|
|
402
415
|
schema: table.$schema || 'public',
|
|
@@ -10,7 +10,8 @@ function createTargetColumnRefs(table) {
|
|
|
10
10
|
const actualTableName = table.$name;
|
|
11
11
|
for (const colName of Object.keys(table.$columns)) {
|
|
12
12
|
const colDef = table.$columns[colName];
|
|
13
|
-
const
|
|
13
|
+
const config = colDef?.$config || colDef;
|
|
14
|
+
const actualColName = config?.$sqlName || config?.$columnName || colDef?.$sqlName || colDef?.$columnName || colName;
|
|
14
15
|
refs[colName] = createColumnRef(actualTableName, actualColName, colName);
|
|
15
16
|
}
|
|
16
17
|
return refs;
|
|
@@ -36,7 +37,8 @@ export function createReferenceToBuilder(schema, currentTableKey) {
|
|
|
36
37
|
const toSqlColumnName = (tsColName) => {
|
|
37
38
|
const colDef = currentTable.$columns?.[tsColName];
|
|
38
39
|
if (colDef) {
|
|
39
|
-
|
|
40
|
+
const config = colDef.$config || colDef;
|
|
41
|
+
return config.$sqlName || config.$columnName || colDef.$sqlName || colDef.$columnName || tsColName;
|
|
40
42
|
}
|
|
41
43
|
return tsColName;
|
|
42
44
|
};
|