Return if column is generated or not

Related to
https://github.com/strongloop/loopback-datasource-juggler/issues/899
This commit is contained in:
Christiaan Westerbeek 2016-09-28 16:13:34 +02:00 committed by biniam
parent 0fe22653e3
commit dd91b16e60
1 changed files with 7 additions and 1 deletions

View File

@ -204,7 +204,8 @@ function mixinDiscovery(MySQL, mysql) {
' numeric_precision AS "dataPrecision",' +
' numeric_scale AS "dataScale",' +
' column_type AS "columnType",' +
' is_nullable = \'YES\' AS "nullable"' +
' is_nullable = \'YES\' AS "nullable",' +
' CASE WHEN extra LIKE \'%auto_increment%\' THEN 1 ELSE 0 END AS generated'
' FROM information_schema.columns' +
' WHERE table_schema=' + mysql.escape(schema) +
(table ? ' AND table_name=' + mysql.escape(table) : ''),
@ -217,8 +218,13 @@ function mixinDiscovery(MySQL, mysql) {
' character_maximum_length AS "dataLength",' +
' numeric_precision AS "dataPrecision",' +
' numeric_scale AS "dataScale",' +
<<<<<<< HEAD
' column_type AS "columnType",' +
' is_nullable = \'YES\' AS "nullable"' +
=======
' is_nullable = \'YES\' AS "nullable",' +
' CASE WHEN extra LIKE \'%auto_increment%\' THEN 1 ELSE 0 END AS generated'
>>>>>>> b73fd1e... Return if column is generated or not
' FROM information_schema.columns' +
(table ? ' WHERE table_name=' + mysql.escape(table) : ''),
'table_name, ordinal_position', {});