gnormal / gnorm

A database-first code generator for any language
https://gnorm.org
Other
484 stars 39 forks source link

Expose COLUMN_TYPE column for MySQL #89

Open Etomyutikos opened 6 years ago

Etomyutikos commented 6 years ago

resolves #86

In MySQL, the DATA_TYPE column contains only the basic type of the column. The COLUMN_TYPE column provides a more detailed explanation of the column's type, including "unsigned" for numeric types.

Etomyutikos commented 6 years ago

For a brief explanation of the differences between DATA_TYPE and COLUMN_TYPE, see this SO answer.

@natefinch Unfortunately, this is only possible for MySQL. I could not find an equivalent in Postgres. The original impetus for this PR (see #86) is only a problem in MySQL.

natefinch commented 6 years ago

So... I'm not entirely sold on exposing this directly. It's not in a very template-friendly format.

It seems like the size from the column type should be put into the column's length field (that sounds like a bug in our mysql code), and maybe add "unsigned" to the column's DBType field.