diff --git a/.erdconfig b/.erdconfig new file mode 100644 index 0000000000..c1f8790785 --- /dev/null +++ b/.erdconfig @@ -0,0 +1,10 @@ +filename: docs/diagram + +attributes: + - content + - foreign_keys + - inheritance + +exclude: + - ActiveRecord::InternalMetadata + - ActiveRecord::SchemaMigration diff --git a/Gemfile b/Gemfile index 3d1183358a..d6adf8dcc9 100644 --- a/Gemfile +++ b/Gemfile @@ -61,6 +61,7 @@ group :development, :test do end group :development do + gem "rails-erd" gem "rladr" gem "web-console" diff --git a/Gemfile.lock b/Gemfile.lock index 183713d9ce..5a7927441a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -144,6 +144,7 @@ GEM regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) cgi (0.4.1) + choice (0.2.0) climate_control (1.2.0) combine_pdf (1.0.26) matrix @@ -428,6 +429,11 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) + rails-erd (1.7.2) + activerecord (>= 4.2) + activesupport (>= 4.2) + choice (~> 0.2.0) + ruby-graphviz (~> 1.2) rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) @@ -522,6 +528,8 @@ GEM rubocop (~> 1.0) rubocop-rspec (3.0.1) rubocop (~> 1.61) + ruby-graphviz (1.2.5) + rexml ruby-progressbar (1.13.0) ruby-rc4 (0.1.5) ruby-vips (2.2.1) @@ -667,6 +675,7 @@ DEPENDENCIES pundit rack-attack rails (= 7.1.3.4) + rails-erd rails_semantic_logger rladr rmagick diff --git a/db/schema.rb b/db/schema.rb index 69e0cf7663..9a2f843aa8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -144,8 +144,8 @@ t.text "recommendation_assessor_note", default: "", null: false t.boolean "references_verified" t.boolean "scotland_full_registration" - t.text "qualifications_assessor_note", default: "", null: false t.boolean "unsigned_consent_document_generated", default: false, null: false + t.text "qualifications_assessor_note", default: "", null: false t.index ["application_form_id"], name: "index_assessments_on_application_form_id" end diff --git a/docs/diagram.pdf b/docs/diagram.pdf new file mode 100644 index 0000000000..5df6287e30 Binary files /dev/null and b/docs/diagram.pdf differ diff --git a/lib/tasks/auto_generate_erd.rake b/lib/tasks/auto_generate_erd.rake new file mode 100644 index 0000000000..e612fba170 --- /dev/null +++ b/lib/tasks/auto_generate_erd.rake @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +RailsERD.load_tasks if Rails.env.development?