loopback icon indicating copy to clipboard operation
loopback copied to clipboard

'discoverModelProperties' function returning type of a column as 'String' for 'DECIMAL' column.

Open balauppalapati opened this issue 9 years ago • 2 comments

discoverModelProperties function returning type as string for decimal field of mysql

Description/Steps to reproduce

In TITANIC dataset, I have a field names 'age' in mysql with following description: | Field | Type | Null | Key | Default | Extra | | Age | decimal(10,0) | NO | | 0 | |

I have used discoverModelProperties function to obtain properties of columns of TITANIC dataset. I have got following desc for age field: RowDataPacket { owner: 'TITANIC', tableName: 'test', columnName: 'Age', dataType: 'decimal', dataLength: null, dataPrecision: 10, dataScale: 0, columnType: 'decimal(10,0)', nullable: 'N', generated: 0, type: 'String' }

Expected result

Type field for age column should have been 'Number', but it is 'String'.

Additional information

balauppalapati avatar Jun 15 '17 08:06 balauppalapati

@balauppalapati : the source code in the mysql connector below shows dataType is the data type of the column Age

https://github.com/strongloop/loopback-connector-mysql/blob/master/lib/discovery.js#L163

which is decimal which should be Number

https://github.com/strongloop/loopback-connector-mysql/pull/306

Setogit avatar Jun 26 '17 19:06 Setogit

The PR has been merged to the master. The fix will be released in the next release cycle. Thanks, @balauppalapati Closing.

Setogit avatar Jun 27 '17 15:06 Setogit