Merge pull request #260 from konuch/master

Export MySQL and MariaDB column comments.
This commit is contained in:
Kononnable 2020-03-19 21:59:32 +01:00 committed by GitHub
commit 5f16cc5a46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -78,9 +78,10 @@ export default class MysqlDriver extends AbstractDriver {
IsIdentity: number;
COLUMN_TYPE: string;
COLUMN_KEY: string;
COLUMN_COMMENT: string;
}>(`SELECT TABLE_NAME,COLUMN_NAME,COLUMN_DEFAULT,IS_NULLABLE,
DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,NUMERIC_PRECISION,NUMERIC_SCALE,
CASE WHEN EXTRA like '%auto_increment%' THEN 1 ELSE 0 END IsIdentity, COLUMN_TYPE, COLUMN_KEY
CASE WHEN EXTRA like '%auto_increment%' THEN 1 ELSE 0 END IsIdentity, COLUMN_TYPE, COLUMN_KEY, COLUMN_COMMENT
FROM INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA IN (${MysqlDriver.escapeCommaSeparatedList(
dbNames
)})
@ -102,6 +103,7 @@ export default class MysqlDriver extends AbstractDriver {
let columnType = resp.DATA_TYPE;
if (resp.IS_NULLABLE === "YES") options.nullable = true;
if (resp.COLUMN_KEY === "UNI") options.unique = true;
if (resp.COLUMN_COMMENT) options.comment = resp.COLUMN_COMMENT;
if (resp.COLUMN_TYPE.endsWith(" unsigned"))
options.unsigned = true;
switch (resp.DATA_TYPE) {

View File

@ -21,5 +21,6 @@ export type Column = {
unsigned?: boolean;
enum?: string[];
array?: boolean; // ?
comment?: string;
};
};