import models tests fixed

This commit is contained in:
Jan Prochazka
2025-02-25 13:58:03 +01:00
parent ec02743f83
commit a4d3189dac
9 changed files with 60 additions and 14 deletions

View File

@@ -4,6 +4,7 @@
const { SqlDumper } = global.DBGATE_PACKAGES['dbgate-tools'];
const numericDataTypes = ['tinyint', 'smallint', 'int', 'bigint', 'varint', 'float', 'double', 'decimal'];
const stringDataTypes = ['text', 'varchar'];
class Dumper extends SqlDumper {
/**
@@ -64,7 +65,12 @@ class Dumper extends SqlDumper {
}
if (numericDataTypes.includes(dataType?.toLowerCase()) && !Number.isNaN(parseFloat(value))) {
this.putRaw(value);
this.putRaw(parseFloat(value));
return;
}
if (stringDataTypes.includes(dataType?.toLowerCase())) {
super.putValue(value?.toString());
return;
}

View File

@@ -36,6 +36,10 @@ class Dumper extends SqlDumper {
}
super.createTablePrimaryKeyCore(table);
}
enableAllForeignKeys(enabled) {
this.putCmd('^pragma ^foreign_keys = %s', enabled ? 'on' : 'off');
}
}
module.exports = Dumper;

View File

@@ -30,11 +30,13 @@ const dialect = {
createIndex: true,
dropIndex: true,
createForeignKey: false,
enableForeignKeyChecks: false,
dropForeignKey: false,
createPrimaryKey: false,
dropPrimaryKey: false,
dropReferencesWhenDropTable: false,
filteredIndexes: true,
anonymousForeignKey: true,
};
/** @type {import('dbgate-types').EngineDriver} */