When working with Rails, I often find myself wanting to check what the database schema looks like. Instead of opening up a GUI tool like MySQLWorkbench or pgAdmin and executing
describe <table>, you can quickly inspect the
db/schema.rb file that Rails maintains for you.
This file should tell you most of the things that you often want to know about the database schema such as:
- The list of tables
- The columns making up each table
- The attributes of each column - whether it's a primary key, a foreign key, nullable, unique, indexable, etc.
Every little helps :)