mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
fix(sap): incorrect handling of simple array/json data type (#11322)
This commit is contained in:
parent
04ca83a72f
commit
27b4207c48
@ -99,17 +99,18 @@ export class SapDriver implements Driver {
|
||||
/**
|
||||
* Gets list of supported column data types by a driver.
|
||||
*
|
||||
* @see https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.03/en-US/20a1569875191014b507cf392724b7eb.html
|
||||
* @see https://help.sap.com/docs/SAP_HANA_PLATFORM/4fe29514fd584807ac9f2a04f6754767/20a1569875191014b507cf392724b7eb.html
|
||||
* @see https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/data-types
|
||||
*/
|
||||
supportedDataTypes: ColumnType[] = [
|
||||
"tinyint",
|
||||
"smallint",
|
||||
"int",
|
||||
"int", // alias for "integer"
|
||||
"integer",
|
||||
"bigint",
|
||||
"smalldecimal",
|
||||
"decimal",
|
||||
"dec",
|
||||
"dec", // alias for "decimal"
|
||||
"real",
|
||||
"double",
|
||||
"float",
|
||||
@ -118,17 +119,17 @@ export class SapDriver implements Driver {
|
||||
"seconddate",
|
||||
"timestamp",
|
||||
"boolean",
|
||||
"char",
|
||||
"nchar",
|
||||
"varchar",
|
||||
"char", // not officially supported
|
||||
"nchar", // not officially supported
|
||||
"varchar", // deprecated
|
||||
"nvarchar",
|
||||
"text",
|
||||
"alphanum",
|
||||
"shorttext",
|
||||
"text", // deprecated
|
||||
"alphanum", // deprecated
|
||||
"shorttext", // deprecated
|
||||
"array",
|
||||
"varbinary",
|
||||
"blob",
|
||||
"clob",
|
||||
"clob", // deprecated
|
||||
"nclob",
|
||||
"st_geometry",
|
||||
"st_point",
|
||||
@ -565,6 +566,8 @@ export class SapDriver implements Driver {
|
||||
}): string {
|
||||
if (column.type === Number || column.type === "int") {
|
||||
return "integer"
|
||||
} else if (column.type === "dec") {
|
||||
return "decimal"
|
||||
} else if (column.type === String) {
|
||||
return "nvarchar"
|
||||
} else if (column.type === Date) {
|
||||
@ -579,7 +582,7 @@ export class SapDriver implements Driver {
|
||||
column.type === "simple-array" ||
|
||||
column.type === "simple-json"
|
||||
) {
|
||||
return "text"
|
||||
return "nclob"
|
||||
} else if (column.type === "simple-enum") {
|
||||
return "nvarchar"
|
||||
} else {
|
||||
|
||||
@ -24,6 +24,7 @@ describe("database schema > column types > sap", () => {
|
||||
it("all types should work correctly - persist and hydrate", () =>
|
||||
Promise.all(
|
||||
connections.map(async (connection) => {
|
||||
// this test contains data types that are available only in SAP HANA 2.0 and that have been removed in SAP HANA Cloud
|
||||
const postRepository = connection.getRepository(Post)
|
||||
const queryRunner = connection.createQueryRunner()
|
||||
const table = await queryRunner.getTable("post")
|
||||
@ -179,7 +180,7 @@ describe("database schema > column types > sap", () => {
|
||||
.type.should.be.equal("varbinary")
|
||||
table!
|
||||
.findColumnByName("simpleArray")!
|
||||
.type.should.be.equal("text")
|
||||
.type.should.be.equal("nclob")
|
||||
}),
|
||||
))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user