Skip to content

Commit 26ab288

Browse files
authored
fix: handle boolean values for primary and unique index checks (#47)
* fix: handle boolean values for primary and unique index checks * fix: Unknown property type 'LONGTEXT' in mysql. * support longtext.
1 parent 14b4764 commit 26ab288

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

packages/orm-property/src/transformers/mysql.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ function colInfoToProperty(colInfo: ColumnInfoMySQL) {
221221
case "TEXT":
222222
property.type = "text";
223223
break;
224+
case "LONGTEXT":
225+
property.type = "longtext";
226+
break;
224227
case "POINT":
225228
property.type = "point";
226229
break;
@@ -389,4 +392,4 @@ export const filterRawColumns: IPropTransformer<ColumnInfoMySQL>['filterRawColum
389392
}
390393

391394
return col;
392-
}
395+
}

packages/sql-ddl-sync/src/Dialects/postgresql.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ function convertIndexRows(
450450
const indexes: Record<string, FxOrmSqlDDLSync__DbIndex.CollectionDbIndexInfo> = {};
451451

452452
for (let i = 0; i < rows.length; i++) {
453-
if (rows[i].indisprimary === '1') {
453+
if (rows[i].indisprimary === '1' || rows[i].indisprimary === true) {
454454
continue;
455455
}
456456

@@ -461,12 +461,12 @@ function convertIndexRows(
461461
collection,
462462
name: idx_name,
463463
columns : [],
464-
unique : rows[i].indisunique === '1',
464+
unique: rows[i].indisunique === '1' || rows[i].indisunique === true,
465465
};
466466
}
467467

468468
indexes[idx_name].columns.push(rows[i].attname);
469469
}
470470

471471
return indexes;
472-
}
472+
}

0 commit comments

Comments
 (0)