There is a requirement to automate the ER diagram in business, and I would like to share the contents of the survey at that time as well.
First of all, from the results of the survey, it was concluded that it is a little difficult to certify as a formal ER diagram because the number of tables and columns in the database used in business is quite large. Rather, it will display unnecessary tables and columns, so it is useless to output all of them. However, I feel that it is difficult to separate them now. However, there were some good things to check locally, so I decided to share it this time.
Since all methods use ** graphviz **, install ** graphviz ** on the OS with the following command.
$ brew install graphviz
At the personal development level, this is still easy to see, but when it comes to business use, the format is hard to see and I can only see the relationship between the tables.
https://github.com/voormedia/rails-erd
Gemfile
group :development, :test do
gem 'rails-erd'
end
$ bundle exec erd
This is also easy to see at the personal development level, and I thought it would be nice because it can be output by the model and the controller respectively, but when it is used for business, the format is also difficult to see.
https://github.com/preston/railroady
Gemfile
group :development, :test do
gem 'railroady'
end
$ bundle exec rake diagram:all
Those who use the Rails engine are as follows.
$ bundle exec rake diagram:all_with_engines
This might have been the easiest to see if you had a quick look at the entire table structure.
If you like suin's article below, you can go, so ... How to output ER diagram with Sequel Pro
Perhaps this is the best way to look at foreign keys and relations for each table. If you look at the display part of the ER diagram in the following article, you can see that you can see the ER diagram like this. DBeaver usage memo
It was also interesting that there were surprisingly various methods like this, and that there were new discoveries and that there were strengths and weaknesses when actually looking at each method.
By the way, I personally use DBeaver. I hope it helps.
Recommended Posts