headwayio / voyage

A Rails template with our standard defaults, ready to deploy to Heroku. **See readme in: lib/voyage/README.md**
https://headway.io/voyage
MIT License
0 stars 1 forks source link

Auto-generate ERD when database Schema is updated #20

Closed noahsettersten closed 6 years ago

noahsettersten commented 7 years ago

Similar to how the database schema for a table is generated and placed at the end of a model file after a migration, run the erd gem's command to build a new ERD diagram every migration. This is real helpful for those building a mobile app to see at a glance the entities and their hierarchy, as well as anyone jumping into a project after its initial creation.

Also, we should include a default .erdconfig in Voyage at the start as well. I've been using this:

attributes:
  - content
  - primary_key
  - foreign_key
  - inheritance
filename: #{project-name}-erd
exclude:
  - ActiveRecord::DataMigration
  - Delayed::Backend::ActiveRecord::Job
  - PgSearch::Document
  - Rpush::Client::ActiveRecord::App
  - Rpush::Client::ActiveRecord::Apns::Feedback
  - Rpush::Client::ActiveRecord::Notification

I imagine the exclude list will expand / change, but it's a starting point for now.

noahsettersten commented 7 years ago

Post-migration Rake tasks: https://cl.ly/lzq3

Move these into a separate file in lib/task for easier management.