railsbridge / bridge_troll

Event management system for all the Bridges (RailsBridge, MobileBridge, GoBridge, etc!)
https://www.bridgetroll.org
Other
282 stars 260 forks source link

Generating an ERD (entity relationship diagram) for the project would help developers get started #624

Open jhsu802701 opened 5 years ago

jhsu802701 commented 5 years ago

In my ruby_on_racetracks branch, I have rails-erd installed. When I run the command "bundle exec erd --attributes=foreign_keys,primary_keys,timestamps,inheritance,content --filetype=dot --filename=tmp/diagram-models --inheritance --notation=bachman dot -Tjpg tmp/diagram-models.dot", I get the following error messages:

Loading application in 'bridge_troll'...
Generating entity-relationship diagram for 26 models...
Warning: Ignoring invalid association :role on Rsvp (model Role exists, but is not included in domain)
Warning: Ignoring invalid association :volunteer_assignment on Rsvp (model VolunteerAssignment exists, but is not included in domain)
Warning: Ignoring invalid association :operating_system on Rsvp (model OperatingSystem exists, but is not included in domain)
Warning: Ignoring invalid association :volunteer_preference on Rsvp (model VolunteerPreference exists, but is not included in domain)
Diagram saved to 'tmp/diagram-models.dot'.
Error: in routesplines, cannot find NORMAL edge
Segmentation fault (core dumped)
jhsu802701 commented 5 years ago

rails-erd seems to have difficulty with ActiveHash::Base types.

ultrasaurus commented 5 years ago

I like the idea of generating an entity relationship diagram. I wonder if this is something that is a bug in rails-erd and ActiveHash...

IIRC, ActiveHash isn't actually stored in the database, but gets its data from a yaml, so it may be something not yet supported by rails-erd

nerual commented 5 years ago

I got this working. First I checked to see if PDF output works:

erd.pdf

Then I tried the query as posted in the original post; it generated the diagram-models.dot file and also spewed a bunch of binary data into my terminal. I amended the command to redirect the output to a jpg and that jpg is valid. So, the command I ran was bundle exec erd --attributes=foreign_keys,primary_keys,timestamps,inheritance,content --filetype=dot --filename=tmp/diagram-models --inheritance --notation=bachman dot -Tjpg tmp/diagram-models.dot > thing.jpg and I got below as results:

thing (And a .dot file GitHub doesn't support)

How would y'all like to proceed? Do we just want these docs for people to read, or do we want to build this functionality into the project?

jhsu802701 commented 5 years ago

Build the functionality into the project, but keep the outputs out of the source code in the interest of keeping the code base small.

nerual commented 5 years ago

Can you describe in greater detail how you envision that working? Do we install Graphviz as a requirement of the project and include a wrapper script that executes that command, and some documentation explaining to open the resulting jpg?

rachelober commented 5 years ago

After discussing with @nerual, we were not sure of the benefits of including this feature in the project without extensive training on how to use it and for what instances. It seems like this feature request is an individual preference rather than in the scope of the needs of the Bridge Troll project. In the interest of keeping the development gemset lean, we would prefer not to include this if only one contributor would be using it once to generate a document.

An option is for @jhsu802701 to create a pull request documenting how one would generate this document following the steps @nerual outlined above as a resource for any new developers.