diff --git a/.erdconfig b/.erdconfig new file mode 100644 index 00000000..bc2bb3d5 --- /dev/null +++ b/.erdconfig @@ -0,0 +1,7 @@ +exclude: ActiveRecord::InternalMetadata, ActiveRecord::SchemaMigration +attributes: + - content + - foreign_key + - inheritance +filename: erd +filetype: png diff --git a/Gemfile b/Gemfile index 3d212634..63308e81 100644 --- a/Gemfile +++ b/Gemfile @@ -43,6 +43,7 @@ group :development do gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' gem 'annotate', '~> 2.7' + gem 'rails-erd', '~> 1.5', require: false end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 73f50281..4ad27921 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,6 +71,7 @@ GEM chartkick (2.3.4) childprocess (0.9.0) ffi (~> 1.0, >= 1.0.11) + choice (0.2.0) chromedriver-helper (1.2.0) archive-zip (~> 0.10) nokogiri (~> 1.8) @@ -153,6 +154,11 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) + rails-erd (1.5.2) + activerecord (>= 3.2) + activesupport (>= 3.2) + choice (~> 0.2.0) + ruby-graphviz (~> 1.2) rails-html-sanitizer (1.0.4) loofah (~> 2.2, >= 2.2.2) railties (5.2.0) @@ -165,6 +171,7 @@ GEM rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) + ruby-graphviz (1.2.3) ruby_dep (1.5.0) rubyzip (1.2.1) sass (3.5.6) @@ -232,6 +239,7 @@ DEPENDENCIES pg_search (~> 2.1) puma (~> 3.11) rails (~> 5.2.0) + rails-erd (~> 1.5) sass-rails (~> 5.0) selenium-webdriver spring diff --git a/README.md b/README.md index 9e71d764..7d304b80 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,10 @@ To view all dependencies used in this project, see the [`Gemfile`](/Gemfile) and ## Notes +### Architecture + +![ERD](erd.png) + ### Resources - [Using PostgreSQL and jsonb with Ruby on Rails](https://nandovieira.com/using-postgresql-and-jsonb-with-ruby-on-rails) is a really useful article for understanding jsonb usage with Postgres and Rails (this is used in this app). diff --git a/erd.png b/erd.png new file mode 100644 index 00000000..b475bf64 Binary files /dev/null and b/erd.png differ diff --git a/lib/tasks/auto_generate_diagram.rake b/lib/tasks/auto_generate_diagram.rake new file mode 100644 index 00000000..1df06962 --- /dev/null +++ b/lib/tasks/auto_generate_diagram.rake @@ -0,0 +1,6 @@ +# NOTE: only doing this in development as some production environments (Heroku) +# NOTE: are sensitive to local FS writes, and besides -- it's just not proper +# NOTE: to have a dev-mode tool do its thing in production. +if Rails.env.development? + RailsERD.load_tasks +end