mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 09:51:59 +03:00
16 lines
792 B
MySQL
16 lines
792 B
MySQL
|
-- This could also be done with making MySQL itself return a non-redundant structure
|
||
|
-- in JSON to simplify the processing within the engine.
|
||
|
SELECT c.TABLE_SCHEMA, c.TABLE_NAME, c.COLUMN_NAME, c.ORDINAL_POSITION, c.COLUMN_DEFAULT,
|
||
|
c.IS_NULLABLE, c.DATA_TYPE, c.COLUMN_TYPE, c.COLUMN_KEY, c.COLUMN_COMMENT,
|
||
|
k.CONSTRAINT_NAME, k.ORDINAL_POSITION, k.POSITION_IN_UNIQUE_CONSTRAINT,
|
||
|
k.REFERENCED_TABLE_SCHEMA, k.REFERENCED_TABLE_NAME, k.REFERENCED_COLUMN_NAME
|
||
|
FROM INFORMATION_SCHEMA.COLUMNS c
|
||
|
LEFT OUTER JOIN
|
||
|
INFORMATION_SCHEMA.KEY_COLUMN_USAGE k
|
||
|
ON c.TABLE_NAME = k.TABLE_NAME AND
|
||
|
c.TABLE_SCHEMA = k.TABLE_SCHEMA AND
|
||
|
c.COLUMN_NAME = k.COLUMN_NAME
|
||
|
WHERE c.TABLE_SCHEMA = ?
|
||
|
ORDER BY c.TABLE_NAME ASC, c.ORDINAL_POSITION ASC
|
||
|
;
|