Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 17 lines (14 sloc) 0.514 kb
#!/usr/bin/env zsh
# Usage: a schema TABLE_NAME
# Summary: Show table from db/schema.rb
# Help: Display the database schema for a given table.
# This scans the db/schema.rb file for ActiveRecord::Migration-style table
# definitions and shows the contents of the definition for the table given as
# first argument.
# Provide a completions
if [ "$1" = "--complete" ]; then
awk '/create_table/ { print $2 }' < db/schema.rb | tr -d '",'
awk "/^ create_table \"$1\"/,/^ end/ { print }" < db/schema.rb
Jump to Line
Something went wrong with that request. Please try again.