doc: add a visualization of the database models

Re-generate the schema using `bin/rake erd`.

NB: there's a way to update the PDF automatically after each migration.
But it requires `graphviz` to be installed locally, which I'm not
sure I want to require by default.
This commit is contained in:
Pierre de La Morinerie 2020-08-27 12:02:10 +02:00
parent 0570692d4a
commit 1767df33b0
5 changed files with 22 additions and 0 deletions

4
.erdconfig Normal file
View file

@ -0,0 +1,4 @@
indirect: false
disconnected: false
filename: doc/database_models
exclude: "ActionText::RichText,ActiveStorage::Blob,ActiveStorage::Attachment"

View file

@ -100,6 +100,7 @@ group :development do
gem 'brakeman', require: false
gem 'haml-lint'
gem 'letter_opener_web'
gem 'rails-erd', require: false # generates `doc/database_models.pdf`
gem 'rubocop', require: false
gem 'rubocop-rails_config'
gem 'rubocop-rspec-focused', require: false

View file

@ -156,6 +156,7 @@ GEM
rubyzip (>= 1.3.0, < 3)
chartkick (3.4.0)
childprocess (3.0.0)
choice (0.2.0)
chunky_png (1.3.11)
clamav-client (3.2.0)
coderay (1.1.2)
@ -522,6 +523,11 @@ GEM
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-erd (1.6.0)
activerecord (>= 4.2)
activesupport (>= 4.2)
choice (~> 0.2.0)
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
rails-i18n (6.0.0)
@ -611,6 +617,8 @@ GEM
rubocop (>= 0.51)
ruby-debug-ide (0.7.2)
rake (>= 0.8.1)
ruby-graphviz (1.2.5)
rexml
ruby-progressbar (1.10.1)
ruby2_keywords (0.0.2)
ruby_parser (3.14.2)
@ -826,6 +834,7 @@ DEPENDENCIES
rack-mini-profiler
rails (= 6.0.3.2)
rails-controller-testing
rails-erd
rails-i18n
rake-progressbar
react-rails

8
doc/README.md Normal file
View file

@ -0,0 +1,8 @@
## database_models.pdf
The database models document is generated using the `rails-erd` gem.
To update the generated PDF file:
1. Install `graphviz` (e.g. `brew install graphviz`)
2. Run `bin/rake erd`

BIN
doc/database_models.pdf Normal file

Binary file not shown.