schemadoc gem - document your database schemas
Switch branches/tags
Nothing to show
Clone or download
corselia and geraldb [update] update README.md
add the description about Active Record and DB Adapter's gem
Latest commit a826c9e Feb 16, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin add worker Feb 4, 2015
lib start adding model info Feb 16, 2015
script up index Feb 5, 2015
test/config start adding model info Feb 16, 2015
.gitignore start adding model info Feb 16, 2015
HISTORY.md everything is new Feb 4, 2015
LICENSE.md up Jan 13, 2017
Manifest.txt start adding model info Feb 16, 2015
README.md [update] update README.md Feb 16, 2018
Rakefile up Jan 13, 2017

README.md

schemadoc

schemadoc gem - document your database schemas (tables, columns, etc.)

Usage Command Line

The schemadoc gem includes a command line tool named - surprise, surprise - schemadoc. Try:

$ schemadoc --help

resulting in:

schemadoc 1.0.0 - Lets you document your database tables, columns, etc.

Usage: schemadoc [options]
    -o, --output PATH            Output path (default is '.')
    -v, --verbose                Show debug trace

Examples:
  schemadoc                # defaults to ./schemadoc.yml
  schemadoc football.yml

Configuration

The schemadoc command line tool requires a configuration file (defaults to ./schemadoc.yml if not passed along).

Database Connection Settings - database Section

Use the database section to configure you database connection settings. Example:

database:
  adapter:  sqlite3
  database: ./football.db

Schema Sections

All other sections are interpreted as database schemas. The first section is the "default" schema, that is, all tables not listed in other schemas will get auto-added to the "default" schema.

Example - schemadoc.yml

## connection spec

database:
  adapter:  sqlite3
  database: ./football.db


## main tables

football:
  name: Football


## world tables

world:
  name: World
  tables:
    - continents
    - countries
    - regions
    - cities
    - places
    - names
    - langs
    - usages

Outputs

The schemadoc tool writes out two json files:

  • database.json - includes all schemas, tables, columns, etc.
  • symbols.json - includes all symbols from a to z

Examples. See the football.db - database.json, symbols.json or beer.db - database.json, symbols.json live examples.

Reports 'n' Templates

To generate web pages from you json files use a static site generator and a template pack (theme). For example, to use the schemadoc/schemadoc-theme theme copy your json files in the _data/ folder and rebuild the site (e.g. $ jekyll build). That's it. Enjoy your database schema docu.

Examples. See the football.db or beer.db live examples.

Free Schemadoc Template Packs / Themes

Install

Just install the gem:

$ gem install schemadoc

In addition, install Active Record and your database adapter's gem such as mysql2

$ gem install activerecord
$ gem install mysql2

License

The schemadoc scripts are dedicated to the public domain. Use it as you please with no restrictions whatsoever.