SchemaDoc outputs database schema for your Rails applications in markdown style
Add this line to your application's Gemfile:
gem 'schema_doc'
And then execute:
$ bundle
$ 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.
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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request