Generate beautiful markdown documentation for your PostgreSQL Database from schema.rb files.
🏠 Homepage
git clone git@github.com:MatthewLaFalce/schema_to_md.git
export PATH=$PATH:~/Github/schema_to_md
# then follow Rails ERD installation below
# Run this command at the head of any Rails Web App
to_md
# Requires download of Graphviz
brew install graphviz # Homebrew on Mac OS X
sudo port install graphviz # Macports on Mac OS X
sudo apt install graphviz # Debian and Ubuntu
#put this in projects gem file
group :development do
gem 'rails-erd'
end
# Then run
bundle install
# Generate simple erd
rake erd filetype='png' notation=bachman filename='erd_simple'
# Generate complex erd
rake erd polymorphism=true filetype='png' notation=bachman filename='erd_complex'
# Most Useful
bundle exec rake erd polymorphism=true filetype='png' notation=bachman filename='erd' exclude='ApplicationRecord,Record,Searchable,PgSearch::Document,ActiveStorage::Attachment,ActiveStorage::Blob'
# Put this in your projects .erdconfig file
#!/bin/yml
filename: 'erd'
filetype: 'png'
notation: 'bachman'
polymorphism: true
title: 'Docupiler ER Diagram'
exclude: 'ApplicationRecord,Record,Searchable,PgSearch::Document,ActiveStorage::Attachment,ActiveStorage::Blob,ActiveRecord::InternalMetadata,ActiveRecord::SchemaMigration'
# Put this in your projects Gemfile
group :development do
gem 'rails-erd'
end
# Put this in your project Rakefile if you uses :sql for your schema format
Rake::Task["db:migrate"].enhance do
if ActiveRecord::Base.schema_format == :sql
Rake::Task["db:schema:dump"].invoke
end
end
# Run this to install the Gem to your project
bundle install
# Run this to set up the Rake task to work with db:migrate
bundle exec rails g erd:install
# To generate your new diagram just run
bundle exec rails db:migrate
👤 Matthew LaFalce
- Github: @MatthewLaFalce
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
Copyright © 2019 Matthew LaFalce.
This project is MIT licensed.