Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save s2t2/11105714 to your computer and use it in GitHub Desktop.
Save s2t2/11105714 to your computer and use it in GitHub Desktop.
how to create a mysql database schema visualization in ruby on rails.

Step 1: Query the metadata

SELECT 
  table_schema
  ,TABLE_NAME
  ,COLUMN_NAME
  ,ordinal_position
  ,is_nullable
  ,data_type
  ,column_type
  ,column_key
  ,column_comment
FROM information_schema.columns
WHERE table_schema NOT IN ('information_schema', 'mysql', 'performance_schema');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment