Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jhsu802701 opened this issue Feb 9, 2019 · 6 comments

Comments

@jhsu802701
Copy link
Contributor

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
Copy link
Contributor Author

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

@ultrasaurus
Copy link
Member

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

@ultrasaurus ultrasaurus changed the title rails-erd gem not working Generating an ERD (entity relationship diagram) for the project would help developers get started Mar 24, 2019
@nerual
Copy link
Collaborator

nerual commented Jul 4, 2019

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

  • Following the README for rails-erd I first installed Graphviz with brew install graphviz
  • I added the following lines to my Gemfile in group :development do:
   gem 'rails-erd'
   gem 'ruby-graphviz'
  • Then I ran bundle install, bundle exec rails-erd and it generated a pdf file. I did get warnings similar to those above, but it completed successfully.

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
Copy link
Contributor Author

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
Copy link
Collaborator

nerual commented Jul 18, 2019

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants