fix(cassandra): do not add 2nd id column

This commit is contained in:
Nybkox
2025-02-04 11:47:35 +01:00
parent ac4e411d41
commit 38ce62185e

View File

@@ -93,6 +93,8 @@ const driver = {
: mysqlSplitterOptions, : mysqlSplitterOptions,
adaptTableInfo(table) { adaptTableInfo(table) {
if (!table.primaryKey && !table.sortingKey) { if (!table.primaryKey && !table.sortingKey) {
const hasIdColumn = table.columns.some((x) => x.columnName == 'id');
return { return {
...table, ...table,
primaryKey: { primaryKey: {
@@ -103,10 +105,14 @@ const driver = {
], ],
}, },
columns: [ columns: [
{ ...(!hasIdColumn
columnName: 'id', ? [
dataType: 'uuid', {
}, columnName: 'id',
dataType: 'uuid',
},
]
: []),
...table.columns, ...table.columns,
], ],
}; };