Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

mizoR/schema_doc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SchemaDoc Build Status

SchemaDoc outputs database schema for your Rails applications in markdown style

Installation

Add this line to your application's Gemfile:

gem 'schema_doc'

And then execute:

$ bundle

Usage

$ rake schema_doc:out

When your Rails application has following models:

class User < ActiveRecord::Base
  has_one :blog, :foreign_key => :owner_id
end

class Blog < ActiveRecord::Base
  has_many   :entries
  belongs_to :owner, :class_name => 'User'
end

class Entry < ActiveRecord::Base
  belongs_to :blog
end

SchemaDoc will output THIS.

Optional Configuration

If you want to customize the models that are listed, you can create a config/initializers/schema_doc.rb as shown in the example below:

SchemaDoc.configure do |config|
  config.model_classes = Proc.new { ApplicationRecord.descendants.select{ |klass| klass.superclass.name == ApplicationRecord.name } }
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published