loopback icon indicating copy to clipboard operation
loopback copied to clipboard

loopback-connector-mysql: dataSource.discoverSchema doesn't read the default value from db

Open enricop89 opened this issue 9 years ago • 2 comments

Description/Steps to reproduce

Hi all,

I am using the dataSource API discoverSchema.. Everything works well except for one thing... the model produced doesn't contain the default value (only for certain type of data). It seems like the API doesn't read the default property from Db.

Example:

Table 'COMPANY':

screen shot 2017-02-20 at 16 16 20

The default value for the field 'logo' is not imported in the Model.json created. Same thing for the creation date, I expected the json with the defaultFn: 'now' but the API doesn't do it.

I am using Node 6.9.2, Loopback 3.2.1, Loopback my sql connector 2.4.1, loopback-datasource-juggler 3.2.0

enricop89 avatar Feb 20 '17 15:02 enricop89

While I am not familiar with the mysql connector code myself, it looks like the "discovery" query does not include any information about the default value - see lib/discovery.js#L159-L186.

@enricop89 I think this should be an easy change, would you like to contribute it yourself?

bajtos avatar Mar 01 '17 15:03 bajtos

Closing this.

Duplicate of https://github.com/strongloop/loopback-connector-mysql/issues/320

ssh24 avatar Aug 17 '17 15:08 ssh24