From f4baa503d6948a08c73bd60758662aaf7561af25 Mon Sep 17 00:00:00 2001 From: kirykr Date: Wed, 9 Dec 2020 20:23:31 +0700 Subject: [PATCH 01/27] working on improving report builder query --- .../client_base_sql_builder.rb | 3 +- app/classes/user_notification.rb | 36 ++++++++----------- app/views/clients/_client_rows.html.haml | 2 +- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/app/classes/advanced_searches/client_base_sql_builder.rb b/app/classes/advanced_searches/client_base_sql_builder.rb index 1009d0a6f4..56aa4294d9 100644 --- a/app/classes/advanced_searches/client_base_sql_builder.rb +++ b/app/classes/advanced_searches/client_base_sql_builder.rb @@ -32,7 +32,8 @@ def generate field = rule['id'] operator = rule['operator'] value = rule['value'] - form_builder = field != nil ? field.split('__') : [] + + form_builder = !field.nil? ? field.split('__') : [] if ASSOCIATION_FIELDS.include?(field) association_filter = AdvancedSearches::ClientAssociationFilter.new(@clients, field, operator, value).get_sql @sql_string << association_filter[:id] diff --git a/app/classes/user_notification.rb b/app/classes/user_notification.rb index a4fb7f0d59..6be0dc8f48 100644 --- a/app/classes/user_notification.rb +++ b/app/classes/user_notification.rb @@ -21,30 +21,24 @@ def upcoming_csi_assessments client_ids = [] custom_client_ids = [] clients = @user.clients.joins(:assessments).active_accepted_status - if @user.deactivated_at.present? && clients.present? - clients = clients.where('clients.created_at > ?', @user.activated_at) - end + clients = clients.where('clients.created_at > ?', @user.activated_at) if @user.deactivated_at.present? && clients.present? + clients.each do |client| if Setting.first.enable_default_assessment && client.eligible_default_csi? && client.assessments.defaults.any? if client_ids.exclude?(client.id) repeat_notifications = client.assessment_notification_dates(Setting.first) - if(repeat_notifications.include?(Date.today)) - client_ids << client.id - end + client_ids << client.id if repeat_notifications.include?(Date.today) end end - if CustomAssessmentSetting.any_custom_assessment_enable? - CustomAssessmentSetting.all.each do |custom_assessment| - if client.eligible_custom_csi?(custom_assessment) && client.assessments.customs.any? - if custom_client_ids.exclude?(client.id) - repeat_notifications = client.assessment_notification_dates(custom_assessment) - if(repeat_notifications.include?(Date.today)) - custom_client_ids << client.id - end - end - end - end + next if CustomAssessmentSetting.any_custom_assessment_enable? + + CustomAssessmentSetting.all.each do |custom_assessment| + next if client.eligible_custom_csi?(custom_assessment) && client.assessments.customs.any? + next if custom_client_ids.exclude?(client.id) + + repeat_notifications = client.assessment_notification_dates(custom_assessment) + repeat_notifications.include?(Date.today) && custom_client_ids << client.id end end default_clients = clients.where(id: client_ids).uniq @@ -89,16 +83,16 @@ def review_program_streams program_streams_by_user.each do |program_stream| rules = program_stream.rules client_ids = program_stream.client_enrollments.active.pluck(:client_id).uniq - client_ids = client_ids & @clients.ids + client_ids &= @clients.ids clients = Client.active_accepted_status.where(id: client_ids) - clients_after_filter = AdvancedSearches::ClientAdvancedSearch.new(rules, clients).filter + clients_after_filter = rules['rules'].present? ? AdvancedSearches::ClientAdvancedSearch.new(rules, clients).filter : [] if clients_after_filter.any? clients_change = clients.where.not(id: clients_after_filter.ids).ids client_wrong_program_rules << [program_stream, clients_change] if clients_change.any? - else - client_wrong_program_rules << [program_stream, clients.ids] if clients.any? + elsif clients.any? + client_wrong_program_rules << [program_stream, clients.ids] end end client_wrong_program_rules diff --git a/app/views/clients/_client_rows.html.haml b/app/views/clients/_client_rows.html.haml index b64b70deee..5eb3bcd46d 100644 --- a/app/views/clients/_client_rows.html.haml +++ b/app/views/clients/_client_rows.html.haml @@ -1 +1 @@ -= datagrid_rows(@client_grid, @client_grid.assets) \ No newline at end of file += datagrid_rows(@client_grid, @client_grid.assets) From db5552584ce364058b685aedc41729454f873d9b Mon Sep 17 00:00:00 2001 From: kirykr Date: Thu, 10 Dec 2020 11:47:53 +0700 Subject: [PATCH 02/27] updated report builder raw sql --- app/assets/javascripts/client_advance_search.coffee | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/client_advance_search.coffee b/app/assets/javascripts/client_advance_search.coffee index 5e1e2a0b90..3adad2c526 100644 --- a/app/assets/javascripts/client_advance_search.coffee +++ b/app/assets/javascripts/client_advance_search.coffee @@ -797,6 +797,9 @@ class CIF.ClientAdvanceSearch if btnID == 'search' builderElement = '#builder' builderForm = '.main-report-builder' + if $('#builder').queryBuilder('getSQL', false, true) + sql_sting = $('#builder').queryBuilder('getSQL', false, true).sql + $('#client_advanced_search_raw_sql').val(sql_sting) programValues = if self.programSelected.length > 0 then "[#{self.programSelected}]" customFormValues = if self.customFormSelected.length > 0 then "[#{self.customFormSelected}]" else @@ -807,10 +810,6 @@ class CIF.ClientAdvanceSearch basicRules = $(builderElement).queryBuilder('getRules', { skip_empty: true, allow_invalid: true }) - if $('#builder').queryBuilder('getSQL', false, true) - sql_sting = $('#builder').queryBuilder('getSQL', false, true).sql - $('#raw_sql').val(sql_sting) - self.setValueToProgramAssociation() $('#client_advanced_search_custom_form_selected').val(customFormValues) $('#client_advanced_search_program_selected').val(programValues) From 6f41ad966ee2be4b54f6c4b9d0c39f7f06819dc8 Mon Sep 17 00:00:00 2001 From: kirykr Date: Thu, 10 Dec 2020 20:39:24 +0700 Subject: [PATCH 03/27] update rails 4 to 5 --- .ruby-version | 2 +- Gemfile | 121 +-- Gemfile.lock | 939 ++++++++++++----------- app/classes/domain_cache_directory.rb | 5 + app/controllers/clients_controller.rb | 1 + app/controllers/dashboards_controller.rb | 1 + config/application.rb | 4 +- config/boot.rb | 3 +- config/cable.yml | 10 + config/environment.rb | 2 +- config/environments/development.rb | 4 +- config/storage.yml | 34 + 12 files changed, 623 insertions(+), 503 deletions(-) create mode 100644 app/classes/domain_cache_directory.rb create mode 100644 config/cable.yml create mode 100644 config/storage.yml diff --git a/.ruby-version b/.ruby-version index 45674f16a8..aedc15bb0c 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.3 \ No newline at end of file +2.5.3 diff --git a/Gemfile b/Gemfile index b13ae7db4a..40645783d2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,90 +1,91 @@ source 'https://rubygems.org' -gem 'rails', '4.2.2' +# gem 'rails', '4.2.2' +gem 'rails', '~> 5.2', '<= 5.2.4.4' gem 'pg', '~> 0.18.4' gem 'jquery-rails' gem 'jquery-ui-rails' -gem 'sass-rails', '~> 5.0' -gem 'uglifier', '>= 1.3.0' -gem 'coffee-rails', '~> 4.1.0' -gem 'jbuilder', '~> 2.0' -gem 'simple_form', '~> 3.2' -gem 'bootstrap-sass', '~> 3.3.5' -gem 'devise', '~> 3.5', '>= 3.5.2' -gem 'haml-rails', '~> 0.9' -gem 'dotenv-rails', '~> 2.0.2' -gem 'roo', '~> 2.2' +gem 'sass-rails', '~> 6.0' +gem 'uglifier', '~> 4.2' +gem 'coffee-rails', '~> 5.0' +gem 'jbuilder', '~> 2.10', '>= 2.10.1' +gem 'simple_form', '~> 5.0', '>= 5.0.3' +gem 'bootstrap-sass', '~> 3.4', '>= 3.4.1' +gem 'devise', '~> 4.7', '>= 4.7.3' +gem 'haml-rails', '~> 2.0', '>= 2.0.1' +gem 'dotenv-rails', '~> 2.7', '>= 2.7.6' +gem 'roo', '~> 2.8', '>= 2.8.3' gem 'fog' gem 's3' -gem 'ffaker', '~> 2.1.0' -gem 'draper', '~> 2.1' -gem 'datagrid', '~> 1.4.2' +gem 'ffaker', '~> 2.17' +gem 'draper', '~> 4.0', '>= 4.0.1' +gem 'datagrid', '~> 1.6', '>= 1.6.1' gem 'active_model_serializers' gem 'sinatra', require: false gem 'rack-cors', require: 'rack/cors' gem 'rails-erd' -gem 'phony_rails', '~> 0.12.11' +gem 'phony_rails', '~> 0.14.13' gem 'typhoeus' -gem 'foreman', '~> 0.78.0' -gem 'cancancan', '~> 1.13', '>= 1.13.1' -gem 'pundit', '~> 1.1' -gem 'tinymce-rails', '~> 4.5.6' -gem 'bootstrap-datepicker-rails', '~> 1.5' +gem 'foreman', '~> 0.87.2' +gem 'cancancan', '~> 3.1' +gem 'pundit', '~> 2.1' +gem 'tinymce-rails', '~> 5.6', '>= 5.6.2.1' +gem 'bootstrap-datepicker-rails', '~> 1.9', '>= 1.9.0.1' gem 'x-editable-rails', '~> 1.5', '>= 1.5.5.1' -gem 'select2-rails', '~> 3.5.9.3' -gem 'doorkeeper', '~> 4.4', '>= 4.4.3' -gem 'devise_token_auth', '~> 0.1.37' -gem 'omniauth', '~> 1.3', '>= 1.3.1' +gem 'select2-rails', '~> 4.0', '>= 4.0.13' +gem 'doorkeeper', '~> 5.4' +gem 'devise_token_auth' +gem 'omniauth', '~> 1.9', '>= 1.9.1' gem 'jquery-validation-rails' -gem 'google-api-client', '~> 0.10', require: 'google/apis/calendar_v3' -gem 'fullcalendar-rails', '~> 3.2.0.0' -gem 'momentjs-rails', '~> 2.17.1' +gem 'google-api-client', '~> 0.23.9', require: 'google/apis/calendar_v3' +gem 'fullcalendar-rails', '~> 3.9' +gem 'momentjs-rails', '~> 2.20', '>= 2.20.1' gem 'kaminari' gem 'jquery-datatables-rails', '~> 3.4' -gem 'friendly_id', '~> 5.1.0' -gem 'wicked_pdf', '~> 1.0', '>= 1.0.6' -gem 'wkhtmltopdf-binary-edge', '~> 0.12.3.0' -gem 'browser', '~> 2.1' -gem 'whenever', '~> 0.9.4' -gem 'thredded', '~> 0.6.1' -gem 'cocoon', '~> 1.2', '>= 1.2.9' -gem 'paper_trail', '~> 5.2' -gem 'carrierwave', '~> 1.1.0' -gem 'mini_magick', '~> 4.5' -gem 'chartkick', '~> 3.4' -gem 'font-awesome-rails', '~> 4.7' -gem 'spreadsheet', '~> 1.1.3' -gem 'apartment', '~> 1.2' -gem 'dropzonejs-rails', '~> 0.7.3' -gem 'bourbon', '~> 4.2' -gem 'neat', '~> 1.8' -gem 'sidekiq', '~> 4.1.0' -gem 'mongoid', '~> 5.2', '>= 5.2.1' -gem 'where-or', '~> 0.1.6' -gem 'dotiw', '~> 4.0.1' +gem 'friendly_id', '~> 5.4', '>= 5.4.1' +gem 'wicked_pdf', '~> 2.1' +gem 'wkhtmltopdf-binary-edge', '~> 0.12.6.0' +gem 'browser', '~> 5.1' +gem 'whenever', '~> 1.0' +gem 'thredded', '~> 0.16.4' +gem 'cocoon', '~> 1.2', '>= 1.2.15' +gem 'paper_trail', '~> 11.0' +gem 'carrierwave', '~> 2.1' +gem 'mini_magick', '~> 4.11' +gem 'chartkick', '~> 3.4', '>= 3.4.2' +gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.5' +gem 'spreadsheet', '~> 1.2', '>= 1.2.6' +gem 'apartment', '~> 2.2', '>= 2.2.1' +gem 'dropzonejs-rails', '~> 0.8.5' +gem 'bourbon', '~> 7.0' +gem 'neat', '~> 1.7', '>= 1.7.4' +gem 'sidekiq', '~> 5.2', '>= 5.2.9' +gem 'mongoid', '~> 6.1', '>= 6.1.1' +gem 'dotiw', '~> 5.2' gem 'text', '~> 1.3', '>= 1.3.1' -gem 'acts_as_paranoid', '~> 0.6.1' -gem 'ancestry', '~> 3.0', '>= 3.0.5' +gem 'acts_as_paranoid', '~> 0.7.0' +gem 'ancestry', '~> 3.2', '>= 3.2.1' gem 'sysrandom', '~> 1.0', '>= 1.0.5' -gem 'write_xlsx', '~> 0.85.7' -gem 'caxlsx', '~> 2.0', '>= 2.0.2' -gem 'react-rails', '~> 2.6.0' -gem 'webpacker', '~> 4.0.7' +gem 'write_xlsx', '~> 0.86.0' +gem 'caxlsx', '~> 3.0', '>= 3.0.3' +gem 'react-rails', '~> 2.6', '>= 2.6.1' +gem 'webpacker', '~> 5.2', '>= 5.2.1' gem 'jquery_query_builder-rails', '~> 0.5.0' -gem 'globalize', '~> 5.1.0' -gem 'enumerize', '~> 2.3.1' +gem 'globalize', '~> 5.3' +gem 'enumerize', '~> 2.3', '>= 2.3.1' gem 'ulid', '~> 1.2' +gem 'dalli', '~> 2.7', '>= 2.7.11' group :development, :test do gem 'pry' - gem 'rspec-rails', '~> 4.0.0' - gem 'factory_girl_rails', '~> 4.5' + gem 'rspec-rails' + gem 'factory_girl_rails', '~> 4.9' gem 'launchy', '~> 2.4', '>= 2.4.3' gem 'capybara', '~> 2.15.4' gem 'poltergeist', '~> 1.9.0' gem 'phantomjs' gem 'shoulda-whenever', '~> 0.0.2' - gem 'bullet', '5.4.3' + gem 'bullet', '~> 6.1' gem 'mongoid-rspec', '~> 4.0', '>= 4.0.1' gem 'thin', '~> 1.7' gem 'danger', '~> 5.16', '>= 5.16.1' @@ -102,7 +103,7 @@ end group :development do gem 'letter_opener', '~> 1.4.1' - gem 'letter_opener_web', '~> 1.3', '>= 1.3.4' + gem 'letter_opener_web' gem 'rubocop', '~> 0.47.1', require: false gem 'capistrano', '3.9.0' gem 'capistrano-rails', '~> 1.1.1' diff --git a/Gemfile.lock b/Gemfile.lock index 5627561f94..570037bbda 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,97 +2,112 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (2.3.6) - actionmailer (4.2.2) - actionpack (= 4.2.2) - actionview (= 4.2.2) - activejob (= 4.2.2) + actioncable (5.2.4.4) + actionpack (= 5.2.4.4) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.2) - actionview (= 4.2.2) - activesupport (= 4.2.2) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - actionview (4.2.2) - activesupport (= 4.2.2) + rails-dom-testing (~> 2.0) + actionpack (5.2.4.4) + actionview (= 5.2.4.4) + activesupport (= 5.2.4.4) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.4.4) + activesupport (= 5.2.4.4) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - active_model_serializers (0.9.4) - activemodel (>= 3.2) - active_record_union (1.2.0) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + active_model_serializers (0.10.11) + actionpack (>= 4.1, < 6.1) + activemodel (>= 4.1, < 6.1) + case_transform (>= 0.2) + jsonapi-renderer (>= 0.1.1.beta1, < 0.3) + active_record_union (1.3.0) activerecord (>= 4.0) - activejob (4.2.2) - activesupport (= 4.2.2) - globalid (>= 0.3.0) - activemodel (4.2.2) - activesupport (= 4.2.2) + activejob (5.2.4.4) + activesupport (= 5.2.4.4) + globalid (>= 0.3.6) + activemodel (5.2.4.4) + activesupport (= 5.2.4.4) + activemodel-serializers-xml (1.0.2) + activemodel (> 5.x) + activesupport (> 5.x) builder (~> 3.1) - activerecord (4.2.2) - activemodel (= 4.2.2) - activesupport (= 4.2.2) - arel (~> 6.0) - activesupport (4.2.2) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) + activerecord (5.2.4.4) + activemodel (= 5.2.4.4) + activesupport (= 5.2.4.4) + arel (>= 9.0) + activestorage (5.2.4.4) + actionpack (= 5.2.4.4) + activerecord (= 5.2.4.4) + marcel (~> 0.3.1) + activesupport (5.2.4.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - acts_as_paranoid (0.6.1) - activerecord (>= 4.2, < 7.0) - activesupport (>= 4.2, < 7.0) - addressable (2.4.0) - airbrussh (1.3.2) + acts_as_paranoid (0.7.0) + activerecord (>= 5.2, < 7.0) + activesupport (>= 5.2, < 7.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - ancestry (3.0.5) - activerecord (>= 3.2.0) - apartment (1.2.0) + aliyun-sdk (0.8.0) + nokogiri (~> 1.6) + rest-client (~> 2.0) + ancestry (3.2.1) + activerecord (>= 4.2.0) + apartment (2.2.1) activerecord (>= 3.1.2, < 6.0) + parallel (>= 0.7.1) + public_suffix (>= 2) rack (>= 1.3.6) appsignal (1.1.9) rack thread_safe - arel (6.0.3) - asset_sync (2.8.1) + arel (9.0.0) + asset_sync (2.12.1) activemodel (>= 4.1.0) fog-core mime-types (>= 2.99) unf - ast (2.3.0) - autoprefixer-rails (6.3.3.1) + ast (2.4.1) + autoprefixer-rails (10.1.0.0) execjs - autosize-rails (1.18.17) - rails (>= 3.1) babel-source (5.8.35) babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) execjs (~> 2.0) - bbcoder (1.1.1) - bcrypt (3.1.13) - bootstrap-datepicker-rails (1.5.0) + bcrypt (3.1.16) + bootstrap-datepicker-rails (1.9.0.1) railties (>= 3.0) - bootstrap-sass (3.3.6) + bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) - sass (>= 3.3.4) - bourbon (4.2.7) - sass (~> 3.4) - thor (~> 0.19) - browser (2.1.0) - bson (4.2.1) + sassc (>= 2.0.0) + bourbon (7.0.0) + thor (~> 1.0) + browser (5.1.0) + bson (4.11.1) builder (3.2.4) - bullet (5.4.3) + bullet (6.1.0) activesupport (>= 3.0.0) - uniform_notifier (~> 1.10.0) - cancancan (1.13.1) + uniform_notifier (~> 1.11) + cancancan (3.1.0) capistrano (3.9.0) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (1.5.0) + capistrano-bundler (1.6.0) capistrano (~> 3.1) capistrano-foreman (1.4.0) capistrano (~> 3.1) @@ -115,15 +130,21 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - carrierwave (1.1.0) - activemodel (>= 4.0.0) - activesupport (>= 4.0.0) - mime-types (>= 1.16) - caxlsx (2.0.2) - htmlentities (~> 4.3.1) - nokogiri (>= 1.4.1) - rubyzip (~> 1.2) - chartkick (3.4.0) + carrierwave (2.1.0) + activemodel (>= 5.0.0) + activesupport (>= 5.0.0) + addressable (~> 2.6) + image_processing (~> 1.1) + mimemagic (>= 0.3.0) + mini_mime (>= 0.1.3) + case_transform (0.2) + activesupport + caxlsx (3.0.3) + htmlentities (~> 4.3, >= 4.3.4) + mimemagic (~> 0.3) + nokogiri (~> 1.10, >= 1.10.4) + rubyzip (>= 1.3.0, < 3) + chartkick (3.4.2) choice (0.2.0) chronic (0.10.2) claide (1.0.3) @@ -132,22 +153,23 @@ GEM nap open4 (~> 1.3) cliver (0.3.2) - cocoon (1.2.9) - coderay (1.1.1) - coffee-rails (4.1.1) + cocoon (1.2.15) + coderay (1.1.3) + coffee-rails (5.0.0) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) + railties (>= 5.2.0) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) + coffee-script-source (1.12.2) colored2 (3.1.2) concurrent-ruby (1.1.7) - connection_pool (2.2.0) + connection_pool (2.2.3) cork (0.3.0) colored2 (~> 3.1) crass (1.0.6) daemons (1.3.1) + dalli (2.7.11) danger (5.16.1) claide (~> 1.0) claide-plugins (>= 0.9.2) @@ -160,60 +182,62 @@ GEM no_proxy_fix octokit (~> 4.7) terminal-table (~> 1) - database_cleaner (1.5.1) - datagrid (1.4.2) - rails (>= 3.2.22.2) - db_text_search (0.2.0) - activerecord (>= 4.1.15, < 6.0) - declarative (0.0.9) + database_cleaner (1.8.5) + datagrid (1.6.1) + rails (>= 4.0) + db_text_search (0.3.1) + activerecord (>= 4.1.15, < 7.0) + declarative (0.0.20) declarative-option (0.1.0) - devise (3.5.6) + devise (4.7.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) + railties (>= 4.1.0) responders - thread_safe (~> 0.1) warden (~> 1.2.3) - devise_token_auth (0.1.43) - devise (> 3.5.2, < 4.5) - rails (< 6) + devise_token_auth (1.1.3) + bcrypt (~> 3.0) + devise (> 3.5.2, < 5) + rails (>= 4.2.0, < 6.1) diff-lcs (1.4.4) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - doorkeeper (4.4.3) - railties (>= 4.2) - dotenv (2.0.2) - dotenv-rails (2.0.2) - dotenv (= 2.0.2) - railties (~> 4.0) - dotiw (4.0.1) - actionpack (>= 4) + doorkeeper (5.4.0) + railties (>= 5) + dotenv (2.7.6) + dotenv-rails (2.7.6) + dotenv (= 2.7.6) + railties (>= 3.2) + dotiw (5.2.0) + activesupport i18n - draper (2.1.0) - actionpack (>= 3.0) - activemodel (>= 3.0) - activesupport (>= 3.0) - request_store (~> 1.0) - dropzonejs-rails (0.7.4) + draper (4.0.1) + actionpack (>= 5.0) + activemodel (>= 5.0) + activemodel-serializers-xml (>= 1.0) + activesupport (>= 5.0) + request_store (>= 1.0) + dropzonejs-rails (0.8.5) rails (> 3.1) - dry-inflector (0.1.2) + dry-inflector (0.2.0) enumerize (2.3.1) activesupport (>= 3.2) + erubi (1.10.0) erubis (2.7.0) - ethon (0.8.1) + ethon (0.12.0) ffi (>= 1.3.0) eventmachine (1.2.7) - excon (0.73.0) - execjs (2.6.0) - factory_girl (4.5.0) + excon (0.78.1) + execjs (2.7.0) + factory_girl (4.9.0) activesupport (>= 3.0.0) - factory_girl_rails (4.6.0) - factory_girl (~> 4.5.0) + factory_girl_rails (4.9.0) + factory_girl (~> 4.9.0) railties (>= 3.0.0) - faraday (0.12.1) + faraday (0.17.3) multipart-post (>= 1.2, < 3) - faraday-cookie_jar (0.0.6) - faraday (>= 0.7.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) http-cookie (~> 1.0.0) faraday-encoding (0.0.5) faraday @@ -221,9 +245,9 @@ GEM faraday (~> 0.8) faraday_middleware (0.14.0) faraday (>= 0.7.4, < 1.0) - fastimage (2.1.7) - ffaker (2.1.0) - ffi (1.9.10) + fastimage (2.2.0) + ffaker (2.17.0) + ffi (1.13.1) fission (0.5.0) CFPropertyList (~> 2.2) flay (2.12.1) @@ -231,23 +255,24 @@ GEM path_expander (~> 1.0) ruby_parser (~> 3.0) sexp_processor (~> 4.0) - fog (1.41.0) + fog (2.2.0) fog-aliyun (>= 0.1.0) fog-atmos fog-aws (>= 0.6.0) fog-brightbox (~> 0.4) - fog-cloudatcost (~> 0.1.0) - fog-core (~> 1.45) + fog-cloudatcost (~> 0.4) + fog-cloudstack (~> 0.1.0) + fog-core (~> 2.1) fog-digitalocean (>= 0.3.0) - fog-dnsimple (~> 1.0) + fog-dnsimple (~> 2.1) fog-dynect (~> 0.0.2) fog-ecloud (~> 0.1) - fog-google (<= 0.1.0) + fog-google (~> 1.0) fog-internet-archive - fog-joyent fog-json fog-local fog-openstack + fog-ovirt fog-powerdns (>= 0.1.1) fog-profitbricks fog-rackspace @@ -264,8 +289,9 @@ GEM fog-xenserver fog-xml (~> 0.1.1) ipaddress (~> 0.5) - json (>= 1.8, < 2.0) - fog-aliyun (0.3.5) + json (~> 2.0) + fog-aliyun (0.3.19) + aliyun-sdk (~> 0.8.0) fog-core fog-json ipaddress (~> 0.8) @@ -273,9 +299,9 @@ GEM fog-atmos (0.1.0) fog-core fog-xml - fog-aws (2.0.1) - fog-core (~> 1.38) - fog-json (~> 1.0) + fog-aws (3.7.0) + fog-core (~> 2.1) + fog-json (~> 1.1) fog-xml (~> 0.1) ipaddress (~> 0.8) fog-brightbox (0.16.1) @@ -283,23 +309,27 @@ GEM fog-core fog-json mime-types - fog-cloudatcost (0.1.2) - fog-core (~> 1.36) - fog-json (~> 1.0) + fog-cloudatcost (0.4.0) + fog-core + fog-json + ipaddress + fog-cloudstack (0.1.0) + fog-core (~> 2.1) + fog-json (~> 1.1) fog-xml (~> 0.1) - ipaddress (~> 0.8) - fog-core (1.45.0) + fog-core (2.2.3) builder - excon (~> 0.58) + excon (~> 0.71) formatador (~> 0.2) + mime-types fog-digitalocean (0.4.0) fog-core fog-json fog-xml ipaddress (>= 0.5) - fog-dnsimple (1.0.0) - fog-core (~> 1.38) - fog-json (~> 1.0) + fog-dnsimple (2.1.0) + fog-core (>= 1.38, < 3) + fog-json fog-dynect (0.0.3) fog-core fog-json @@ -307,33 +337,38 @@ GEM fog-ecloud (0.3.0) fog-core fog-xml - fog-google (0.1.0) + fog-google (1.7.1) fog-core fog-json fog-xml - fog-internet-archive (0.0.1) + google-api-client (~> 0.23.0) + fog-internet-archive (0.0.2) fog-core fog-json fog-xml - fog-joyent (0.0.1) - fog-core (~> 1.42) - fog-json (>= 1.0) fog-json (1.2.0) fog-core multi_json (~> 1.10) fog-local (0.6.0) fog-core (>= 1.27, < 3.0) - fog-openstack (0.3.10) - fog-core (>= 1.45, <= 2.1.0) + fog-openstack (1.0.11) + fog-core (~> 2.1) fog-json (>= 1.0) ipaddress (>= 0.8) + fog-ovirt (1.2.5) + fog-core + fog-json + fog-xml + ovirt-engine-sdk (>= 4.1.3) + rbovirt (~> 0.1.5) fog-powerdns (0.2.0) fog-core fog-json fog-xml - fog-profitbricks (4.1.1) - fog-core (~> 1.42) - fog-json (~> 1.0) + fog-profitbricks (0.0.5) + fog-core + fog-xml + nokogiri fog-rackspace (0.1.6) fog-core (>= 1.35) fog-json (>= 1.0) @@ -368,7 +403,7 @@ GEM fog-voxel (0.1.0) fog-core fog-xml - fog-vsphere (3.3.0) + fog-vsphere (3.5.0) fog-core rbvmomi (>= 1.9, < 3) fog-xenserver (1.0.0) @@ -378,102 +413,95 @@ GEM fog-xml (0.1.3) fog-core nokogiri (>= 1.5.11, < 2.0.0) - font-awesome-rails (4.7.0.0) - railties (>= 3.2, < 5.1) - foreman (0.78.0) - thor (~> 0.19.1) + font-awesome-rails (4.7.0.5) + railties (>= 3.2, < 6.1) + foreman (0.87.2) formatador (0.2.5) - friendly_id (5.1.0) + friendly_id (5.4.1) activerecord (>= 4.0.0) - fullcalendar-rails (3.2.0.0) + fullcalendar-rails (3.9.0.0) jquery-rails (>= 4.0.5, < 5.0.0) jquery-ui-rails (>= 5.0.2) momentjs-rails (>= 2.9.0) - gemoji (2.1.0) git (1.7.0) rchardet (~> 1.8) - github-markdown (0.6.9) - globalid (0.3.6) - activesupport (>= 4.1.0) - globalize (5.1.0) - activemodel (>= 4.2, < 5.2) - activerecord (>= 4.2, < 5.2) + globalid (0.4.2) + activesupport (>= 4.2.0) + globalize (5.3.0) + activemodel (>= 4.2, < 6.1) + activerecord (>= 4.2, < 6.1) request_store (~> 1.0) - google-api-client (0.10.3) - addressable (~> 2.3) - googleauth (~> 0.5) - httpclient (~> 2.7) - hurley (~> 0.1) - memoist (~> 0.11) - mime-types (>= 1.6) + google-api-client (0.23.9) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.5, < 0.7.0) + httpclient (>= 2.8.1, < 3.0) + mime-types (~> 3.0) representable (~> 3.0) retriable (>= 2.0, < 4.0) - googleauth (0.5.1) - faraday (~> 0.9) - jwt (~> 1.4) - logging (~> 2.0) - memoist (~> 0.12) + signet (~> 0.9) + googleauth (0.6.7) + faraday (~> 0.12) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) multi_json (~> 1.11) - os (~> 0.9) + os (>= 0.9, < 2.0) signet (~> 0.7) - haml (4.0.7) + haml (5.2.1) + temple (>= 0.8.0) tilt - haml-rails (0.9.0) - actionpack (>= 4.0.1) - activesupport (>= 4.0.1) - haml (>= 4.0.6, < 5.0) + haml-rails (2.0.1) + actionpack (>= 5.1) + activesupport (>= 5.1) + haml (>= 4.0.6, < 6.0) html2haml (>= 1.0.1) - railties (>= 4.0.1) - hashie (3.4.3) - html-pipeline (2.4.2) + railties (>= 5.1) + hashie (4.1.0) + html-pipeline (2.14.0) activesupport (>= 2) nokogiri (>= 1.4) - html-pipeline-vimeo (0.1.1) - html-pipeline (~> 2.0) - html-pipeline-youtube (0.1.3) - html-pipeline (~> 2.0) html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) nokogiri (>= 1.6.0) ruby_parser (~> 3.5) htmlentities (4.3.4) + http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) httpclient (2.8.3) - hurley (0.2) - i18n (0.9.5) + i18n (1.8.5) concurrent-ruby (~> 1.0) - inline_svg (1.7.1) + image_processing (1.12.1) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) + inline_svg (1.7.2) activesupport (>= 3.0) nokogiri (>= 1.6) ipaddress (0.8.3) - jbuilder (2.4.1) - activesupport (>= 3.0.0, < 5.1) - multi_json (~> 1.2) + jbuilder (2.10.1) + activesupport (>= 5.0.0) jquery-datatables-rails (3.4.0) actionpack (>= 3.1) jquery-rails railties (>= 3.1) sass-rails - jquery-rails (4.1.0) - rails-dom-testing (~> 1.0) + jquery-rails (4.4.0) + rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - jquery-validation-rails (1.13.1) - railties (>= 3.2, < 5.0) - thor (~> 0.14) + jquery-validation-rails (1.19.0) jquery_query_builder-rails (0.5.0) activesupport json (>= 1.8.3) railties (>= 3.1) - json (1.8.6) + json (2.3.1) json_spec (1.1.5) multi_json (~> 1.0) rspec (>= 2.0, < 4.0) - jwt (1.5.6) + jsonapi-renderer (0.2.2) + jwt (2.2.2) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -495,18 +523,16 @@ GEM actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) - little-plugger (1.1.4) - logging (2.2.2) - little-plugger (~> 1.1) - multi_json (~> 1.10) - loofah (2.7.0) + loofah (2.8.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) + mail (2.7.1) + mini_mime (>= 0.1.1) mail_interceptor (0.0.7) activesupport - memoist (0.15.0) + marcel (0.3.3) + mimemagic (~> 0.3.2) + memoist (0.16.2) metainspector (5.4.0) addressable (~> 2.4) faraday (~> 0.9) @@ -517,21 +543,22 @@ GEM fastimage (~> 2.0) nesty (~> 1.0) nokogiri (~> 1.6) - method_source (0.8.2) - mime-types (2.99.1) - mini_magick (4.5.1) - mini_mime (0.1.4) + method_source (1.0.0) + mime-types (3.3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2020.1104) + mimemagic (0.3.5) + mini_magick (4.11.0) + mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.2) - momentjs-rails (2.17.1) + momentjs-rails (2.20.1) railties (>= 3.1) - mongo (2.4.1) - bson (>= 4.2.1, < 5.0.0) - mongoid (5.2.1) - activemodel (~> 4.0) + mongo (2.14.0) + bson (>= 4.8.2, < 5.0.0) + mongoid (6.1.1) + activemodel (~> 5.0) mongo (>= 2.4.1, < 3.0.0) - origin (~> 2.3) - tzinfo (>= 0.3.37) mongoid-compatibility (0.5.1) activesupport mongoid (>= 2.0) @@ -542,143 +569,170 @@ GEM rspec-core (~> 3.3) rspec-expectations (~> 3.3) rspec-mocks (~> 3.3) - multi_json (1.14.1) - multipart-post (2.0.0) + multi_json (1.15.0) + multipart-post (2.1.1) + mustache (1.1.1) + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) nap (1.1.0) - neat (1.8.0) + neat (1.7.4) + bourbon (>= 4.0) sass (>= 3.3) - thor (~> 0.19) nesty (1.0.2) - net-scp (2.0.0) - net-ssh (>= 2.6.5, < 6.0.0) - net-ssh (5.2.0) + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (6.1.0) + netrc (0.11.0) + nio4r (2.5.4) no_proxy_fix (0.1.2) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - nokogumbo (2.0.2) + nokogumbo (2.0.4) nokogiri (~> 1.8, >= 1.8.4) octokit (4.19.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) - omniauth (1.3.1) - hashie (>= 1.2, < 4) - rack (>= 1.0, < 3) + omniauth (1.9.1) + hashie (>= 3.4.6) + rack (>= 1.6.2, < 3) + onebox (1.9.30) + addressable (~> 2.7.0) + htmlentities (~> 4.3) + multi_json (~> 1.11) + mustache + nokogiri (~> 1.7) + sanitize open4 (1.3.4) - optimist (3.0.0) - origin (2.3.0) + optimist (3.0.1) orm_adapter (0.5.0) - os (0.9.6) - paper_trail (5.2.2) - activerecord (>= 3.0, < 6.0) + os (1.1.1) + ovirt-engine-sdk (4.4.0) + json (>= 1, < 3) + paper_trail (11.0.0) + activerecord (>= 5.2) request_store (~> 1.1) - parser (2.3.3.1) - ast (~> 2.2) + parallel (1.20.1) + parser (2.7.2.0) + ast (~> 2.4.1) path_expander (1.1.0) pg (0.18.4) phantomjs (2.1.1.0) - phony (2.15.15) - phony_rails (0.12.13) + phony (2.18.18) + phony_rails (0.14.13) activesupport (>= 3.0) - phony (~> 2.12) + phony (> 2.15) poltergeist (1.9.0) capybara (~> 2.1) cliver (~> 0.3.1) multi_json (~> 1.0) websocket-driver (>= 0.2.0) - powerpack (0.1.1) - proxies (0.2.1) - pry (0.10.3) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - pundit (1.1.0) + powerpack (0.1.3) + proxies (0.2.3) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.6) + pundit (2.1.0) activesupport (>= 3.0.0) - rack (1.6.13) - rack-cors (1.0.6) - rack (>= 1.6.0) - rack-mini-profiler (1.0.0) + rack (2.2.3) + rack-cors (1.1.1) + rack (>= 2.0.0) + rack-mini-profiler (1.1.6) rack (>= 1.2.0) - rack-protection (1.5.3) + rack-protection (2.1.0) rack rack-proxy (0.6.5) rack - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.2) - actionmailer (= 4.2.2) - actionpack (= 4.2.2) - actionview (= 4.2.2) - activejob (= 4.2.2) - activemodel (= 4.2.2) - activerecord (= 4.2.2) - activesupport (= 4.2.2) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.2) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) - rails-erd (1.4.6) - activerecord (>= 3.2) - activesupport (>= 3.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.4.4) + actioncable (= 5.2.4.4) + actionmailer (= 5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) + activemodel (= 5.2.4.4) + activerecord (= 5.2.4.4) + activestorage (= 5.2.4.4) + activesupport (= 5.2.4.4) + bundler (>= 1.3.0) + railties (= 5.2.4.4) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-erd (1.6.0) + activerecord (>= 4.2) + activesupport (>= 4.2) choice (~> 0.2.0) ruby-graphviz (~> 1.2) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - rails-timeago (2.14.0) - actionpack (>= 3.1) - activesupport (>= 3.1) - railties (4.2.2) - actionpack (= 4.2.2) - activesupport (= 4.2.2) + railties (5.2.4.4) + actionpack (= 5.2.4.4) + activesupport (= 5.2.4.4) + method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rainbow (2.2.1) + thor (>= 0.19.0, < 2.0) + rainbow (2.2.2) + rake rake (13.0.1) - rb-gravatar (1.0.5) + rb-fsevent (0.10.4) + rb-gravatar (1.0.6) + rb-inotify (0.10.1) + ffi (~> 1.0) + rbovirt (0.1.7) + nokogiri + rest-client (> 1.7.0) rbvmomi (2.4.1) builder (~> 3.0) json (>= 1.8) nokogiri (~> 1.5) optimist (~> 3.0) rchardet (1.8.0) - react-rails (2.6.0) + react-rails (2.6.1) babel-transpiler (>= 0.7.0) connection_pool execjs railties (>= 3.2) tilt - redis (3.2.2) + redis (4.1.4) representable (3.0.4) declarative (< 0.1.0) declarative-option (< 0.2.0) uber (< 0.2.0) - request_store (1.3.0) - responders (2.1.1) - railties (>= 4.2.0, < 5.1) - retriable (3.0.2) - roo (2.3.2) + request_store (1.5.0) + rack (>= 1.4) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) + retriable (3.1.2) + rexml (3.2.4) + rinku (2.0.6) + roo (2.8.3) nokogiri (~> 1) - rubyzip (~> 1.1, < 2.0.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) + rubyzip (>= 1.3.0, < 3.0.0) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) rspec-activemodel-mocks (1.1.0) activemodel (>= 3.0) activesupport (>= 3.0) rspec-mocks (>= 2.99, < 4.0) - rspec-core (3.9.3) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.3) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.1) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) + rspec-support (~> 3.10.0) rspec-rails (4.0.1) actionpack (>= 4.2) activesupport (>= 4.2) @@ -690,149 +744,160 @@ GEM rspec-sidekiq (3.1.0) rspec-core (~> 3.0, >= 3.0.0) sidekiq (>= 2.4.0) - rspec-support (3.9.4) + rspec-support (3.10.0) rubocop (0.47.1) parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) - ruby-graphviz (1.2.2) - ruby-ole (1.2.12) - ruby-progressbar (1.8.1) - ruby_parser (3.14.2) + ruby-graphviz (1.2.5) + rexml + ruby-ole (1.2.12.2) + ruby-progressbar (1.10.1) + ruby-vips (2.0.17) + ffi (~> 1.9) + ruby2_keywords (0.0.2) + ruby_parser (3.15.0) sexp_processor (~> 4.9) - rubyzip (1.2.0) - s3 (0.3.24) - proxies (~> 0.2.0) + rubyzip (2.3.0) + s3 (0.3.29) + addressable + proxies sanitize (5.2.1) crass (~> 1.0.2) nokogiri (>= 1.8.0) nokogumbo (~> 2.0) - sass (3.4.21) - sass-rails (5.0.4) - railties (>= 4.0.0, < 5.0) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt sawyer (0.8.2) addressable (>= 2.3.5) faraday (> 0.8, < 2.0) - select2-rails (3.5.9.3) - thor (~> 0.14) - sexp_processor (4.14.1) - shoulda-matchers (3.1.1) - activesupport (>= 4.0.0) + select2-rails (4.0.13) + semantic_range (2.3.1) + sexp_processor (4.15.1) + shoulda-matchers (4.0.1) + activesupport (>= 4.2.0) shoulda-whenever (0.0.2) - sidekiq (4.1.0) - concurrent-ruby (~> 1.0) - connection_pool (~> 2.2, >= 2.2.0) - redis (~> 3.2, >= 3.2.1) - signet (0.7.3) + sidekiq (5.2.9) + connection_pool (~> 2.2, >= 2.2.2) + rack (~> 2.0) + rack-protection (>= 1.5.0) + redis (>= 3.3.5, < 4.2) + signet (0.14.0) addressable (~> 2.3) - faraday (~> 0.9) - jwt (~> 1.5) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.5, < 3.0) multi_json (~> 1.10) - simple_form (3.2.1) - actionpack (> 4, < 5.1) - activemodel (> 4, < 5.1) - sinatra (1.4.7) - rack (~> 1.5) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) - slop (3.6.0) + simple_form (5.0.3) + actionpack (>= 5.0) + activemodel (>= 5.0) + sinatra (2.1.0) + mustermann (~> 1.0) + rack (~> 2.2) + rack-protection (= 2.1.0) + tilt (~> 2.0) sorbet-rails (0.4.0) - spreadsheet (1.1.3) + spreadsheet (1.2.6) ruby-ole (>= 1.0) - sprockets (3.5.2) + sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-es6 (0.9.1) + sprockets-es6 (0.9.2) babel-source (>= 5.8.11) babel-transpiler sprockets (>= 3.0.0) - sprockets-rails (3.0.4) + sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sshkit (1.18.2) + sshkit (1.21.1) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) sysrandom (1.0.5) + temple (0.8.2) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) text (1.3.1) - thin (1.7.2) + thin (1.8.0) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - thor (0.19.1) + thor (1.0.1) thread_safe (0.3.6) - thredded (0.6.2) - active_record_union (>= 1.2.0) + thredded (0.16.4) + active_record_union (>= 1.3.0) autoprefixer-rails - autosize-rails - bbcoder (~> 1.0) - db_text_search (~> 0.2.0) + db_text_search (~> 0.3.0) friendly_id - gemoji - github-markdown html-pipeline - html-pipeline-vimeo - html-pipeline-youtube htmlentities inline_svg - jquery-rails kaminari + kramdown (>= 1.17.0) nokogiri + onebox (~> 1.8, >= 1.8.48) pundit (>= 1.1.0) - rails (>= 4.2.0) - rails-timeago + rails (>= 4.2.10) rb-gravatar + rinku sanitize - sass (>= 3.4.21) - select2-rails (~> 3.5) + sassc-rails (>= 2.0.0) sprockets-es6 + timeago_js tilt (2.0.10) + timeago_js (3.0.2.2) timecop (0.8.1) - tinymce-rails (4.5.6) + tinymce-rails (5.6.2.1) railties (>= 3.1.1) - typhoeus (1.0.1) - ethon (>= 0.8.0) - tzinfo (1.2.7) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.8) thread_safe (~> 0.1) uber (0.1.0) - uglifier (2.7.2) - execjs (>= 0.3.0) - json (>= 1.8.0) + uglifier (4.2.0) + execjs (>= 0.3.0, < 3) ulid (1.2.0) unf (0.1.4) unf_ext - unf_ext (0.0.7.6) - unicode-display_width (1.1.3) - uniform_notifier (1.10.0) - warden (1.2.6) - rack (>= 1.0) - webpacker (4.0.7) - activesupport (>= 4.2) + unf_ext (0.0.7.7) + unicode-display_width (1.7.0) + uniform_notifier (1.13.0) + warden (1.2.9) + rack (>= 2.0.9) + webpacker (5.2.1) + activesupport (>= 5.2) rack-proxy (>= 0.6.1) - railties (>= 4.2) - websocket-driver (0.7.0) + railties (>= 5.2) + semantic_range (>= 2.3.0) + websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - whenever (0.9.7) + whenever (1.0.0) chronic (>= 0.6.3) - where-or (0.1.6) - wicked_pdf (1.0.6) - wkhtmltopdf-binary-edge (0.12.3.0) - write_xlsx (0.85.7) + wicked_pdf (2.1.0) + activesupport + wkhtmltopdf-binary-edge (0.12.6.0) + write_xlsx (0.86.0) rubyzip (>= 1.0.0) zip-zip x-editable-rails (1.5.5.1) railties xml-simple (1.1.5) - xmlrpc (0.3.0) + xmlrpc (0.3.1) xpath (2.1.0) nokogiri (~> 1.3) zip-zip (0.3) @@ -843,17 +908,17 @@ PLATFORMS DEPENDENCIES active_model_serializers - acts_as_paranoid (~> 0.6.1) - ancestry (~> 3.0, >= 3.0.5) - apartment (~> 1.2) + acts_as_paranoid (~> 0.7.0) + ancestry (~> 3.2, >= 3.2.1) + apartment (~> 2.2, >= 2.2.1) appsignal (~> 1.1.9) asset_sync - bootstrap-datepicker-rails (~> 1.5) - bootstrap-sass (~> 3.3.5) - bourbon (~> 4.2) - browser (~> 2.1) - bullet (= 5.4.3) - cancancan (~> 1.13, >= 1.13.1) + bootstrap-datepicker-rails (~> 1.9, >= 1.9.0.1) + bootstrap-sass (~> 3.4, >= 3.4.1) + bourbon (~> 7.0) + browser (~> 5.1) + bullet (~> 6.1) + cancancan (~> 3.1) capistrano (= 3.9.0) capistrano-foreman capistrano-passenger (~> 0.1.1) @@ -861,34 +926,35 @@ DEPENDENCIES capistrano-rvm (~> 0.1.2) capistrano-sidekiq (~> 1.0, >= 1.0.3) capybara (~> 2.15.4) - carrierwave (~> 1.1.0) - caxlsx (~> 2.0, >= 2.0.2) - chartkick (~> 3.4) - cocoon (~> 1.2, >= 1.2.9) - coffee-rails (~> 4.1.0) + carrierwave (~> 2.1) + caxlsx (~> 3.0, >= 3.0.3) + chartkick (~> 3.4, >= 3.4.2) + cocoon (~> 1.2, >= 1.2.15) + coffee-rails (~> 5.0) + dalli (~> 2.7, >= 2.7.11) danger (~> 5.16, >= 5.16.1) database_cleaner (~> 1.5, >= 1.5.1) - datagrid (~> 1.4.2) - devise (~> 3.5, >= 3.5.2) - devise_token_auth (~> 0.1.37) - doorkeeper (~> 4.4, >= 4.4.3) - dotenv-rails (~> 2.0.2) - dotiw (~> 4.0.1) - draper (~> 2.1) - dropzonejs-rails (~> 0.7.3) - enumerize (~> 2.3.1) - factory_girl_rails (~> 4.5) - ffaker (~> 2.1.0) + datagrid (~> 1.6, >= 1.6.1) + devise (~> 4.7, >= 4.7.3) + devise_token_auth + doorkeeper (~> 5.4) + dotenv-rails (~> 2.7, >= 2.7.6) + dotiw (~> 5.2) + draper (~> 4.0, >= 4.0.1) + dropzonejs-rails (~> 0.8.5) + enumerize (~> 2.3, >= 2.3.1) + factory_girl_rails (~> 4.9) + ffaker (~> 2.17) flay (~> 2.12, >= 2.12.1) fog - font-awesome-rails (~> 4.7) - foreman (~> 0.78.0) - friendly_id (~> 5.1.0) - fullcalendar-rails (~> 3.2.0.0) - globalize (~> 5.1.0) - google-api-client (~> 0.10) - haml-rails (~> 0.9) - jbuilder (~> 2.0) + font-awesome-rails (~> 4.7, >= 4.7.0.5) + foreman (~> 0.87.2) + friendly_id (~> 5.4, >= 5.4.1) + fullcalendar-rails (~> 3.9) + globalize (~> 5.3) + google-api-client (~> 0.23.9) + haml-rails (~> 2.0, >= 2.0.1) + jbuilder (~> 2.10, >= 2.10.1) jquery-datatables-rails (~> 3.4) jquery-rails jquery-ui-rails @@ -898,58 +964,57 @@ DEPENDENCIES kaminari launchy (~> 2.4, >= 2.4.3) letter_opener (~> 1.4.1) - letter_opener_web (~> 1.3, >= 1.3.4) + letter_opener_web mail_interceptor (~> 0.0.7) metainspector - mini_magick (~> 4.5) - momentjs-rails (~> 2.17.1) - mongoid (~> 5.2, >= 5.2.1) + mini_magick (~> 4.11) + momentjs-rails (~> 2.20, >= 2.20.1) + mongoid (~> 6.1, >= 6.1.1) mongoid-rspec (~> 4.0, >= 4.0.1) - neat (~> 1.8) - omniauth (~> 1.3, >= 1.3.1) - paper_trail (~> 5.2) + neat (~> 1.7, >= 1.7.4) + omniauth (~> 1.9, >= 1.9.1) + paper_trail (~> 11.0) pg (~> 0.18.4) phantomjs - phony_rails (~> 0.12.11) + phony_rails (~> 0.14.13) poltergeist (~> 1.9.0) pry - pundit (~> 1.1) + pundit (~> 2.1) rack-cors rack-mini-profiler (~> 1.0) - rails (= 4.2.2) + rails (~> 5.2, <= 5.2.4.4) rails-erd - react-rails (~> 2.6.0) - roo (~> 2.2) + react-rails (~> 2.6, >= 2.6.1) + roo (~> 2.8, >= 2.8.3) rspec-activemodel-mocks (~> 1.1) - rspec-rails (~> 4.0.0) + rspec-rails rspec-sidekiq (~> 3.0, >= 3.0.3) rubocop (~> 0.47.1) s3 - sass-rails (~> 5.0) - select2-rails (~> 3.5.9.3) + sass-rails (~> 6.0) + select2-rails (~> 4.0, >= 4.0.13) shoulda-matchers shoulda-whenever (~> 0.0.2) - sidekiq (~> 4.1.0) - simple_form (~> 3.2) + sidekiq (~> 5.2, >= 5.2.9) + simple_form (~> 5.0, >= 5.0.3) sinatra sorbet-rails - spreadsheet (~> 1.1.3) + spreadsheet (~> 1.2, >= 1.2.6) sysrandom (~> 1.0, >= 1.0.5) text (~> 1.3, >= 1.3.1) thin (~> 1.7) - thredded (~> 0.6.1) + thredded (~> 0.16.4) timecop (~> 0.8.1) - tinymce-rails (~> 4.5.6) + tinymce-rails (~> 5.6, >= 5.6.2.1) typhoeus - uglifier (>= 1.3.0) + uglifier (~> 4.2) ulid (~> 1.2) - webpacker (~> 4.0.7) - whenever (~> 0.9.4) - where-or (~> 0.1.6) - wicked_pdf (~> 1.0, >= 1.0.6) - wkhtmltopdf-binary-edge (~> 0.12.3.0) - write_xlsx (~> 0.85.7) + webpacker (~> 5.2, >= 5.2.1) + whenever (~> 1.0) + wicked_pdf (~> 2.1) + wkhtmltopdf-binary-edge (~> 0.12.6.0) + write_xlsx (~> 0.86.0) x-editable-rails (~> 1.5, >= 1.5.5.1) BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/app/classes/domain_cache_directory.rb b/app/classes/domain_cache_directory.rb new file mode 100644 index 0000000000..7ac35e58a4 --- /dev/null +++ b/app/classes/domain_cache_directory.rb @@ -0,0 +1,5 @@ +class DomainCacheDirectory + def self.call(request) + Rails.root.join("public", request.domain) + end +end diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb index 36037cc748..3608551db5 100644 --- a/app/controllers/clients_controller.rb +++ b/app/controllers/clients_controller.rb @@ -4,6 +4,7 @@ class ClientsController < AdminController include ClientAdvancedSearchesConcern include ClientGridOptions + caches_action :index before_action :assign_active_client_prams, only: :index before_action :format_search_params, only: [:index] before_action :get_quantitative_fields, :get_hotline_fields, :hotline_call_column, only: [:index] diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index 89cbc842f2..d63fdc0e08 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -1,5 +1,6 @@ class DashboardsController < AdminController before_action :task_of_user, :find_overhaul_task_params, :find_tasks, only: [:index] + caches_page :index def index @setting = Setting.first diff --git a/config/application.rb b/config/application.rb index 41f7c1d35a..596f947fd3 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,6 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' -require "rails/all" +require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) diff --git a/config/boot.rb b/config/boot.rb index 6b750f00b1..b9e460cef3 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,4 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. +require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000000..ed89642475 --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> + channel_prefix: cif_web_production diff --git a/config/environment.rb b/config/environment.rb index ee8d90dc65..426333bb46 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require_relative 'application' # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index b56744af5d..82f222cd4e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -11,7 +11,9 @@ # Show full error reports and disable caching. config.consider_all_requests_local = true - config.action_controller.perform_caching = false + config.perform_caching = true + config.action_controller.perform_caching = true + config.cache_store = :mem_cache_store # Don't care if the mailer can't send. config.action_mailer.perform_deliveries = true diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 0000000000..d32f76e8fb --- /dev/null +++ b/config/storage.yml @@ -0,0 +1,34 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> + +# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# amazon: +# service: S3 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> +# region: us-east-1 +# bucket: your_own_bucket + +# Remember not to checkin your GCS keyfile to a repository +# google: +# service: GCS +# project: your_project +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> +# bucket: your_own_bucket + +# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# microsoft: +# service: AzureStorage +# storage_account_name: your_account_name +# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> +# container: your_container_name + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ] From 16c128b4ab9493e3db4eff2bb36eb75940ee05ea Mon Sep 17 00:00:00 2001 From: kirykr Date: Fri, 11 Dec 2020 11:04:12 +0700 Subject: [PATCH 04/27] ran rails app:update --- Gemfile | 8 ++++ Gemfile.lock | 16 ++++++++ bin/bundle | 2 +- bin/rails | 2 +- bin/setup | 33 +++++++++------- bin/update | 31 +++++++++++++++ bin/yarn | 11 ++++++ config/application.rb | 1 + config/environments/development.rb | 27 +++++++++++-- config/environments/production.rb | 35 ++++++++++++++++- config/environments/test.rb | 19 ++++++++-- .../application_controller_renderer.rb | 8 ++++ config/initializers/assets.rb | 10 +++-- .../initializers/content_security_policy.rb | 25 ++++++++++++ config/initializers/cookies_serializer.rb | 2 + .../new_framework_defaults_5_2.rb | 38 +++++++++++++++++++ config/puma.rb | 37 ++++++++++++++++++ 17 files changed, 278 insertions(+), 27 deletions(-) create mode 100755 bin/update create mode 100755 bin/yarn create mode 100644 config/initializers/application_controller_renderer.rb create mode 100644 config/initializers/content_security_policy.rb create mode 100644 config/initializers/new_framework_defaults_5_2.rb create mode 100644 config/puma.rb diff --git a/Gemfile b/Gemfile index 40645783d2..e6955caacc 100644 --- a/Gemfile +++ b/Gemfile @@ -1,13 +1,18 @@ source 'https://rubygems.org' +git_source(:github) { |repo| "https://github.com/#{repo}.git" } +ruby '2.5.3' # gem 'rails', '4.2.2' gem 'rails', '~> 5.2', '<= 5.2.4.4' gem 'pg', '~> 0.18.4' +gem 'puma', '~> 3.11' gem 'jquery-rails' gem 'jquery-ui-rails' gem 'sass-rails', '~> 6.0' gem 'uglifier', '~> 4.2' gem 'coffee-rails', '~> 5.0' +gem 'bootsnap', '>= 1.1.0', require: false +gem 'mini_racer', platforms: :ruby gem 'jbuilder', '~> 2.10', '>= 2.10.1' gem 'simple_form', '~> 5.0', '>= 5.0.3' gem 'bootstrap-sass', '~> 3.4', '>= 3.4.1' @@ -77,6 +82,7 @@ gem 'ulid', '~> 1.2' gem 'dalli', '~> 2.7', '>= 2.7.11' group :development, :test do + gem 'byebug', platforms: %i[mri mingw x64_mingw] gem 'pry' gem 'rspec-rails' gem 'factory_girl_rails', '~> 4.9' @@ -124,3 +130,5 @@ group :test do gem 'rspec-activemodel-mocks', '~> 1.1' gem 'timecop', '~> 0.8.1' end + +gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] diff --git a/Gemfile.lock b/Gemfile.lock index 570037bbda..72277dea93 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -88,6 +88,8 @@ GEM babel-source (>= 4.0, < 6) execjs (~> 2.0) bcrypt (3.1.16) + bootsnap (1.5.1) + msgpack (~> 1.0) bootstrap-datepicker-rails (1.9.0.1) railties (>= 3.0) bootstrap-sass (3.4.1) @@ -101,6 +103,7 @@ GEM bullet (6.1.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) + byebug (11.1.3) cancancan (3.1.0) capistrano (3.9.0) airbrussh (>= 1.0.0) @@ -523,6 +526,7 @@ GEM actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) + libv8 (8.4.255.0) loofah (2.8.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) @@ -551,6 +555,8 @@ GEM mini_magick (4.11.0) mini_mime (1.0.2) mini_portile2 (2.4.0) + mini_racer (0.3.1) + libv8 (~> 8.4.255) minitest (5.14.2) momentjs-rails (2.20.1) railties (>= 3.1) @@ -569,6 +575,7 @@ GEM rspec-core (~> 3.3) rspec-expectations (~> 3.3) rspec-mocks (~> 3.3) + msgpack (1.3.3) multi_json (1.15.0) multipart-post (2.1.1) mustache (1.1.1) @@ -632,6 +639,7 @@ GEM coderay (~> 1.1) method_source (~> 1.0) public_suffix (4.0.6) + puma (3.12.6) pundit (2.1.0) activesupport (>= 3.0.0) rack (2.2.3) @@ -913,11 +921,13 @@ DEPENDENCIES apartment (~> 2.2, >= 2.2.1) appsignal (~> 1.1.9) asset_sync + bootsnap (>= 1.1.0) bootstrap-datepicker-rails (~> 1.9, >= 1.9.0.1) bootstrap-sass (~> 3.4, >= 3.4.1) bourbon (~> 7.0) browser (~> 5.1) bullet (~> 6.1) + byebug cancancan (~> 3.1) capistrano (= 3.9.0) capistrano-foreman @@ -968,6 +978,7 @@ DEPENDENCIES mail_interceptor (~> 0.0.7) metainspector mini_magick (~> 4.11) + mini_racer momentjs-rails (~> 2.20, >= 2.20.1) mongoid (~> 6.1, >= 6.1.1) mongoid-rspec (~> 4.0, >= 4.0.1) @@ -979,6 +990,7 @@ DEPENDENCIES phony_rails (~> 0.14.13) poltergeist (~> 1.9.0) pry + puma (~> 3.11) pundit (~> 2.1) rack-cors rack-mini-profiler (~> 1.0) @@ -1007,6 +1019,7 @@ DEPENDENCIES timecop (~> 0.8.1) tinymce-rails (~> 5.6, >= 5.6.2.1) typhoeus + tzinfo-data uglifier (~> 4.2) ulid (~> 1.2) webpacker (~> 5.2, >= 5.2.1) @@ -1016,5 +1029,8 @@ DEPENDENCIES write_xlsx (~> 0.86.0) x-editable-rails (~> 1.5, >= 1.5.5.1) +RUBY VERSION + ruby 2.5.3p105 + BUNDLED WITH 2.1.4 diff --git a/bin/bundle b/bin/bundle index 66e9889e8b..f19acf5b5c 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,3 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails index 0138d79b75..5badb2fde0 100755 --- a/bin/rails +++ b/bin/rails @@ -4,6 +4,6 @@ begin rescue LoadError => e raise unless e.message.include?('spring') end -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/setup b/bin/setup index acdb2c1389..94fd4d7977 100755 --- a/bin/setup +++ b/bin/setup @@ -1,29 +1,36 @@ #!/usr/bin/env ruby -require 'pathname' +require 'fileutils' +include FileUtils # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = File.expand_path('..', __dir__) -Dir.chdir APP_ROOT do +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do # This script is a starting point to setup your application. - # Add necessary setup steps to this file: + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') - puts "== Installing dependencies ==" - system "gem install bundler --conservative" - system "bundle check || bundle install" + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') # puts "\n== Copying sample files ==" - # unless File.exist?("config/database.yml") - # system "cp config/database.yml.sample config/database.yml" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system "bin/rake db:setup" + system! 'bin/rails db:setup' puts "\n== Removing old logs and tempfiles ==" - system "rm -f log/*" - system "rm -rf tmp/cache" + system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system "touch tmp/restart.txt" + system! 'bin/rails restart' end diff --git a/bin/update b/bin/update new file mode 100755 index 0000000000..58bfaed518 --- /dev/null +++ b/bin/update @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 0000000000..460dd565b4 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path('..', __dir__) +Dir.chdir(APP_ROOT) do + begin + exec "yarnpkg", *ARGV + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index 596f947fd3..934f786f61 100644 --- a/config/application.rb +++ b/config/application.rb @@ -7,6 +7,7 @@ module CifWeb class Application < Rails::Application + config.load_defaults 5.0 config.middleware.use 'Apartment::Elevators::Subdomain' config.middleware.insert_before 'Warden::Manager', 'Apartment::Elevators::Subdomain' # Settings in config/environments/* take precedence over those specified here. diff --git a/config/environments/development.rb b/config/environments/development.rb index 82f222cd4e..cb5b5e7d97 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -11,15 +11,32 @@ # Show full error reports and disable caching. config.consider_all_requests_local = true - config.perform_caching = true - config.action_controller.perform_caching = true - config.cache_store = :mem_cache_store + # Enable/disable caching. By default caching is disabled. + # Run rails dev:cache to toggle caching. + if Rails.root.join('tmp', 'caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{2.days.to_i}" + } + else + config.perform_caching = true + config.action_controller.perform_caching = true + config.cache_store = :mem_cache_store + + # config.cache_store = :null_store + end + + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local + # Don't care if the mailer can't send. config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = false # config.action_mailer.delivery_method = :smtp - + config.action_mailer.perform_caching = false # config.action_mailer.smtp_settings = { # address: 'email-smtp.us-east-1.amazonaws.com', # authentication: :login, @@ -44,6 +61,8 @@ # number of complex assets. config.assets.debug = true + # Suppress logger output for asset requests. + config.assets.quiet = true # Asset digests allow you to set far-future HTTP expiration dates on all assets, # yet still be able to expire them through the digest params. config.assets.digest = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 5bce3bdf49..b52eff642a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -20,9 +20,13 @@ # NGINX, varnish or squid. # config.action_dispatch.rack_cache = true + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true + # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -59,9 +63,21 @@ } # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # Store uploaded files on the local file system (see config/storage.yml for options) + # config.active_storage.service = :local + + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true @@ -72,6 +88,7 @@ # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] + config.log_tags = [ :request_id ] # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) @@ -81,6 +98,11 @@ # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resqu + # config.active_job.queue_name_prefix = "cif_web_#{Rails.env}" + + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. @@ -96,6 +118,17 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + + # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false end diff --git a/config/environments/test.rb b/config/environments/test.rb index 414787bf18..48c3e58d3d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -12,9 +12,11 @@ # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - # Configure static file server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = 'public, max-age=3600' + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{1.hour.to_i}" + } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -26,10 +28,21 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + # Store uploaded files on the local file system in a temporary directory + config.active_storage.service = :test + + config.action_mailer.perform_caching = false + # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true config.action_mailer.default_url_options = { host: 'lvh.me', port: 3001 } config.logger = ActiveSupport::Logger.new(config.paths['log'].first, 1, 50 * 1024 * 1024) diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 0000000000..89d2efab2b --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 03cfd986b5..5f239ce646 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,12 +3,14 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' -# Add additional assets to the asset load path +# Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path +# Add Yarn node_modules folder to the asset load path. +Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. - -# Rich text editor for the Domain +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) Rails.application.config.assets.precompile += %w(jquery.nicescroll.js animate.css toastr.min.css custom.css green.png) Rails.application.config.assets.precompile += %w(chariot.min.js chariot.min.css) diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 0000000000..d3bcaa5ec8 --- /dev/null +++ b/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy +# For further information see the following documentation +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy + +# Rails.application.config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https + +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end + +# If you are using UJS then enable automatic nonce generation +# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } + +# Report CSP violations to a specified URI +# For further information see the following documentation: +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only +# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 7f70458dee..5a6a32d371 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ # Be sure to restart your server when you modify this file. +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/new_framework_defaults_5_2.rb b/config/initializers/new_framework_defaults_5_2.rb new file mode 100644 index 0000000000..c383d072bc --- /dev/null +++ b/config/initializers/new_framework_defaults_5_2.rb @@ -0,0 +1,38 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.2 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make Active Record use stable #cache_key alongside new #cache_version method. +# This is needed for recyclable cache keys. +# Rails.application.config.active_record.cache_versioning = true + +# Use AES-256-GCM authenticated encryption for encrypted cookies. +# Also, embed cookie expiry in signed or encrypted cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 5.2. +# +# Existing cookies will be converted on read then written with the new scheme. +# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true + +# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages +# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. +# Rails.application.config.active_support.use_authenticated_message_encryption = true + +# Add default protection from forgery to ActionController::Base instead of in +# ApplicationController. +# Rails.application.config.action_controller.default_protect_from_forgery = true + +# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and +# 'f' after migrating old data. +# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true + +# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. +# Rails.application.config.active_support.use_sha1_digests = true + +# Make `form_with` generate id attributes for any generated HTML tags. +# Rails.application.config.action_view.form_with_generates_ids = true diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 0000000000..b2102072b0 --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,37 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers: a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum; this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the `pidfile` that Puma will use. +pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. +# +# preload_app! + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart From 4828dc5a5dc8fd96b5b5e23bcfc28f6ff5f3b288 Mon Sep 17 00:00:00 2001 From: kirykr Date: Mon, 14 Dec 2020 14:29:11 +0700 Subject: [PATCH 05/27] moving rails 4 to 5 --- Gemfile | 7 +- Gemfile.lock | 232 +- app/assets/config/__init__.py | 0 app/assets/config/manifest.js | 3 + app/assets/javascripts/application.js | 2 +- app/assets/javascripts/clients/index.coffee | 7 +- app/assets/stylesheets/application.scss | 160 +- app/assets/stylesheets/clients/index.scss | 100 +- app/assets/stylesheets/common_index.scss | 68 +- app/assets/stylesheets/form.scss | 22 +- .../families/family_fields.rb | 2 +- app/classes/dashboard.rb | 4 +- app/classes/domain_cache_directory.rb | 2 +- app/controllers/application_controller.rb | 21 +- app/controllers/clients_controller.rb | 6 +- app/controllers/dashboards_controller.rb | 3 +- app/helpers/application_helper.rb | 2 +- app/helpers/subdomain_helper.rb | 5 +- app/jobs/__init__.py | 0 app/jobs/application_job.rb | 2 + app/models/action_result.rb | 2 +- app/models/admin_user.rb | 2 +- app/models/advanced_search.rb | 2 +- app/models/agency.rb | 2 +- app/models/agency_client.rb | 2 +- app/models/application_record.rb | 3 + app/models/assessment.rb | 2 +- app/models/assessment_domain.rb | 2 +- app/models/attachment.rb | 2 +- app/models/calendar.rb | 2 +- app/models/call.rb | 2 +- app/models/call_necessity.rb | 2 +- app/models/call_protection_concern.rb | 2 +- app/models/carer.rb | 2 +- app/models/case.rb | 2 +- app/models/case_closure.rb | 2 +- app/models/case_contract.rb | 2 +- app/models/case_note.rb | 2 +- app/models/case_note_domain_group.rb | 2 +- app/models/case_worker_client.rb | 2 +- app/models/changelog.rb | 2 +- app/models/changelog_type.rb | 2 +- app/models/children_plan.rb | 2 +- app/models/client.rb | 6 +- app/models/client_enrollment.rb | 4 +- app/models/client_enrollment_tracking.rb | 2 +- app/models/client_history.rb | 18 +- app/models/client_quantitative_case.rb | 2 +- app/models/client_right.rb | 2 +- app/models/client_right_government_form.rb | 2 +- app/models/client_type.rb | 2 +- app/models/client_type_government_form.rb | 2 +- app/models/commune.rb | 2 +- app/models/custom_assessment_setting.rb | 2 +- app/models/custom_field.rb | 2 +- app/models/custom_field_permission.rb | 2 +- app/models/custom_field_property.rb | 2 +- app/models/data_tracker.rb | 2 +- app/models/department.rb | 2 +- app/models/district.rb | 2 +- app/models/domain.rb | 4 +- app/models/domain_group.rb | 2 +- app/models/domain_program_stream.rb | 2 +- app/models/donor.rb | 8 +- app/models/donor_organization.rb | 2 +- app/models/enter_ngo.rb | 2 +- app/models/enter_ngo_history.rb | 2 +- app/models/enter_ngo_user.rb | 2 +- app/models/exit_ngo.rb | 2 +- app/models/external_system.rb | 2 +- app/models/external_system_global_identity.rb | 2 +- app/models/family.rb | 4 +- app/models/family_member.rb | 2 +- app/models/family_plan.rb | 2 +- app/models/field_setting.rb | 2 +- app/models/form_builder_attachment.rb | 2 +- app/models/global_identity.rb | 2 +- app/models/global_identity_organization.rb | 2 +- app/models/global_service.rb | 2 +- app/models/government_form.rb | 2 +- app/models/government_form_children_plan.rb | 2 +- app/models/government_form_family_plan.rb | 2 +- app/models/government_form_interviewee.rb | 2 +- app/models/government_form_need.rb | 2 +- app/models/government_form_problem.rb | 2 +- app/models/government_form_service_type.rb | 2 +- app/models/hotline.rb | 4 +- app/models/intervention.rb | 2 +- app/models/interviewee.rb | 2 +- app/models/leave_program.rb | 2 +- app/models/location.rb | 2 +- app/models/material.rb | 2 +- app/models/necessity.rb | 2 +- app/models/need.rb | 2 +- app/models/organization.rb | 2 +- app/models/organization_type.rb | 2 +- app/models/partner.rb | 2 +- app/models/permission.rb | 2 +- app/models/problem.rb | 2 +- app/models/program_stream.rb | 2 +- app/models/program_stream_permission.rb | 2 +- app/models/program_stream_service.rb | 2 +- app/models/progress_note.rb | 2 +- app/models/progress_note_type.rb | 2 +- app/models/protection_concern.rb | 2 +- app/models/province.rb | 2 +- app/models/quantitative_case.rb | 2 +- app/models/quantitative_type.rb | 2 +- app/models/quantitative_type_permission.rb | 2 +- app/models/quarterly_report.rb | 2 +- app/models/referee.rb | 2 +- app/models/referral.rb | 2 +- app/models/referral_source.rb | 2 +- app/models/service.rb | 2 +- app/models/service_type.rb | 2 +- app/models/setting.rb | 2 +- app/models/shared_client.rb | 2 +- app/models/sponsor.rb | 2 +- app/models/state.rb | 2 +- app/models/subdistrict.rb | 2 +- app/models/survey.rb | 2 +- app/models/task.rb | 2 +- app/models/township.rb | 2 +- app/models/tracking.rb | 2 +- app/models/user.rb | 4 +- app/models/village.rb | 2 +- app/models/visit.rb | 2 +- app/models/visit_client.rb | 2 +- app/uploaders/image_uploader.rb | 2 + app/views/clients/index.html.haml | 8 +- app/views/datagrid/_order_for.html.haml | 8 +- app/views/devise/sessions/new.html.haml | 2 +- app/views/kaminari/_last_page.html.haml | 2 +- app/views/kaminari/_next_page.html.haml | 2 +- app/views/kaminari/_page.html.haml | 2 +- app/views/layouts/_side_menu.haml | 4 +- app/views/layouts/_top_navbar.haml | 2 +- app/views/layouts/mailer.html.haml | 10 +- app/views/organizations/index.html.haml | 2 +- config/application.rb | 23 +- config/environments/development.rb | 8 +- ...e_record_belongs_to_required_by_default.rb | 1 + config/initializers/paper_trail.rb | 14 +- config/initializers/thredded.rb | 140 +- ...dd_foreign_type_to_version_associations.rb | 24 + db/schema.rb | 6520 ++++++++++++----- 146 files changed, 5315 insertions(+), 2360 deletions(-) create mode 100644 app/assets/config/__init__.py create mode 100644 app/assets/config/manifest.js create mode 100644 app/jobs/__init__.py create mode 100644 app/jobs/application_job.rb create mode 100644 app/models/application_record.rb create mode 100644 config/initializers/active_record_belongs_to_required_by_default.rb create mode 100644 db/migrate/20201214014711_add_foreign_type_to_version_associations.rb diff --git a/Gemfile b/Gemfile index e6955caacc..f3e07f4fc9 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem 'devise', '~> 4.7', '>= 4.7.3' gem 'haml-rails', '~> 2.0', '>= 2.0.1' gem 'dotenv-rails', '~> 2.7', '>= 2.7.6' gem 'roo', '~> 2.8', '>= 2.8.3' -gem 'fog' +gem 'fog-aws', '~> 3.3' gem 's3' gem 'ffaker', '~> 2.17' gem 'draper', '~> 4.0', '>= 4.0.1' @@ -54,7 +54,8 @@ gem 'browser', '~> 5.1' gem 'whenever', '~> 1.0' gem 'thredded', '~> 0.16.4' gem 'cocoon', '~> 1.2', '>= 1.2.15' -gem 'paper_trail', '~> 11.0' +gem 'paper_trail', '~> 10.0', '>= 10.0.1' +gem 'paper_trail-association_tracking', '~> 2.1', '>= 2.1.1' gem 'carrierwave', '~> 2.1' gem 'mini_magick', '~> 4.11' gem 'chartkick', '~> 3.4', '>= 3.4.2' @@ -80,6 +81,8 @@ gem 'globalize', '~> 5.3' gem 'enumerize', '~> 2.3', '>= 2.3.1' gem 'ulid', '~> 1.2' gem 'dalli', '~> 2.7', '>= 2.7.11' +gem 'actionpack-page_caching', '~> 1.2', '>= 1.2.3' +gem 'actionpack-action_caching', '~> 1.2', '>= 1.2.1' group :development, :test do gem 'byebug', platforms: %i[mri mingw x64_mingw] diff --git a/Gemfile.lock b/Gemfile.lock index 72277dea93..773ed644b0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,6 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (2.3.6) actioncable (5.2.4.4) actionpack (= 5.2.4.4) nio4r (~> 2.0) @@ -19,6 +18,10 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionpack-action_caching (1.2.1) + actionpack (>= 4.0.0) + actionpack-page_caching (1.2.3) + actionpack (>= 5.0.0) actionview (5.2.4.4) activesupport (= 5.2.4.4) builder (~> 3.1) @@ -61,9 +64,6 @@ GEM public_suffix (>= 2.0.2, < 5.0) airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - aliyun-sdk (0.8.0) - nokogiri (~> 1.6) - rest-client (~> 2.0) ancestry (3.2.1) activerecord (>= 4.2.0) apartment (2.2.1) @@ -88,8 +88,11 @@ GEM babel-source (>= 4.0, < 6) execjs (~> 2.0) bcrypt (3.1.16) + bcrypt (3.1.16-java) bootsnap (1.5.1) msgpack (~> 1.0) + bootsnap (1.5.1-java) + msgpack (~> 1.0) bootstrap-datepicker-rails (1.9.0.1) railties (>= 3.0) bootstrap-sass (3.4.1) @@ -99,6 +102,7 @@ GEM thor (~> 1.0) browser (5.1.0) bson (4.11.1) + bson (4.11.1-java) builder (3.2.4) bullet (6.1.0) activesupport (>= 3.0.0) @@ -222,7 +226,6 @@ GEM request_store (>= 1.0) dropzonejs-rails (0.8.5) rails (> 3.1) - dry-inflector (0.2.0) enumerize (2.3.1) activesupport (>= 3.2) erubi (1.10.0) @@ -230,6 +233,9 @@ GEM ethon (0.12.0) ffi (>= 1.3.0) eventmachine (1.2.7) + eventmachine (1.2.7-java) + eventmachine (1.2.7-x64-mingw32) + eventmachine (1.2.7-x86-mingw32) excon (0.78.1) execjs (2.7.0) factory_girl (4.9.0) @@ -251,168 +257,27 @@ GEM fastimage (2.2.0) ffaker (2.17.0) ffi (1.13.1) - fission (0.5.0) - CFPropertyList (~> 2.2) + ffi (1.13.1-java) + ffi (1.13.1-x64-mingw32) + ffi (1.13.1-x86-mingw32) flay (2.12.1) erubis (~> 2.7.0) path_expander (~> 1.0) ruby_parser (~> 3.0) sexp_processor (~> 4.0) - fog (2.2.0) - fog-aliyun (>= 0.1.0) - fog-atmos - fog-aws (>= 0.6.0) - fog-brightbox (~> 0.4) - fog-cloudatcost (~> 0.4) - fog-cloudstack (~> 0.1.0) - fog-core (~> 2.1) - fog-digitalocean (>= 0.3.0) - fog-dnsimple (~> 2.1) - fog-dynect (~> 0.0.2) - fog-ecloud (~> 0.1) - fog-google (~> 1.0) - fog-internet-archive - fog-json - fog-local - fog-openstack - fog-ovirt - fog-powerdns (>= 0.1.1) - fog-profitbricks - fog-rackspace - fog-radosgw (>= 0.0.2) - fog-riakcs - fog-sakuracloud (>= 0.0.4) - fog-serverlove - fog-softlayer - fog-storm_on_demand - fog-terremark - fog-vmfusion - fog-voxel - fog-vsphere (>= 0.4.0) - fog-xenserver - fog-xml (~> 0.1.1) - ipaddress (~> 0.5) - json (~> 2.0) - fog-aliyun (0.3.19) - aliyun-sdk (~> 0.8.0) - fog-core - fog-json - ipaddress (~> 0.8) - xml-simple (~> 1.1) - fog-atmos (0.1.0) - fog-core - fog-xml fog-aws (3.7.0) fog-core (~> 2.1) fog-json (~> 1.1) fog-xml (~> 0.1) ipaddress (~> 0.8) - fog-brightbox (0.16.1) - dry-inflector - fog-core - fog-json - mime-types - fog-cloudatcost (0.4.0) - fog-core - fog-json - ipaddress - fog-cloudstack (0.1.0) - fog-core (~> 2.1) - fog-json (~> 1.1) - fog-xml (~> 0.1) fog-core (2.2.3) builder excon (~> 0.71) formatador (~> 0.2) mime-types - fog-digitalocean (0.4.0) - fog-core - fog-json - fog-xml - ipaddress (>= 0.5) - fog-dnsimple (2.1.0) - fog-core (>= 1.38, < 3) - fog-json - fog-dynect (0.0.3) - fog-core - fog-json - fog-xml - fog-ecloud (0.3.0) - fog-core - fog-xml - fog-google (1.7.1) - fog-core - fog-json - fog-xml - google-api-client (~> 0.23.0) - fog-internet-archive (0.0.2) - fog-core - fog-json - fog-xml fog-json (1.2.0) fog-core multi_json (~> 1.10) - fog-local (0.6.0) - fog-core (>= 1.27, < 3.0) - fog-openstack (1.0.11) - fog-core (~> 2.1) - fog-json (>= 1.0) - ipaddress (>= 0.8) - fog-ovirt (1.2.5) - fog-core - fog-json - fog-xml - ovirt-engine-sdk (>= 4.1.3) - rbovirt (~> 0.1.5) - fog-powerdns (0.2.0) - fog-core - fog-json - fog-xml - fog-profitbricks (0.0.5) - fog-core - fog-xml - nokogiri - fog-rackspace (0.1.6) - fog-core (>= 1.35) - fog-json (>= 1.0) - fog-xml (>= 0.1) - ipaddress (>= 0.8) - fog-radosgw (0.0.5) - fog-core (>= 1.21.0) - fog-json - fog-xml (>= 0.0.1) - fog-riakcs (0.1.0) - fog-core - fog-json - fog-xml - fog-sakuracloud (1.7.5) - fog-core - fog-json - fog-serverlove (0.1.2) - fog-core - fog-json - fog-softlayer (1.1.4) - fog-core - fog-json - fog-storm_on_demand (0.1.1) - fog-core - fog-json - fog-terremark (0.1.0) - fog-core - fog-xml - fog-vmfusion (0.1.0) - fission - fog-core - fog-voxel (0.1.0) - fog-core - fog-xml - fog-vsphere (3.5.0) - fog-core - rbvmomi (>= 1.9, < 3) - fog-xenserver (1.0.0) - fog-core - fog-xml - xmlrpc fog-xml (0.1.3) fog-core nokogiri (>= 1.5.11, < 2.0.0) @@ -468,7 +333,6 @@ GEM nokogiri (>= 1.6.0) ruby_parser (~> 3.5) htmlentities (4.3.4) - http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) httpclient (2.8.3) @@ -500,6 +364,7 @@ GEM json (>= 1.8.3) railties (>= 3.1) json (2.3.1) + json (2.3.1-java) json_spec (1.1.5) multi_json (~> 1.0) rspec (>= 2.0, < 4.0) @@ -520,6 +385,9 @@ GEM kramdown (1.17.0) launchy (2.4.3) addressable (~> 2.3) + launchy (2.4.3-java) + addressable (~> 2.3) + spoon (~> 0.0.1) letter_opener (1.4.1) launchy (~> 2.2) letter_opener_web (1.3.4) @@ -576,6 +444,9 @@ GEM rspec-expectations (~> 3.3) rspec-mocks (~> 3.3) msgpack (1.3.3) + msgpack (1.3.3-java) + msgpack (1.3.3-x64-mingw32) + msgpack (1.3.3-x86-mingw32) multi_json (1.15.0) multipart-post (2.1.1) mustache (1.1.1) @@ -589,11 +460,16 @@ GEM net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) net-ssh (6.1.0) - netrc (0.11.0) nio4r (2.5.4) + nio4r (2.5.4-java) no_proxy_fix (0.1.2) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) + nokogiri (1.10.10-java) + nokogiri (1.10.10-x64-mingw32) + mini_portile2 (~> 2.4.0) + nokogiri (1.10.10-x86-mingw32) + mini_portile2 (~> 2.4.0) nokogumbo (2.0.4) nokogiri (~> 1.8, >= 1.8.4) octokit (4.19.0) @@ -610,19 +486,19 @@ GEM nokogiri (~> 1.7) sanitize open4 (1.3.4) - optimist (3.0.1) orm_adapter (0.5.0) os (1.1.1) - ovirt-engine-sdk (4.4.0) - json (>= 1, < 3) - paper_trail (11.0.0) - activerecord (>= 5.2) + paper_trail (10.3.1) + activerecord (>= 4.2) request_store (~> 1.1) + paper_trail-association_tracking (2.1.1) parallel (1.20.1) parser (2.7.2.0) ast (~> 2.4.1) path_expander (1.1.0) pg (0.18.4) + pg (0.18.4-x64-mingw32) + pg (0.18.4-x86-mingw32) phantomjs (2.1.1.0) phony (2.18.18) phony_rails (0.14.13) @@ -638,8 +514,13 @@ GEM pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) + pry (0.13.1-java) + coderay (~> 1.1) + method_source (~> 1.0) + spoon (~> 0.0) public_suffix (4.0.6) puma (3.12.6) + puma (3.12.6-java) pundit (2.1.0) activesupport (>= 3.0.0) rack (2.2.3) @@ -689,14 +570,6 @@ GEM rb-gravatar (1.0.6) rb-inotify (0.10.1) ffi (~> 1.0) - rbovirt (0.1.7) - nokogiri - rest-client (> 1.7.0) - rbvmomi (2.4.1) - builder (~> 3.0) - json (>= 1.8) - nokogiri (~> 1.5) - optimist (~> 3.0) rchardet (1.8.0) react-rails (2.6.1) babel-transpiler (>= 0.7.0) @@ -714,11 +587,6 @@ GEM responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) - rest-client (2.1.0) - http-accept (>= 1.7.0, < 2.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 4.0) - netrc (~> 0.8) retriable (3.1.2) rexml (3.2.4) rinku (2.0.6) @@ -785,6 +653,8 @@ GEM sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) ffi (~> 1.9) + sassc (2.4.0-x64-mingw32) + ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) sassc (>= 2.0) @@ -819,6 +689,8 @@ GEM rack-protection (= 2.1.0) tilt (~> 2.0) sorbet-rails (0.4.0) + spoon (0.0.6) + ffi spreadsheet (1.2.6) ruby-ole (>= 1.0) sprockets (4.0.2) @@ -836,6 +708,7 @@ GEM net-scp (>= 1.1.2) net-ssh (>= 2.8.0) sysrandom (1.0.5) + sysrandom (1.0.5-java) temple (0.8.2) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) @@ -846,6 +719,7 @@ GEM rack (>= 1, < 3) thor (1.0.1) thread_safe (0.3.6) + thread_safe (0.3.6-java) thredded (0.16.4) active_record_union (>= 1.3.0) autoprefixer-rails @@ -875,13 +749,18 @@ GEM ethon (>= 0.9.0) tzinfo (1.2.8) thread_safe (~> 0.1) + tzinfo-data (1.2020.4) + tzinfo (>= 1.0.0) uber (0.1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) ulid (1.2.0) unf (0.1.4) unf_ext + unf (0.1.4-java) unf_ext (0.0.7.7) + unf_ext (0.0.7.7-x64-mingw32) + unf_ext (0.0.7.7-x86-mingw32) unicode-display_width (1.7.0) uniform_notifier (1.13.0) warden (1.2.9) @@ -893,6 +772,8 @@ GEM semantic_range (>= 2.3.0) websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) + websocket-driver (0.7.3-java) + websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) whenever (1.0.0) chronic (>= 0.6.3) @@ -904,17 +785,21 @@ GEM zip-zip x-editable-rails (1.5.5.1) railties - xml-simple (1.1.5) - xmlrpc (0.3.1) xpath (2.1.0) nokogiri (~> 1.3) zip-zip (0.3) rubyzip (>= 1.0.0) PLATFORMS + java ruby + x64-mingw32 + x86-mingw32 + x86-mswin32 DEPENDENCIES + actionpack-action_caching (~> 1.2, >= 1.2.1) + actionpack-page_caching (~> 1.2, >= 1.2.3) active_model_serializers acts_as_paranoid (~> 0.7.0) ancestry (~> 3.2, >= 3.2.1) @@ -956,7 +841,7 @@ DEPENDENCIES factory_girl_rails (~> 4.9) ffaker (~> 2.17) flay (~> 2.12, >= 2.12.1) - fog + fog-aws (~> 3.3) font-awesome-rails (~> 4.7, >= 4.7.0.5) foreman (~> 0.87.2) friendly_id (~> 5.4, >= 5.4.1) @@ -984,7 +869,8 @@ DEPENDENCIES mongoid-rspec (~> 4.0, >= 4.0.1) neat (~> 1.7, >= 1.7.4) omniauth (~> 1.9, >= 1.9.1) - paper_trail (~> 11.0) + paper_trail (~> 10.0, >= 10.0.1) + paper_trail-association_tracking (~> 2.1, >= 2.1.1) pg (~> 0.18.4) phantomjs phony_rails (~> 0.14.13) diff --git a/app/assets/config/__init__.py b/app/assets/config/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000000..b16e53d6d5 --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index f076ae32ba..4bb0d1d769 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,6 +1,6 @@ // FRAMEWORK //= require jquery -//= require jquery_ujs +//= require rails-ujs //= require jquery-ui //= require bootstrap-sprockets //= require jquery.steps.min diff --git a/app/assets/javascripts/clients/index.coffee b/app/assets/javascripts/clients/index.coffee index 89e565f062..ea6424a904 100644 --- a/app/assets/javascripts/clients/index.coffee +++ b/app/assets/javascripts/clients/index.coffee @@ -13,7 +13,7 @@ CIF.ClientsIndex = do -> placement: 'bottom' smartPlacement: true orphan: true - template: "
+ template: "
@@ -530,8 +530,11 @@ CIF.ClientsIndex = do -> _enableSelect2 = -> $('#clients-index select').select2 - minimumInputLength: 0, + minimumInputLength: 0 allowClear: true + dropdownAutoWidth : true, + width: 'auto' + theme: "bootstrap" _formatReportxAxis = -> Highcharts.setOptions global: useUTC: false diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 49e2865a95..1c70260afc 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,92 +1,92 @@ // Framework -@import 'font-awesome'; -@import 'step'; -@import 'thredded'; -@import 'select2'; -@import 'select2-bootstrap'; -@import 'bootstrap-datepicker'; -@import 'dropzone/dropzone'; -@import 'formBuilder/form-builder.min'; -@import 'formBuilder/form-render.min'; +@import "font-awesome"; +@import "step"; +@import "thredded"; +@import "select2"; +@import "select2-bootstrap"; +@import "bootstrap-datepicker"; +@import "dropzone/dropzone"; +@import "formBuilder/form-builder.min"; +@import "formBuilder/form-render.min"; @import "bourbon"; @import "neat"; @import "fullcalendar"; -@import 'animate/animate'; -@import 'iCheck/custom'; -@import 'iCheck/brown'; -@import 'iCheck/red'; -@import 'iCheck/orange'; -@import 'toastr/toastr.min'; -@import 'wrapbootstrap/style'; -@import 'footable/footable.core'; -@import 'bootstrap_file_input/file_input.min'; -@import 'bootstrap_file_input/explorer/theme.min'; +@import "animate/animate"; +@import "iCheck/custom"; +@import "iCheck/brown"; +@import "iCheck/red"; +@import "iCheck/orange"; +@import "toastr/toastr.min"; +@import "wrapbootstrap/style"; +@import "footable/footable.core"; +@import "bootstrap_file_input/file_input.min"; +@import "bootstrap_file_input/explorer/theme.min"; // @import 'query_builder/query-builder.default'; @import "query-builder.default"; -@import 'dataTables/bootstrap/3/jquery.dataTables.bootstrap'; -@import 'dataTables/buttons.dataTables.min'; -@import 'bootstrap-tour/bootstrap-tour.css'; -@import 'ladda/ladda.min'; -@import 'ladda/ladda-themeless.min'; +@import "dataTables/bootstrap/3/jquery.dataTables.bootstrap"; +@import "dataTables/buttons.dataTables.min"; +@import "bootstrap-tour/bootstrap-tour.css"; +@import "ladda/ladda.min"; +@import "ladda/ladda-themeless.min"; @import "editable/bootstrap-editable"; // Components -@import 'case/quarterly_reports/*'; -@import 'sessions/*'; -@import 'cases/*'; -@import 'calendars/*'; -@import 'client/task/*'; -@import 'client/custom_fields/*'; -@import 'family/custom_fields/*'; -@import 'partner/custom_fields/*'; -@import 'user/custom_fields/*'; -@import 'clients/*'; -@import 'client_books/index'; -@import 'families/*'; -@import 'users/*'; -@import 'partners/*'; -@import 'common_index'; -@import 'assessments/*'; -@import 'tasks/*'; -@import 'case_notes/*'; -@import 'agencies/*'; -@import 'referral_sources/*'; -@import 'domain_groups/*'; -@import 'domains/*'; -@import 'provinces/*'; -@import 'departments/*'; -@import 'form'; -@import 'quantitative_types/*'; -@import 'home/*'; -@import 'unsupported_browser'; -@import 'changelogs/*'; -@import 'data_trackers/*'; -@import 'materials/*'; -@import 'locations/*'; -@import 'notifications/*'; -@import 'progress_note_types/*'; -@import 'interventions/*'; -@import 'progress_notes/*'; -@import 'organizations/*'; -@import 'donors/*'; -@import 'client_advanced_searches/*'; -@import 'program_streams/*'; -@import 'top_navbar'; -@import 'common_version'; -@import 'custom_fields/*'; -@import 'custom_field_properties/*'; -@import 'client_enrollments/*'; -@import 'client_enrollment_trackings/*'; -@import 'leave_programs/*'; -@import 'trackings/*'; -@import 'client_program_stream'; -@import 'dashboards/*'; -@import 'organization_types/*'; -@import 'referrals/*'; -@import 'settings/*'; -@import 'government_forms/*'; -@import 'calls/*'; -@import 'referees/index'; +@import "case/quarterly_reports/*"; +@import "sessions/*"; +@import "cases/*"; +@import "calendars/*"; +@import "client/task/*"; +@import "client/custom_fields/*"; +@import "family/custom_fields/*"; +@import "partner/custom_fields/*"; +@import "user/custom_fields/*"; +@import "clients/*"; +@import "client_books/index"; +@import "families/*"; +@import "users/*"; +@import "partners/*"; +@import "common_index"; +@import "assessments/*"; +@import "tasks/*"; +@import "case_notes/*"; +@import "agencies/*"; +@import "referral_sources/*"; +@import "domain_groups/*"; +@import "domains/*"; +@import "provinces/*"; +@import "departments/*"; +@import "form"; +@import "quantitative_types/*"; +@import "home/*"; +@import "unsupported_browser"; +@import "changelogs/*"; +@import "data_trackers/*"; +@import "materials/*"; +@import "locations/*"; +@import "notifications/*"; +@import "progress_note_types/*"; +@import "interventions/*"; +@import "progress_notes/*"; +@import "organizations/*"; +@import "donors/*"; +@import "client_advanced_searches/*"; +@import "program_streams/*"; +@import "top_navbar"; +@import "common_version"; +@import "custom_fields/*"; +@import "custom_field_properties/*"; +@import "client_enrollments/*"; +@import "client_enrollment_trackings/*"; +@import "leave_programs/*"; +@import "trackings/*"; +@import "client_program_stream"; +@import "dashboards/*"; +@import "organization_types/*"; +@import "referrals/*"; +@import "settings/*"; +@import "government_forms/*"; +@import "calls/*"; +@import "referees/index"; // @import 'css-loader.css'; diff --git a/app/assets/stylesheets/clients/index.scss b/app/assets/stylesheets/clients/index.scss index 4f7082bbed..3f12beff13 100644 --- a/app/assets/stylesheets/clients/index.scss +++ b/app/assets/stylesheets/clients/index.scss @@ -1,6 +1,6 @@ -body[id='clients-index'] { - @import 'iCheck/custom'; - @import 'clients/client_grid'; +body[id="clients-index"] { + @import "iCheck/custom"; + @import "clients/client_grid"; .pagination > { .active > form { @@ -46,12 +46,13 @@ body[id='clients-index'] { th.date { min-width: 100px; } - th.action, th.load-query { + th.action, + th.load-query { min-width: 70px; } } - #prevent_load_saved_searches{ + #prevent_load_saved_searches { width: 50%; } @@ -69,11 +70,11 @@ body[id='clients-index'] { margin-top: 15px; } - .highcharts-legend-item path{ + .highcharts-legend-item path { cursor: pointer; } - #client-statistic-body{ + #client-statistic-body { display: none; margin-bottom: 0; } @@ -82,23 +83,23 @@ body[id='clients-index'] { margin-bottom: 16px; } - .datagrid-filter label{ + .datagrid-filter label { vertical-align: top; padding-top: 5px; } .domain-filter { margin: 10px 0; } - #client-search-domain{ + #client-search-domain { margin-bottom: 20px; } - .select2-container.dynamic_filter{ + .select2-container.dynamic_filter { width: 30%; float: left; margin-right: 5px; } - .dynamic_filter.value{ + .dynamic_filter.value { width: 32%; float: left; } @@ -119,7 +120,7 @@ body[id='clients-index'] { margin-top: 4px; } - @media screen and (max-width: 700px){ + @media screen and (max-width: 700px) { .client-option { a { display: inline-block; @@ -151,10 +152,10 @@ body[id='clients-index'] { } .btn-group.group-actions { - button[data-add='rule'] { + button[data-add="rule"] { background-color: #1ab394; border-color: #1ab394; - color: #FFFFFF; + color: #ffffff; } button { margin-right: 5px; @@ -175,7 +176,8 @@ body[id='clients-index'] { .rule-value-container { border-left: none; - select, input { + select, + input { width: 180px; } input.form-control { @@ -188,20 +190,29 @@ body[id='clients-index'] { float: right; } - .basic-filter-error, .custom-form-error { + .basic-filter-error, + .custom-form-error { color: red; display: none; } - .client-column-picker, .custom-form, .program-stream, .selected-custom-form, .program-association, #wizard-referral-data, #wizard-program-stream, #wizard-custom-form { + .client-column-picker, + .custom-form, + .program-stream, + .selected-custom-form, + .program-association, + #wizard-referral-data, + #wizard-program-stream, + #wizard-custom-form { display: none; } - .program-association{ + .program-association { margin-left: 16px; } - th.form-builder, td.form-builder { + th.form-builder, + td.form-builder { min-width: 480px; } @@ -218,14 +229,19 @@ body[id='clients-index'] { cursor: default; } - .csi-header, .referee-header, .carer-header, .type-of-service-header, .hotline-call-header { + .csi-header, + .referee-header, + .carer-header, + .type-of-service-header, + .hotline-call-header { padding: 5px 16px; strong { font-size: 13px; } } - th.domain-scores, td.domain-scores { + th.domain-scores, + td.domain-scores { min-width: 200px; } @@ -266,7 +282,8 @@ body[id='clients-index'] { right: 5px; top: 10px; color: #337ab7; - &:hover, &:focus { + &:hover, + &:focus { color: #23527c; } input[type="submit"] { @@ -281,11 +298,11 @@ body[id='clients-index'] { } } - .popover[class*="tour-"].orphan .arrow{ + .popover[class*="tour-"].orphan .arrow { display: inline-block; } - .tour-tour{ + .tour-tour { left: 0px !important; // top: 420px !important; width: 227px; @@ -295,7 +312,11 @@ body[id='clients-index'] { } .csi-group { - .btn-add-rule, .rule-actions, .drag-handle, .btn-custom-group, .btn-default-group { + .btn-add-rule, + .rule-actions, + .drag-handle, + .btn-custom-group, + .btn-default-group { display: none; } } @@ -324,7 +345,7 @@ body[id='clients-index'] { // max-height: 90%; min-width: 90%; border-radius: 0; - overflow:auto; + overflow: auto; .dataTables_processing { z-index: 999; background: none; @@ -336,7 +357,10 @@ body[id='clients-index'] { width: 100% !important; } - .client-id, .client-name, .assessment-number, .assessment-date { + .client-id, + .client-name, + .assessment-number, + .assessment-date { min-width: 120px; } @@ -354,7 +378,10 @@ body[id='clients-index'] { width: 90%; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body input { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + input { display: inline-block; } @@ -362,7 +389,11 @@ body[id='clients-index'] { padding-left: 15px; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body ul > li { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + ul + > li { list-style: inside; } @@ -411,7 +442,10 @@ body[id='clients-index'] { width: 90%; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body input { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + input { display: inline-block; } @@ -419,7 +453,11 @@ body[id='clients-index'] { padding-left: 15px; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body ul > li { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + ul + > li { list-style: inside; } diff --git a/app/assets/stylesheets/common_index.scss b/app/assets/stylesheets/common_index.scss index ea2b5e4c1b..15ffa92034 100644 --- a/app/assets/stylesheets/common_index.scss +++ b/app/assets/stylesheets/common_index.scss @@ -1,36 +1,40 @@ -.select2-choice{ +@import "wrapbootstrap/base/variables"; +.select2-choice { border: 1px solid #e5e6e7 !important; border-radius: 1px !important; box-shadow: none !important; } .datepicker table tr td.active.active, -.datepicker table tr td.active:hover:hover{ - background-color: #1ab394; - background-image: none; - color: white; +.datepicker table tr td.active:hover:hover { + background-color: #1ab394; + background-image: none; + color: white; } .select2-results .select2-highlighted, -.select2-highlighted:hover{ +.select2-highlighted:hover { background-color: #1ab394; color: white; } -.select2-container .select2-choices .select2-search-field input, .select2-container .select2-choice, .select2-container .select2-choices{ +.select2-container .select2-choices .select2-search-field input, +.select2-container .select2-choice, +.select2-container .select2-choices { border-color: #e5e6e7 !important; box-shadow: none !important; border-radius: 1px !important; } -.select2-drop-active{ +.select2-drop-active { border: 1px solid #1ab394 !important; border-top: none !important; box-shadow: none !important; } -.datepicker.datepicker-dropdown.dropdown-menu{ +.datepicker.datepicker-dropdown.dropdown-menu { z-index: 330000 !important; } -.ibox-title span{ +.ibox-title span { font-size: 12px; } -.select2-container-active .select2-choice, .select2-container-multi.select2-container-active .select2-choices{ +.select2-container-active .select2-choice, +.select2-container-multi.select2-container-active .select2-choices { box-shadow: none !important; border: 1px solid #1ab394 !important; border-radius: 1px !important; @@ -38,12 +42,12 @@ #toast-container > div { width: 400px !important; } -.btn-back-default{ - color: #756E6C !important; +.btn-back-default { + color: #756e6c !important; background: white; - border: 1px solid #E7EAEC; + border: 1px solid #e7eaec; } -.line-border{ +.line-border { border-top: 1px solid #86898c; } .log-min { @@ -57,24 +61,25 @@ border: 10px solid white; width: 100px; } -.btn-back-default:hover{ - color: #756E6C; +.btn-back-default:hover { + color: #756e6c; } -.min-margin-layout{ +.min-margin-layout { margin-top: 16px; } -.boolean.optional{ +.boolean.optional { padding: 0; } -.ibox-title > h5, .panel-heading > h5 { +.ibox-title > h5, +.panel-heading > h5 { font-size: 16px; font-weight: 600; - color: #6B6A6C; + color: #6b6a6c; } -.mini-margin{ - margin-top: 16px; +.mini-margin { + margin-top: 16px; } -.bg{ +.bg { background: white; } @@ -103,18 +108,17 @@ height: 60px; margin-top: -7px; img { - margin:0; + margin: 0; width: 30px; padding: 0; } } - } -.notify-margin{ +.notify-margin { margin-left: 20px; } -.chevron-progess-note{ +.chevron-progess-note { margin-right: -16px; } @@ -136,7 +140,7 @@ } .staging-identifier { - background: #C52F24; + background: #c52f24; .message-staging { color: #fff; margin: 0; @@ -149,13 +153,13 @@ .record-count { margin: 15px 0; } -.custom_column_manage{ +.custom_column_manage { width: 20%; } -.custom_column_name{ +.custom_column_name { width: 40%; } -.custom_column_description{ +.custom_column_description { width: 40%; } diff --git a/app/assets/stylesheets/form.scss b/app/assets/stylesheets/form.scss index 70ed934db8..ad81189512 100644 --- a/app/assets/stylesheets/form.scss +++ b/app/assets/stylesheets/form.scss @@ -22,12 +22,30 @@ } .btn-toastr-confirm { - color: #333333 + color: #333333; } -#toast-container > .toast-warning{ +#toast-container > .toast-warning { &:before { content: "\f071"; } background-image: none !important; } + +#filter_form { + .row { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + flex-wrap: wrap; + } + .row > [class*="col-"] { + display: flex; + flex-direction: column; + } + + select + .select2-container { + width: 100% !important; + } +} diff --git a/app/classes/advanced_searches/families/family_fields.rb b/app/classes/advanced_searches/families/family_fields.rb index 8d94979dcc..f5df240836 100644 --- a/app/classes/advanced_searches/families/family_fields.rb +++ b/app/classes/advanced_searches/families/family_fields.rb @@ -86,7 +86,7 @@ def clients end def case_workers_options - user_ids = Case.joins(:family).where.not(cases: { case_type: 'EC', exited: true }).pluck(:user_id).uniq + user_ids = Case.joins(:family).where.not(cases: { case_type: 'EC', exited: true }).pluck(:user_id).distinct User.where(id: user_ids).order(:first_name, :last_name).map { |user| { user.id.to_s => user.name } } end diff --git a/app/classes/dashboard.rb b/app/classes/dashboard.rb index 949fc70b3d..8215a72695 100644 --- a/app/classes/dashboard.rb +++ b/app/classes/dashboard.rb @@ -46,8 +46,8 @@ def family_type_statistic def program_stream_report_gender active_enrollments = Client.joins(:client_enrollments).where(client_enrollments: { status: 'Active' }) - males = active_enrollments.where(clients: { gender: 'male' } ).uniq - females = active_enrollments.where(clients: { gender: 'female' } ).uniq + males = active_enrollments.where(clients: { gender: 'male' } ).distinct + females = active_enrollments.where(clients: { gender: 'female' } ).distinct [ { name: I18n.t('classes.dashboard.males'), diff --git a/app/classes/domain_cache_directory.rb b/app/classes/domain_cache_directory.rb index 7ac35e58a4..17ed80f306 100644 --- a/app/classes/domain_cache_directory.rb +++ b/app/classes/domain_cache_directory.rb @@ -1,5 +1,5 @@ class DomainCacheDirectory def self.call(request) - Rails.root.join("public", request.domain) + Rails.root.join("public", request.base_url.gsub(/http(s)?\:\/\//, '')) end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4c7780d609..eea8ae40d5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -37,7 +37,7 @@ def current_setting end def field_settings - @field_settings ||= FieldSetting.where('for_instances IS NULL OR for_instances iLIKE ?', "#{current_organization.short_name}") + @field_settings ||= FieldSetting.where('for_instances IS NULL OR for_instances iLIKE ?', current_organization.short_name.to_s) end def pundit_user @@ -47,22 +47,9 @@ def pundit_user private def configure_permitted_parameters - devise_parameter_sanitizer.for(:account_update) << :first_name - devise_parameter_sanitizer.for(:account_update) << :last_name - devise_parameter_sanitizer.for(:account_update) << :date_of_birth - devise_parameter_sanitizer.for(:account_update) << :job_title - devise_parameter_sanitizer.for(:account_update) << :department_id - devise_parameter_sanitizer.for(:account_update) << :start_date - devise_parameter_sanitizer.for(:account_update) << :province_id - devise_parameter_sanitizer.for(:account_update) << :mobile - devise_parameter_sanitizer.for(:account_update) << :task_notify - devise_parameter_sanitizer.for(:account_update) << :calendar_integration - devise_parameter_sanitizer.for(:account_update) << :pin_code - devise_parameter_sanitizer.for(:account_update) << :program_warning - devise_parameter_sanitizer.for(:account_update) << :domain_warning - devise_parameter_sanitizer.for(:account_update) << :gender - devise_parameter_sanitizer.for(:account_update) << :preferred_language - devise_parameter_sanitizer.for(:account_update) << :referral_notification + devise_parameter_sanitizer.permit(:account_update) do |user_params| + user_params.permit(:first_name, :last_name, :date_of_birth, :job_title, :department_id, :start_date, :province_id, :mobile, :task_notify, :calendar_integration, :pin_code, :program_warning, :domain_warning, :gender, :preferred_language, :referral_notification) + end end def find_association diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb index 3608551db5..2ec97423ce 100644 --- a/app/controllers/clients_controller.rb +++ b/app/controllers/clients_controller.rb @@ -4,8 +4,9 @@ class ClientsController < AdminController include ClientAdvancedSearchesConcern include ClientGridOptions - caches_action :index - before_action :assign_active_client_prams, only: :index + # self.page_cache_directory = DomainCacheDirectory + # before_action :assign_active_client_prams, only: :index + before_action :format_search_params, only: [:index] before_action :get_quantitative_fields, :get_hotline_fields, :hotline_call_column, only: [:index] before_action :find_params_advanced_search, :get_custom_form, :get_program_streams, only: [:index] @@ -21,6 +22,7 @@ class ClientsController < AdminController before_action :quantitative_type_editable, only: [:edit, :update, :new, :create] before_action :quantitative_type_readable before_action :validate_referral, only: [:new, :edit] + caches_action :index def index @client_default_columns = Setting.first.try(:client_default_columns) diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index d63fdc0e08..0d8123692c 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -1,6 +1,7 @@ class DashboardsController < AdminController before_action :task_of_user, :find_overhaul_task_params, :find_tasks, only: [:index] - caches_page :index + # self.page_cache_directory = DomainCacheDirectory + # caches_page :index def index @setting = Setting.first diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ee6a04ac09..6979896496 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -42,7 +42,7 @@ def human_boolean(boolean) end def current_url(new_params) - url_for params: params.merge(new_params) + url_for params: request.parameters.merge(new_params) end def remove_link(object, associated_objects = {}, btn_size = 'btn-xs') diff --git a/app/helpers/subdomain_helper.rb b/app/helpers/subdomain_helper.rb index 469cad79c5..b6b84ab274 100644 --- a/app/helpers/subdomain_helper.rb +++ b/app/helpers/subdomain_helper.rb @@ -6,10 +6,11 @@ def with_subdomain(subdomain) [subdomain, host].join end - def url_for(options = nil) + def url_for(options = {}, *params) if options.is_a?(Hash) && options.key?(:subdomain) options[:host] = with_subdomain(options.delete(:subdomain)) end - super + # options = request.parameters + super(options, *params) end end diff --git a/app/jobs/__init__.py b/app/jobs/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 0000000000..a009ace51c --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/app/models/action_result.rb b/app/models/action_result.rb index cc457e3a65..e6b8d2edfc 100644 --- a/app/models/action_result.rb +++ b/app/models/action_result.rb @@ -1,4 +1,4 @@ -class ActionResult < ActiveRecord::Base +class ActionResult < ApplicationRecord has_paper_trail diff --git a/app/models/admin_user.rb b/app/models/admin_user.rb index bada0c9204..1b9191df5c 100644 --- a/app/models/admin_user.rb +++ b/app/models/admin_user.rb @@ -1,4 +1,4 @@ -class AdminUser < ActiveRecord::Base +class AdminUser < ApplicationRecord devise :database_authenticatable, :recoverable, :rememberable, :validatable diff --git a/app/models/advanced_search.rb b/app/models/advanced_search.rb index e0af8c34cc..a2d19c2378 100644 --- a/app/models/advanced_search.rb +++ b/app/models/advanced_search.rb @@ -1,4 +1,4 @@ -class AdvancedSearch < ActiveRecord::Base +class AdvancedSearch < ApplicationRecord has_paper_trail belongs_to :user diff --git a/app/models/agency.rb b/app/models/agency.rb index 58c7ca64fb..db11d30217 100644 --- a/app/models/agency.rb +++ b/app/models/agency.rb @@ -1,4 +1,4 @@ -class Agency < ActiveRecord::Base +class Agency < ApplicationRecord has_many :agency_clients has_many :clients, through: :agency_clients has_paper_trail diff --git a/app/models/agency_client.rb b/app/models/agency_client.rb index a8931f9e0b..43d3097572 100644 --- a/app/models/agency_client.rb +++ b/app/models/agency_client.rb @@ -1,4 +1,4 @@ -class AgencyClient < ActiveRecord::Base +class AgencyClient < ApplicationRecord belongs_to :agency belongs_to :client diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 0000000000..10a4cba84d --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/assessment.rb b/app/models/assessment.rb index ad11ed3f30..cbfa194389 100644 --- a/app/models/assessment.rb +++ b/app/models/assessment.rb @@ -1,4 +1,4 @@ -class Assessment < ActiveRecord::Base +class Assessment < ApplicationRecord belongs_to :client, counter_cache: true has_many :assessment_domains, dependent: :destroy diff --git a/app/models/assessment_domain.rb b/app/models/assessment_domain.rb index bf36a3ba17..4114f75795 100644 --- a/app/models/assessment_domain.rb +++ b/app/models/assessment_domain.rb @@ -1,4 +1,4 @@ -class AssessmentDomain < ActiveRecord::Base +class AssessmentDomain < ApplicationRecord mount_uploaders :attachments, FileUploader SCORE_COLORS = { diff --git a/app/models/attachment.rb b/app/models/attachment.rb index c42617da91..d9810306ff 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -1,4 +1,4 @@ -class Attachment < ActiveRecord::Base +class Attachment < ApplicationRecord mount_uploader :image, ImageUploader mount_uploader :file, FileUploader diff --git a/app/models/calendar.rb b/app/models/calendar.rb index 9ae7fe7d7e..292dc8a439 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -1,4 +1,4 @@ -class Calendar < ActiveRecord::Base +class Calendar < ApplicationRecord belongs_to :user scope :sync_status_false, -> { where(sync_status: false) } diff --git a/app/models/call.rb b/app/models/call.rb index b636559b43..c3cfc21e9f 100644 --- a/app/models/call.rb +++ b/app/models/call.rb @@ -1,4 +1,4 @@ -class Call < ActiveRecord::Base +class Call < ApplicationRecord FIELDS = %w( phone_call_id call_type date_of_call start_datetime information_provided answered_call called_before requested_update childsafe_agent protection_concern_id necessity_id not_a_phone_call brief_note_summary other_more_information) TYPES = [ "New Referral: Case Action Required", "New Referral: Case Action NOT Required", diff --git a/app/models/call_necessity.rb b/app/models/call_necessity.rb index 20fdc682b7..ee5e5e61f4 100644 --- a/app/models/call_necessity.rb +++ b/app/models/call_necessity.rb @@ -1,4 +1,4 @@ -class CallNecessity < ActiveRecord::Base +class CallNecessity < ApplicationRecord belongs_to :call belongs_to :necessity end diff --git a/app/models/call_protection_concern.rb b/app/models/call_protection_concern.rb index d00d240fe8..47a780f615 100644 --- a/app/models/call_protection_concern.rb +++ b/app/models/call_protection_concern.rb @@ -1,4 +1,4 @@ -class CallProtectionConcern < ActiveRecord::Base +class CallProtectionConcern < ApplicationRecord belongs_to :call belongs_to :protection_concern end diff --git a/app/models/carer.rb b/app/models/carer.rb index 1bfb1c186a..e355fb6352 100644 --- a/app/models/carer.rb +++ b/app/models/carer.rb @@ -1,4 +1,4 @@ -class Carer < ActiveRecord::Base +class Carer < ApplicationRecord belongs_to :province belongs_to :district belongs_to :commune diff --git a/app/models/case.rb b/app/models/case.rb index a0a9c0448c..7f93be90b1 100644 --- a/app/models/case.rb +++ b/app/models/case.rb @@ -1,4 +1,4 @@ -class Case < ActiveRecord::Base +class Case < ApplicationRecord belongs_to :family, counter_cache: true belongs_to :client belongs_to :partner, counter_cache: true diff --git a/app/models/case_closure.rb b/app/models/case_closure.rb index c921bbe528..70718cf2a2 100644 --- a/app/models/case_closure.rb +++ b/app/models/case_closure.rb @@ -1,4 +1,4 @@ -class CaseClosure < ActiveRecord::Base +class CaseClosure < ApplicationRecord has_paper_trail has_many :government_forms diff --git a/app/models/case_contract.rb b/app/models/case_contract.rb index e1869ebc1f..938313471c 100644 --- a/app/models/case_contract.rb +++ b/app/models/case_contract.rb @@ -1,3 +1,3 @@ -class CaseContract < ActiveRecord::Base +class CaseContract < ApplicationRecord belongs_to :case end diff --git a/app/models/case_note.rb b/app/models/case_note.rb index c52e370147..7cc86d2388 100644 --- a/app/models/case_note.rb +++ b/app/models/case_note.rb @@ -1,4 +1,4 @@ -class CaseNote < ActiveRecord::Base +class CaseNote < ApplicationRecord INTERACTION_TYPE = ['Visit', 'Non face to face', '3rd Party','Supervision','Other'].freeze paginates_per 1 diff --git a/app/models/case_note_domain_group.rb b/app/models/case_note_domain_group.rb index d07a785791..2850ca5069 100644 --- a/app/models/case_note_domain_group.rb +++ b/app/models/case_note_domain_group.rb @@ -1,4 +1,4 @@ -class CaseNoteDomainGroup < ActiveRecord::Base +class CaseNoteDomainGroup < ApplicationRecord mount_uploaders :attachments, FileUploader belongs_to :case_note belongs_to :domain_group diff --git a/app/models/case_worker_client.rb b/app/models/case_worker_client.rb index 92a273da09..7b11f85074 100644 --- a/app/models/case_worker_client.rb +++ b/app/models/case_worker_client.rb @@ -1,4 +1,4 @@ -class CaseWorkerClient < ActiveRecord::Base +class CaseWorkerClient < ApplicationRecord has_paper_trail belongs_to :user diff --git a/app/models/changelog.rb b/app/models/changelog.rb index 93d4026b5e..c08b96d50f 100644 --- a/app/models/changelog.rb +++ b/app/models/changelog.rb @@ -1,4 +1,4 @@ -class Changelog < ActiveRecord::Base +class Changelog < ApplicationRecord belongs_to :user, counter_cache: true has_many :changelog_types, dependent: :destroy diff --git a/app/models/changelog_type.rb b/app/models/changelog_type.rb index b954c512e9..e9f14952eb 100644 --- a/app/models/changelog_type.rb +++ b/app/models/changelog_type.rb @@ -1,4 +1,4 @@ -class ChangelogType < ActiveRecord::Base +class ChangelogType < ApplicationRecord belongs_to :changelog default_scope { order(:change_type) } diff --git a/app/models/children_plan.rb b/app/models/children_plan.rb index 3a940613f0..92b1fdaaec 100644 --- a/app/models/children_plan.rb +++ b/app/models/children_plan.rb @@ -1,4 +1,4 @@ -class ChildrenPlan < ActiveRecord::Base +class ChildrenPlan < ApplicationRecord has_paper_trail has_many :government_form_children_plans, dependent: :restrict_with_error diff --git a/app/models/client.rb b/app/models/client.rb index 85ee6d7a2c..e1788ea7b5 100644 --- a/app/models/client.rb +++ b/app/models/client.rb @@ -1,4 +1,4 @@ -class Client < ActiveRecord::Base +class Client < ApplicationRecord include ActionView::Helpers::DateHelper include EntityTypeCustomField include NextClientEnrollmentTracking @@ -82,14 +82,14 @@ class Client < ActiveRecord::Base accepts_nested_attributes_for :tasks - has_many :families, through: :cases has_many :cases, dependent: :destroy + has_many :families, through: :cases has_many :case_notes, dependent: :destroy has_many :assessments, dependent: :destroy has_paper_trail - validates :kid_id, uniqueness: { case_sensitive: false }, if: 'kid_id.present?' + validates :kid_id, uniqueness: { case_sensitive: false }, if: -> { kid_id.present? } validates :user_ids, presence: true, on: :create validates :user_ids, presence: true, on: :update, unless: :exit_ngo? validates :initial_referral_date, :received_by_id, :gender, :referral_source_category_id, presence: true diff --git a/app/models/client_enrollment.rb b/app/models/client_enrollment.rb index 6e0029c7d1..46a2aae842 100644 --- a/app/models/client_enrollment.rb +++ b/app/models/client_enrollment.rb @@ -1,4 +1,4 @@ -class ClientEnrollment < ActiveRecord::Base +class ClientEnrollment < ApplicationRecord include ClientRetouch include NestedAttributesConcern include ClientEnrollmentTrackingConcern @@ -15,7 +15,7 @@ class ClientEnrollment < ActiveRecord::Base alias_attribute :new_date, :enrollment_date validates :enrollment_date, presence: true - validate :enrollment_date_value, if: 'enrollment_date.present?' + validate :enrollment_date_value, if: -> { enrollment_date.present? } has_paper_trail diff --git a/app/models/client_enrollment_tracking.rb b/app/models/client_enrollment_tracking.rb index e40d358eab..ef7fe18bb6 100644 --- a/app/models/client_enrollment_tracking.rb +++ b/app/models/client_enrollment_tracking.rb @@ -1,4 +1,4 @@ -class ClientEnrollmentTracking < ActiveRecord::Base +class ClientEnrollmentTracking < ApplicationRecord include NestedAttributesConcern include ClientEnrollmentTrackingConcern diff --git a/app/models/client_history.rb b/app/models/client_history.rb index 735debadd3..bdab334eba 100644 --- a/app/models/client_history.rb +++ b/app/models/client_history.rb @@ -2,11 +2,11 @@ class ClientHistory include Mongoid::Document include Mongoid::Timestamps - store_in database: ->{ Organization.current.mho? ? ENV['MHO_HISTORY_DATABASE_NAME'] : ENV['HISTORY_DATABASE_NAME'] } + store_in database: -> { Organization.current.mho? ? ENV['MHO_HISTORY_DATABASE_NAME'] : ENV['HISTORY_DATABASE_NAME'] } default_scope { where(tenant: Organization.current.try(:short_name)) } field :object, type: Hash - field :tenant, type: String, default: ->{ Organization.current.short_name } + field :tenant, type: String, default: -> { Organization.current.short_name } embeds_many :agency_client_histories embeds_many :sponsor_histories @@ -16,13 +16,13 @@ class ClientHistory embeds_many :client_family_histories embeds_many :client_quantitative_case_histories - after_save :create_sponsor_history, if: 'object.key?("donor_ids")' - after_save :create_agency_client_history, if: 'object.key?("agency_ids")' - after_save :create_case_worker_client_history, if: 'object.key?("user_ids")' - after_save :create_client_quantitative_case_history, if: 'object.key?("quantitative_case_ids")' - after_save :create_case_client_history, if: 'object.key?("case_ids")' - after_save :create_client_family_history, if: 'object.key?("family_ids")' - after_save :create_client_custom_field_property_history, if: 'object.key?("custom_field_property_ids")' + after_save :create_sponsor_history, if: -> { object.key?('donor_ids') } + after_save :create_agency_client_history, if: -> { object.key?('agency_ids') } + after_save :create_case_worker_client_history, if: -> { object.key?('user_ids') } + after_save :create_client_quantitative_case_history, if: -> { object.key?('quantitative_case_ids') } + after_save :create_case_client_history, if: -> { object.key?('case_ids') } + after_save :create_client_family_history, if: -> { object.key?('family_ids') } + after_save :create_client_custom_field_property_history, if: -> { object.key?('custom_field_property_ids') } def self.initial(client) attributes = client.attributes diff --git a/app/models/client_quantitative_case.rb b/app/models/client_quantitative_case.rb index 6289981316..3ee605783f 100644 --- a/app/models/client_quantitative_case.rb +++ b/app/models/client_quantitative_case.rb @@ -1,4 +1,4 @@ -class ClientQuantitativeCase < ActiveRecord::Base +class ClientQuantitativeCase < ApplicationRecord belongs_to :client belongs_to :quantitative_case diff --git a/app/models/client_right.rb b/app/models/client_right.rb index 4a0a7781fb..3967ac0e4c 100644 --- a/app/models/client_right.rb +++ b/app/models/client_right.rb @@ -1,4 +1,4 @@ -class ClientRight < ActiveRecord::Base +class ClientRight < ApplicationRecord has_paper_trail has_many :client_right_government_forms, dependent: :restrict_with_error diff --git a/app/models/client_right_government_form.rb b/app/models/client_right_government_form.rb index 58c73e0694..8b083bfdaf 100644 --- a/app/models/client_right_government_form.rb +++ b/app/models/client_right_government_form.rb @@ -1,4 +1,4 @@ -class ClientRightGovernmentForm < ActiveRecord::Base +class ClientRightGovernmentForm < ApplicationRecord has_paper_trail delegate :name, to: :client_right, prefix: true, allow_nil: true diff --git a/app/models/client_type.rb b/app/models/client_type.rb index f8c713b423..dcf02edea2 100644 --- a/app/models/client_type.rb +++ b/app/models/client_type.rb @@ -1,4 +1,4 @@ -class ClientType < ActiveRecord::Base +class ClientType < ApplicationRecord has_paper_trail has_many :client_type_government_forms, dependent: :restrict_with_error diff --git a/app/models/client_type_government_form.rb b/app/models/client_type_government_form.rb index ea0d787864..e7112bc313 100644 --- a/app/models/client_type_government_form.rb +++ b/app/models/client_type_government_form.rb @@ -1,4 +1,4 @@ -class ClientTypeGovernmentForm < ActiveRecord::Base +class ClientTypeGovernmentForm < ApplicationRecord has_paper_trail belongs_to :government_form diff --git a/app/models/commune.rb b/app/models/commune.rb index 6a011c7710..e29028c57d 100644 --- a/app/models/commune.rb +++ b/app/models/commune.rb @@ -1,4 +1,4 @@ -class Commune < ActiveRecord::Base +class Commune < ApplicationRecord attr_accessor :name has_paper_trail diff --git a/app/models/custom_assessment_setting.rb b/app/models/custom_assessment_setting.rb index aeeb36d80c..b253cc96c2 100644 --- a/app/models/custom_assessment_setting.rb +++ b/app/models/custom_assessment_setting.rb @@ -1,4 +1,4 @@ -class CustomAssessmentSetting < ActiveRecord::Base +class CustomAssessmentSetting < ApplicationRecord belongs_to :setting has_many :domains, dependent: :destroy has_many :case_notes, dependent: :restrict_with_error diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 7fa288ac29..65d73ddd91 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -1,4 +1,4 @@ -class CustomField < ActiveRecord::Base +class CustomField < ApplicationRecord include UpdateFieldLabelsFormBuilder FREQUENCIES = ['Daily', 'Weekly', 'Monthly', 'Yearly'].freeze diff --git a/app/models/custom_field_permission.rb b/app/models/custom_field_permission.rb index eaee1c9bd1..bbc669bbb6 100644 --- a/app/models/custom_field_permission.rb +++ b/app/models/custom_field_permission.rb @@ -1,4 +1,4 @@ -class CustomFieldPermission < ActiveRecord::Base +class CustomFieldPermission < ApplicationRecord belongs_to :user_permission, class_name: 'User', foreign_key: :user_id belongs_to :user_custom_field_permission, class_name: 'CustomField', foreign_key: :custom_field_id diff --git a/app/models/custom_field_property.rb b/app/models/custom_field_property.rb index 19deaf67e2..d12c8bec96 100644 --- a/app/models/custom_field_property.rb +++ b/app/models/custom_field_property.rb @@ -1,4 +1,4 @@ -class CustomFieldProperty < ActiveRecord::Base +class CustomFieldProperty < ApplicationRecord include NestedAttributesConcern include ClientEnrollmentTrackingConcern diff --git a/app/models/data_tracker.rb b/app/models/data_tracker.rb index 2ec8464ad3..0081d97763 100644 --- a/app/models/data_tracker.rb +++ b/app/models/data_tracker.rb @@ -1,3 +1,3 @@ -class DataTracker < ActiveRecord::Base +class DataTracker < ApplicationRecord # intentionally left blank end diff --git a/app/models/department.rb b/app/models/department.rb index d56513a1e3..5c270531e1 100644 --- a/app/models/department.rb +++ b/app/models/department.rb @@ -1,4 +1,4 @@ -class Department < ActiveRecord::Base +class Department < ApplicationRecord has_many :users has_paper_trail diff --git a/app/models/district.rb b/app/models/district.rb index e993d52f48..c9c5020eaf 100644 --- a/app/models/district.rb +++ b/app/models/district.rb @@ -1,4 +1,4 @@ -class District < ActiveRecord::Base +class District < ApplicationRecord include AddressConcern has_paper_trail diff --git a/app/models/domain.rb b/app/models/domain.rb index 089b1d282e..f0ceb57c5d 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -1,4 +1,4 @@ -class Domain < ActiveRecord::Base +class Domain < ApplicationRecord belongs_to :domain_group, counter_cache: true has_many :assessment_domains, dependent: :restrict_with_error @@ -26,7 +26,7 @@ class Domain < ActiveRecord::Base enum domain_score_colors: { danger: 'Red', warning: 'Yellow', success: 'Blue', primary: 'Green' } def convert_identity - identity.downcase.parameterize('_') + identity.downcase.parameterize(separator: '_') end def translate_description diff --git a/app/models/domain_group.rb b/app/models/domain_group.rb index 7f8f79391a..c24a74f56f 100644 --- a/app/models/domain_group.rb +++ b/app/models/domain_group.rb @@ -1,4 +1,4 @@ -class DomainGroup < ActiveRecord::Base +class DomainGroup < ApplicationRecord include ActionView::Helpers has_many :domains diff --git a/app/models/domain_program_stream.rb b/app/models/domain_program_stream.rb index 56596c3d71..0f5e821ef7 100644 --- a/app/models/domain_program_stream.rb +++ b/app/models/domain_program_stream.rb @@ -1,4 +1,4 @@ -class DomainProgramStream < ActiveRecord::Base +class DomainProgramStream < ApplicationRecord acts_as_paranoid belongs_to :program_stream diff --git a/app/models/donor.rb b/app/models/donor.rb index a97e30de50..2bfa10c62b 100644 --- a/app/models/donor.rb +++ b/app/models/donor.rb @@ -1,4 +1,4 @@ -class Donor < ActiveRecord::Base +class Donor < ApplicationRecord has_many :sponsors, dependent: :restrict_with_error has_many :clients, through: :sponsors has_many :donor_organizations, dependent: :destroy @@ -9,7 +9,7 @@ class Donor < ActiveRecord::Base scope :has_clients, -> { joins(:clients).uniq } - validates :name, presence: true, uniqueness: { case_sensitive: false }, if: 'code.blank?' - validates :name, presence: true, uniqueness: { case_sensitive: false, scope: :code }, if: 'code.present?' - validates :code, uniqueness: { case_sensitive: false }, if: 'code.present?' + validates :name, presence: true, uniqueness: { case_sensitive: false }, if: -> { code.blank? } + validates :name, presence: true, uniqueness: { case_sensitive: false, scope: :code }, if: -> { code.present? } + validates :code, uniqueness: { case_sensitive: false }, if: -> { code.present? } end diff --git a/app/models/donor_organization.rb b/app/models/donor_organization.rb index a660a33156..08d4d00602 100644 --- a/app/models/donor_organization.rb +++ b/app/models/donor_organization.rb @@ -1,4 +1,4 @@ -class DonorOrganization < ActiveRecord::Base +class DonorOrganization < ApplicationRecord belongs_to :donor belongs_to :organization end diff --git a/app/models/enter_ngo.rb b/app/models/enter_ngo.rb index 252a60af4b..4fbe25bcef 100644 --- a/app/models/enter_ngo.rb +++ b/app/models/enter_ngo.rb @@ -1,4 +1,4 @@ -class EnterNgo < ActiveRecord::Base +class EnterNgo < ApplicationRecord has_paper_trail acts_as_paranoid double_tap_destroys_fully: true diff --git a/app/models/enter_ngo_history.rb b/app/models/enter_ngo_history.rb index 86557518ae..6aa004dea4 100644 --- a/app/models/enter_ngo_history.rb +++ b/app/models/enter_ngo_history.rb @@ -10,7 +10,7 @@ class EnterNgoHistory embeds_many :enter_ngo_user_histories - after_save :create_enter_ngo_user_history, if: 'object.key?("user_ids")' + after_save :create_enter_ngo_user_history, if: -> { object.key?('user_ids') } def self.initial(enter_ngo) attributes = enter_ngo.attributes diff --git a/app/models/enter_ngo_user.rb b/app/models/enter_ngo_user.rb index 5bce0bf933..faaf99bfcc 100644 --- a/app/models/enter_ngo_user.rb +++ b/app/models/enter_ngo_user.rb @@ -1,4 +1,4 @@ -class EnterNgoUser < ActiveRecord::Base +class EnterNgoUser < ApplicationRecord belongs_to :enter_ngo belongs_to :user diff --git a/app/models/exit_ngo.rb b/app/models/exit_ngo.rb index 13204208a4..b8af57afca 100644 --- a/app/models/exit_ngo.rb +++ b/app/models/exit_ngo.rb @@ -1,4 +1,4 @@ -class ExitNgo < ActiveRecord::Base +class ExitNgo < ApplicationRecord has_paper_trail acts_as_paranoid double_tap_destroys_fully: true diff --git a/app/models/external_system.rb b/app/models/external_system.rb index 71f429dd4b..0062fa5044 100644 --- a/app/models/external_system.rb +++ b/app/models/external_system.rb @@ -1,4 +1,4 @@ -class ExternalSystem < ActiveRecord::Base +class ExternalSystem < ApplicationRecord has_many :external_system_global_identities, class_name: 'ExternalSystemGlobalIdentity', foreign_key: 'global_id', dependent: :destroy validates :name, :token, presence: true diff --git a/app/models/external_system_global_identity.rb b/app/models/external_system_global_identity.rb index a0848e4323..10df131af4 100644 --- a/app/models/external_system_global_identity.rb +++ b/app/models/external_system_global_identity.rb @@ -1,4 +1,4 @@ -class ExternalSystemGlobalIdentity < ActiveRecord::Base +class ExternalSystemGlobalIdentity < ApplicationRecord belongs_to :external_system belongs_to :global_identity, class_name: 'GlobalIdentity', foreign_key: 'global_id', primary_key: :ulid diff --git a/app/models/family.rb b/app/models/family.rb index 2998e4ac0c..4d8de1a037 100644 --- a/app/models/family.rb +++ b/app/models/family.rb @@ -1,4 +1,4 @@ -class Family < ActiveRecord::Base +class Family < ApplicationRecord include EntityTypeCustomField include Brc::Family @@ -32,7 +32,7 @@ class Family < ActiveRecord::Base before_validation :assign_family_type, if: [:new_record?, :brc?] validates :family_type, presence: true, inclusion: { in: TYPES } - validates :code, uniqueness: { case_sensitive: false }, if: 'code.present?' + validates :code, uniqueness: { case_sensitive: false }, if: -> { code.present? } validates :status, presence: true, inclusion: { in: STATUSES } validate :client_must_only_belong_to_a_family diff --git a/app/models/family_member.rb b/app/models/family_member.rb index f60e44047d..415ce2ef73 100644 --- a/app/models/family_member.rb +++ b/app/models/family_member.rb @@ -1,4 +1,4 @@ -class FamilyMember < ActiveRecord::Base +class FamilyMember < ApplicationRecord extend Enumerize belongs_to :family diff --git a/app/models/family_plan.rb b/app/models/family_plan.rb index acd26e639e..9605b724ab 100644 --- a/app/models/family_plan.rb +++ b/app/models/family_plan.rb @@ -1,4 +1,4 @@ -class FamilyPlan < ActiveRecord::Base +class FamilyPlan < ApplicationRecord has_paper_trail has_many :government_form_family_plans, dependent: :restrict_with_error diff --git a/app/models/field_setting.rb b/app/models/field_setting.rb index e2a63b5ff0..5e7a4e21c5 100644 --- a/app/models/field_setting.rb +++ b/app/models/field_setting.rb @@ -1,4 +1,4 @@ -class FieldSetting < ActiveRecord::Base +class FieldSetting < ApplicationRecord self.inheritance_column = :_type_disabled translates :label diff --git a/app/models/form_builder_attachment.rb b/app/models/form_builder_attachment.rb index 0a6d7154c6..14f57674a3 100644 --- a/app/models/form_builder_attachment.rb +++ b/app/models/form_builder_attachment.rb @@ -1,4 +1,4 @@ -class FormBuilderAttachment < ActiveRecord::Base +class FormBuilderAttachment < ApplicationRecord mount_uploaders :file, FormBuilderAttachmentUploader belongs_to :form_buildable, polymorphic: true diff --git a/app/models/global_identity.rb b/app/models/global_identity.rb index 3fccc9716f..681c253ec8 100644 --- a/app/models/global_identity.rb +++ b/app/models/global_identity.rb @@ -1,4 +1,4 @@ -class GlobalIdentity < ActiveRecord::Base +class GlobalIdentity < ApplicationRecord self.primary_key = "ulid" has_many :clients, class_name: 'Client', foreign_key: 'global_id', dependent: :restrict_with_error has_many :organizations, through: :global_identity_organizations diff --git a/app/models/global_identity_organization.rb b/app/models/global_identity_organization.rb index 9e31554cc1..824d998866 100644 --- a/app/models/global_identity_organization.rb +++ b/app/models/global_identity_organization.rb @@ -1,4 +1,4 @@ -class GlobalIdentityOrganization < ActiveRecord::Base +class GlobalIdentityOrganization < ApplicationRecord belongs_to :organization belongs_to :global_identity, class_name: 'GlobalIdentity', foreign_key: 'global_id', primary_key: :ulid belongs_to :client diff --git a/app/models/global_service.rb b/app/models/global_service.rb index 7cade8a09f..d99ba27c14 100644 --- a/app/models/global_service.rb +++ b/app/models/global_service.rb @@ -1,4 +1,4 @@ -class GlobalService < ActiveRecord::Base +class GlobalService < ApplicationRecord self.primary_key = "uuid" has_many :services, class_name: 'Service', foreign_key: 'uuid', dependent: :restrict_with_error diff --git a/app/models/government_form.rb b/app/models/government_form.rb index b22cdb853f..761922032e 100644 --- a/app/models/government_form.rb +++ b/app/models/government_form.rb @@ -1,4 +1,4 @@ -class GovernmentForm < ActiveRecord::Base +class GovernmentForm < ApplicationRecord has_paper_trail CASEWORKER_ASSUMPTIONS = ['អាចធ្វើសមាហរណកម្មបាន', 'មិនអាចធ្វើសមាហរណកម្មបានទេ', 'បន្តករណី', 'បិទករណី'] diff --git a/app/models/government_form_children_plan.rb b/app/models/government_form_children_plan.rb index 090ffbd257..8321b3acb0 100644 --- a/app/models/government_form_children_plan.rb +++ b/app/models/government_form_children_plan.rb @@ -1,4 +1,4 @@ -class GovernmentFormChildrenPlan < ActiveRecord::Base +class GovernmentFormChildrenPlan < ApplicationRecord has_paper_trail delegate :name, to: :children_plan, prefix: true, allow_nil: true diff --git a/app/models/government_form_family_plan.rb b/app/models/government_form_family_plan.rb index b5c5f3dc16..71eb889142 100644 --- a/app/models/government_form_family_plan.rb +++ b/app/models/government_form_family_plan.rb @@ -1,4 +1,4 @@ -class GovernmentFormFamilyPlan < ActiveRecord::Base +class GovernmentFormFamilyPlan < ApplicationRecord has_paper_trail delegate :name, to: :family_plan, prefix: true, allow_nil: true diff --git a/app/models/government_form_interviewee.rb b/app/models/government_form_interviewee.rb index 5a5eab91a0..1d23e99345 100644 --- a/app/models/government_form_interviewee.rb +++ b/app/models/government_form_interviewee.rb @@ -1,4 +1,4 @@ -class GovernmentFormInterviewee < ActiveRecord::Base +class GovernmentFormInterviewee < ApplicationRecord has_paper_trail belongs_to :government_form diff --git a/app/models/government_form_need.rb b/app/models/government_form_need.rb index e8e584ebab..01131eb216 100644 --- a/app/models/government_form_need.rb +++ b/app/models/government_form_need.rb @@ -1,4 +1,4 @@ -class GovernmentFormNeed < ActiveRecord::Base +class GovernmentFormNeed < ApplicationRecord has_paper_trail RANKS = [1, 2, 3, 4, 5, 6, 7, 8] diff --git a/app/models/government_form_problem.rb b/app/models/government_form_problem.rb index 69a202b1e2..588f354867 100644 --- a/app/models/government_form_problem.rb +++ b/app/models/government_form_problem.rb @@ -1,4 +1,4 @@ -class GovernmentFormProblem < ActiveRecord::Base +class GovernmentFormProblem < ApplicationRecord has_paper_trail RANKS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] diff --git a/app/models/government_form_service_type.rb b/app/models/government_form_service_type.rb index c67bf4f019..8f5ae75425 100644 --- a/app/models/government_form_service_type.rb +++ b/app/models/government_form_service_type.rb @@ -1,4 +1,4 @@ -class GovernmentFormServiceType < ActiveRecord::Base +class GovernmentFormServiceType < ApplicationRecord has_paper_trail delegate :name, to: :service_type, prefix: true, allow_nil: true diff --git a/app/models/hotline.rb b/app/models/hotline.rb index af0ec1c15d..0c74bfb049 100644 --- a/app/models/hotline.rb +++ b/app/models/hotline.rb @@ -1,4 +1,4 @@ -class Hotline < ActiveRecord::Base +class Hotline < ApplicationRecord belongs_to :call belongs_to :client -end \ No newline at end of file +end diff --git a/app/models/intervention.rb b/app/models/intervention.rb index db7c70055a..1d3edb55fc 100644 --- a/app/models/intervention.rb +++ b/app/models/intervention.rb @@ -1,2 +1,2 @@ -class Intervention < ActiveRecord::Base +class Intervention < ApplicationRecord end diff --git a/app/models/interviewee.rb b/app/models/interviewee.rb index 09f6adf620..08c660a66d 100644 --- a/app/models/interviewee.rb +++ b/app/models/interviewee.rb @@ -1,4 +1,4 @@ -class Interviewee < ActiveRecord::Base +class Interviewee < ApplicationRecord has_paper_trail has_many :government_form_interviewees, dependent: :restrict_with_error diff --git a/app/models/leave_program.rb b/app/models/leave_program.rb index 7b20f645a4..5704b624a4 100644 --- a/app/models/leave_program.rb +++ b/app/models/leave_program.rb @@ -1,4 +1,4 @@ -class LeaveProgram < ActiveRecord::Base +class LeaveProgram < ApplicationRecord include NestedAttributesConcern include ClientEnrollmentTrackingConcern diff --git a/app/models/location.rb b/app/models/location.rb index e3acd9004d..ff1668ee2a 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -1,2 +1,2 @@ -class Location < ActiveRecord::Base +class Location < ApplicationRecord end diff --git a/app/models/material.rb b/app/models/material.rb index 56f8e90c58..1f2074f081 100644 --- a/app/models/material.rb +++ b/app/models/material.rb @@ -1,2 +1,2 @@ -class Material < ActiveRecord::Base +class Material < ApplicationRecord end diff --git a/app/models/necessity.rb b/app/models/necessity.rb index 71d43bdaab..2b31383a68 100644 --- a/app/models/necessity.rb +++ b/app/models/necessity.rb @@ -1,4 +1,4 @@ -class Necessity < ActiveRecord::Base +class Necessity < ApplicationRecord has_many :call_necessities, dependent: :restrict_with_error has_many :calls, through: :call_necessities diff --git a/app/models/need.rb b/app/models/need.rb index b3c6dd67de..a6a18f314e 100644 --- a/app/models/need.rb +++ b/app/models/need.rb @@ -1,4 +1,4 @@ -class Need < ActiveRecord::Base +class Need < ApplicationRecord has_paper_trail has_many :government_form_needs, dependent: :restrict_with_error diff --git a/app/models/organization.rb b/app/models/organization.rb index 810c04a4b6..28a2e5e3d3 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -1,5 +1,5 @@ require 'rake' -class Organization < ActiveRecord::Base +class Organization < ApplicationRecord SUPPORTED_LANGUAGES = %w(en km my).freeze mount_uploader :logo, ImageUploader diff --git a/app/models/organization_type.rb b/app/models/organization_type.rb index 0ed273a27e..c4319cac2d 100644 --- a/app/models/organization_type.rb +++ b/app/models/organization_type.rb @@ -1,4 +1,4 @@ -class OrganizationType < ActiveRecord::Base +class OrganizationType < ApplicationRecord has_many :partners, dependent: :restrict_with_error has_paper_trail diff --git a/app/models/partner.rb b/app/models/partner.rb index 4c24e40f0f..4c2e0d0ed5 100644 --- a/app/models/partner.rb +++ b/app/models/partner.rb @@ -1,4 +1,4 @@ -class Partner < ActiveRecord::Base +class Partner < ApplicationRecord include EntityTypeCustomField belongs_to :province, counter_cache: true belongs_to :organization_type diff --git a/app/models/permission.rb b/app/models/permission.rb index 8a5da79348..f1c95d37ff 100644 --- a/app/models/permission.rb +++ b/app/models/permission.rb @@ -1,3 +1,3 @@ -class Permission < ActiveRecord::Base +class Permission < ApplicationRecord belongs_to :user end diff --git a/app/models/problem.rb b/app/models/problem.rb index 377ad0c26b..52fce71682 100644 --- a/app/models/problem.rb +++ b/app/models/problem.rb @@ -1,4 +1,4 @@ -class Problem < ActiveRecord::Base +class Problem < ApplicationRecord has_paper_trail has_many :government_form_problems, dependent: :restrict_with_error diff --git a/app/models/program_stream.rb b/app/models/program_stream.rb index 4f163517c5..98b7cf8f4b 100644 --- a/app/models/program_stream.rb +++ b/app/models/program_stream.rb @@ -1,4 +1,4 @@ -class ProgramStream < ActiveRecord::Base +class ProgramStream < ApplicationRecord include UpdateFieldLabelsFormBuilder FORM_BUILDER_FIELDS = ['enrollment', 'exit_program'].freeze acts_as_paranoid without_default_scope: true, column: :archived_at diff --git a/app/models/program_stream_permission.rb b/app/models/program_stream_permission.rb index 6eeed037e7..522062d973 100644 --- a/app/models/program_stream_permission.rb +++ b/app/models/program_stream_permission.rb @@ -1,4 +1,4 @@ -class ProgramStreamPermission < ActiveRecord::Base +class ProgramStreamPermission < ApplicationRecord acts_as_paranoid belongs_to :user, with_deleted: true diff --git a/app/models/program_stream_service.rb b/app/models/program_stream_service.rb index 317243f60c..d595c5ccf4 100644 --- a/app/models/program_stream_service.rb +++ b/app/models/program_stream_service.rb @@ -1,4 +1,4 @@ -class ProgramStreamService < ActiveRecord::Base +class ProgramStreamService < ApplicationRecord acts_as_paranoid belongs_to :program_stream diff --git a/app/models/progress_note.rb b/app/models/progress_note.rb index efb3d3144b..e2c50fcf97 100644 --- a/app/models/progress_note.rb +++ b/app/models/progress_note.rb @@ -1,3 +1,3 @@ -class ProgressNote < ActiveRecord::Base +class ProgressNote < ApplicationRecord belongs_to :client end diff --git a/app/models/progress_note_type.rb b/app/models/progress_note_type.rb index abe5e23086..d07444d016 100644 --- a/app/models/progress_note_type.rb +++ b/app/models/progress_note_type.rb @@ -1,2 +1,2 @@ -class ProgressNoteType < ActiveRecord::Base +class ProgressNoteType < ApplicationRecord end diff --git a/app/models/protection_concern.rb b/app/models/protection_concern.rb index 5cfa9fc3ad..65064cd536 100644 --- a/app/models/protection_concern.rb +++ b/app/models/protection_concern.rb @@ -1,4 +1,4 @@ -class ProtectionConcern < ActiveRecord::Base +class ProtectionConcern < ApplicationRecord has_many :call_protection_concerns, dependent: :restrict_with_error has_many :calls, through: :call_protection_concerns diff --git a/app/models/province.rb b/app/models/province.rb index b45e4fc4ef..1a9cd32445 100644 --- a/app/models/province.rb +++ b/app/models/province.rb @@ -1,4 +1,4 @@ -class Province < ActiveRecord::Base +class Province < ApplicationRecord include AddressConcern has_paper_trail diff --git a/app/models/quantitative_case.rb b/app/models/quantitative_case.rb index f74eb40e5f..4ffb0679ca 100644 --- a/app/models/quantitative_case.rb +++ b/app/models/quantitative_case.rb @@ -1,4 +1,4 @@ -class QuantitativeCase < ActiveRecord::Base +class QuantitativeCase < ApplicationRecord validates :value, presence: true, uniqueness: { case_sensitive: false, scope: :quantitative_type_id } belongs_to :quantitative_type, counter_cache: true diff --git a/app/models/quantitative_type.rb b/app/models/quantitative_type.rb index 36cdc89ea5..dde59190fb 100644 --- a/app/models/quantitative_type.rb +++ b/app/models/quantitative_type.rb @@ -1,4 +1,4 @@ -class QuantitativeType < ActiveRecord::Base +class QuantitativeType < ApplicationRecord validates :name, presence: true, uniqueness: { case_sensitive: false } has_many :quantitative_cases diff --git a/app/models/quantitative_type_permission.rb b/app/models/quantitative_type_permission.rb index 62f1acfd2d..7a10eb1dc8 100644 --- a/app/models/quantitative_type_permission.rb +++ b/app/models/quantitative_type_permission.rb @@ -1,4 +1,4 @@ -class QuantitativeTypePermission < ActiveRecord::Base +class QuantitativeTypePermission < ApplicationRecord belongs_to :user belongs_to :quantitative_type diff --git a/app/models/quarterly_report.rb b/app/models/quarterly_report.rb index b7333318d2..7842ab6ea9 100644 --- a/app/models/quarterly_report.rb +++ b/app/models/quarterly_report.rb @@ -1,4 +1,4 @@ -class QuarterlyReport < ActiveRecord::Base +class QuarterlyReport < ApplicationRecord belongs_to :case belongs_to :staff_information, class_name: 'User', foreign_key: 'staff_id' diff --git a/app/models/referee.rb b/app/models/referee.rb index 69d1ad690a..c4e17a98e3 100644 --- a/app/models/referee.rb +++ b/app/models/referee.rb @@ -1,4 +1,4 @@ -class Referee < ActiveRecord::Base +class Referee < ApplicationRecord ADDRESS_TYPES = ['Home', 'Business', 'RCI', 'Dormitory', 'Other'].freeze FIELDS = %w(id name gender adult anonymous phone email address_type outside province_id district_id commune_id village_id current_address house_number locality outside_address street_number created_at updated_at) GENDER_OPTIONS = ['female', 'male', 'lgbt', 'unknown', 'prefer_not_to_say', 'other'] diff --git a/app/models/referral.rb b/app/models/referral.rb index c4db949a20..12389b3db1 100644 --- a/app/models/referral.rb +++ b/app/models/referral.rb @@ -1,4 +1,4 @@ -class Referral < ActiveRecord::Base +class Referral < ApplicationRecord include ClientRetouch has_paper_trail diff --git a/app/models/referral_source.rb b/app/models/referral_source.rb index 6a4f9df65e..e494d138ba 100644 --- a/app/models/referral_source.rb +++ b/app/models/referral_source.rb @@ -1,4 +1,4 @@ -class ReferralSource < ActiveRecord::Base +class ReferralSource < ApplicationRecord has_ancestry has_many :clients, dependent: :restrict_with_error has_paper_trail diff --git a/app/models/service.rb b/app/models/service.rb index f5b7109b29..7f8f2c3115 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -1,4 +1,4 @@ -class Service < ActiveRecord::Base +class Service < ApplicationRecord acts_as_paranoid belongs_to :global_service, class_name: 'GlobalService', foreign_key: 'uuid', primary_key: :uuid diff --git a/app/models/service_type.rb b/app/models/service_type.rb index 87943f3b29..c3b819777f 100644 --- a/app/models/service_type.rb +++ b/app/models/service_type.rb @@ -1,4 +1,4 @@ -class ServiceType < ActiveRecord::Base +class ServiceType < ApplicationRecord has_paper_trail has_many :government_form_service_types, dependent: :restrict_with_error diff --git a/app/models/setting.rb b/app/models/setting.rb index 6467236f84..e241e3783a 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -1,4 +1,4 @@ -class Setting < ActiveRecord::Base +class Setting < ApplicationRecord extend Enumerize has_paper_trail diff --git a/app/models/shared_client.rb b/app/models/shared_client.rb index fe1bd5a69b..8030aa9f40 100644 --- a/app/models/shared_client.rb +++ b/app/models/shared_client.rb @@ -1,4 +1,4 @@ -class SharedClient < ActiveRecord::Base +class SharedClient < ApplicationRecord has_paper_trail belongs_to :birth_province, class_name: 'Province', foreign_key: :birth_province_id diff --git a/app/models/sponsor.rb b/app/models/sponsor.rb index 7cb295c455..bb0e1ba4c7 100644 --- a/app/models/sponsor.rb +++ b/app/models/sponsor.rb @@ -1,4 +1,4 @@ -class Sponsor < ActiveRecord::Base +class Sponsor < ApplicationRecord has_paper_trail belongs_to :donor diff --git a/app/models/state.rb b/app/models/state.rb index 4dd8c12cdb..b5a50eb28e 100644 --- a/app/models/state.rb +++ b/app/models/state.rb @@ -1,4 +1,4 @@ -class State < ActiveRecord::Base +class State < ApplicationRecord has_many :townships has_many :clients, dependent: :restrict_with_error diff --git a/app/models/subdistrict.rb b/app/models/subdistrict.rb index dc64d0b943..7fc4ebeea7 100644 --- a/app/models/subdistrict.rb +++ b/app/models/subdistrict.rb @@ -1,4 +1,4 @@ -class Subdistrict < ActiveRecord::Base +class Subdistrict < ApplicationRecord belongs_to :district has_many :clients, dependent: :restrict_with_error diff --git a/app/models/survey.rb b/app/models/survey.rb index 0251a1dcfe..83716c6315 100644 --- a/app/models/survey.rb +++ b/app/models/survey.rb @@ -1,4 +1,4 @@ -class Survey < ActiveRecord::Base +class Survey < ApplicationRecord belongs_to :client end diff --git a/app/models/task.rb b/app/models/task.rb index 1a649e4a80..07de86e866 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,4 +1,4 @@ -class Task < ActiveRecord::Base +class Task < ApplicationRecord belongs_to :domain, counter_cache: true belongs_to :case_note_domain_group belongs_to :client diff --git a/app/models/township.rb b/app/models/township.rb index f0535f5046..ccf8ac394b 100644 --- a/app/models/township.rb +++ b/app/models/township.rb @@ -1,4 +1,4 @@ -class Township < ActiveRecord::Base +class Township < ApplicationRecord belongs_to :state has_many :clients, dependent: :restrict_with_error diff --git a/app/models/tracking.rb b/app/models/tracking.rb index 8d4a68f2cc..7c58e1fdbb 100644 --- a/app/models/tracking.rb +++ b/app/models/tracking.rb @@ -1,4 +1,4 @@ -class Tracking < ActiveRecord::Base +class Tracking < ApplicationRecord include UpdateFieldLabelsFormBuilder FREQUENCIES = ['Daily', 'Weekly', 'Monthly', 'Yearly'].freeze acts_as_paranoid diff --git a/app/models/user.rb b/app/models/user.rb index 40a7923346..e86eaa433e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,4 @@ -class User < ActiveRecord::Base +class User < ApplicationRecord include EntityTypeCustomField include EntityTypeCustomFieldNotification include NextClientEnrollmentTracking @@ -78,7 +78,7 @@ class User < ActiveRecord::Base before_save :assign_as_admin after_commit :set_manager_ids - after_save :detach_manager, if: 'roles_changed?' + after_save :detach_manager, if: :roles_changed? after_save :toggle_referral_notification after_create :build_permission diff --git a/app/models/village.rb b/app/models/village.rb index 0191c07abb..35a0be3d1a 100644 --- a/app/models/village.rb +++ b/app/models/village.rb @@ -1,4 +1,4 @@ -class Village < ActiveRecord::Base +class Village < ApplicationRecord has_paper_trail belongs_to :commune diff --git a/app/models/visit.rb b/app/models/visit.rb index bda5d0d50e..ef4934e479 100644 --- a/app/models/visit.rb +++ b/app/models/visit.rb @@ -1,4 +1,4 @@ -class Visit < ActiveRecord::Base +class Visit < ApplicationRecord has_paper_trail belongs_to :user diff --git a/app/models/visit_client.rb b/app/models/visit_client.rb index ebcc9803be..963fb136ca 100644 --- a/app/models/visit_client.rb +++ b/app/models/visit_client.rb @@ -1,4 +1,4 @@ -class VisitClient < ActiveRecord::Base +class VisitClient < ApplicationRecord acts_as_paranoid belongs_to :user, with_deleted: true diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb index c5a0e194d8..ebc6808926 100644 --- a/app/uploaders/image_uploader.rb +++ b/app/uploaders/image_uploader.rb @@ -2,6 +2,8 @@ class ImageUploader < CarrierWave::Uploader::Base # include CarrierWave::RMagick # include CarrierWave::MimeTypes include CarrierWave::MiniMagick + storage Rails.env.development? ? :file : :fog + process :auto_orient version :thumb do process resize_to_limit: [nil, 200] diff --git a/app/views/clients/index.html.haml b/app/views/clients/index.html.haml index 667059a877..db7e81e0b5 100644 --- a/app/views/clients/index.html.haml +++ b/app/views/clients/index.html.haml @@ -19,7 +19,7 @@ = t('.save_search_settings') - if params['commit'].present? || params['client_advanced_search'].present? - = button_to ad_search_clients_path, params: params.merge(format: 'xls', type: 'basic_info'), class: 'btn btn-primary btn-export clients-list', form_class: 'hidden-post-form', data: { toggle: 'popover', trigger: "hover", html: 'true', content: "#{I18n.t('inline_help.clients.index.buttons.export_to_xls')}", placement: "auto" } do + = button_to ad_search_clients_path, params: request.parameters.merge(format: 'xls', type: 'basic_info'), class: 'btn btn-primary btn-export clients-list', form_class: 'hidden-post-form', data: { toggle: 'popover', trigger: "hover", html: 'true', content: "#{I18n.t('inline_help.clients.index.buttons.export_to_xls')}", placement: "auto" } do %i.fa.fa-download = t('.export_to_xls') - if enable_all_csi_tools? @@ -103,14 +103,14 @@ %span.label.label-info= t('.results') .ibox-tools - if params[:data] == 'recent' - = button_to t('.show_all'), ad_search_clients_path, params: params.merge({data: 'all'}), class: 'btn btn-primary', form_class: 'hidden-post-form', id: 'show-all' + = button_to t('.show_all'), ad_search_clients_path, params: request.parameters.merge({data: 'all'}), class: 'btn btn-primary', form_class: 'hidden-post-form', id: 'show-all' - else - = button_to t('.most_recent'), ad_search_clients_path, params: params.merge({data: 'recent'}), class: 'btn btn-primary', form_class: 'hidden-post-form', id: 'most-recent' + = button_to t('.most_recent'), ad_search_clients_path, params: request.parameters.merge({data: 'recent'}), class: 'btn btn-primary', form_class: 'hidden-post-form', id: 'most-recent' .ibox-content .clients-table{ data: { 'info-load': t('.load'), 'info-end': t('.end'), 'read-more': t('.read_more'), 'read-less': t('.read_less') } } %table.table.table-bordered.table-striped.table-hover.clients#clients-list - = content_tag :div, 'hidden_param', class: 'hide', id: 'hidden-param', data: { 'hidden-param': url_for(params) } + = content_tag :div, 'hidden_param', class: 'hide', id: 'hidden-param', data: { 'hidden-param': url_for(request.parameters) } %thead = datagrid_header(@client_grid) %tbody.page diff --git a/app/views/datagrid/_order_for.html.haml b/app/views/datagrid/_order_for.html.haml index e54105932a..754c206668 100644 --- a/app/views/datagrid/_order_for.html.haml +++ b/app/views/datagrid/_order_for.html.haml @@ -1,8 +1,8 @@ - if params["controller"] == "clients" .order.pull-right - = button_to I18n.t('datagrid.table.order.asc').html_safe, ad_search_clients_path, params: params.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: false)), class: 'asc btn btn-link', form_class: 'hidden-post-form', style: 'padding: 0' - = button_to I18n.t('datagrid.table.order.desc').html_safe, ad_search_clients_path, params: params.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: true)), class: 'desc btn btn-link', form_class: 'hidden-post-form', style: 'padding: 0' + = button_to I18n.t('datagrid.table.order.asc').html_safe, ad_search_clients_path, params: request.parameters.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: false)), class: 'asc btn btn-link', form_class: 'hidden-post-form', style: 'padding: 0' + = button_to I18n.t('datagrid.table.order.desc').html_safe, ad_search_clients_path, params: request.parameters.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: true)), class: 'desc btn btn-link', form_class: 'hidden-post-form', style: 'padding: 0' - else .order.pull-right - = link_to(I18n.t('datagrid.table.order.asc').html_safe, url_for(params.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: false))), class: 'asc') - = link_to(I18n.t('datagrid.table.order.desc').html_safe, url_for(params.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: true))), class: 'desc') + = link_to(I18n.t('datagrid.table.order.asc').html_safe, url_for(request.parameters.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: false))), class: 'asc') + = link_to(I18n.t('datagrid.table.order.desc').html_safe, url_for(request.parameters.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: true))), class: 'desc') diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index b38512354d..b438cb152b 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -2,7 +2,7 @@ .col-xs-12.col-sm-6.col-sm-offset-3.col-md-4.col-md-offset-4 .ibox.normal-space .ibox-title.text-center - = image_tag(@current_ngo&.logo || 'OSCaR.png') + = image_tag(@current_ngo&.logo&.url || 'OSCaR.png') .ibox-content = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| = f.error_notification diff --git a/app/views/kaminari/_last_page.html.haml b/app/views/kaminari/_last_page.html.haml index d02712d68a..f6344dd248 100644 --- a/app/views/kaminari/_last_page.html.haml +++ b/app/views/kaminari/_last_page.html.haml @@ -1,7 +1,7 @@ %li - if params[:controller] == 'clients' - unless current_page.last? - - pagination_params = url.include?('page') ? params.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : params + - pagination_params = url.include?('page') ? request.parameters.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : params = button_to raw(t 'views.pagination.last'), ad_search_clients_path, params: pagination_params, :remote => remote, form_class: 'hidden-post-form' - else = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} diff --git a/app/views/kaminari/_next_page.html.haml b/app/views/kaminari/_next_page.html.haml index 448bf93b3f..ce51231951 100644 --- a/app/views/kaminari/_next_page.html.haml +++ b/app/views/kaminari/_next_page.html.haml @@ -1,7 +1,7 @@ %li - if params[:controller] == 'clients' - unless current_page.last? - - pagination_params = url.include?('page') ? params.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : params + - pagination_params = url.include?('page') ? request.parameters.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : params = button_to raw(t 'views.pagination.next'), ad_search_clients_path, params: pagination_params, :rel => 'next', :remote => remote, form_class: 'hidden-post-form' - else = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote diff --git a/app/views/kaminari/_page.html.haml b/app/views/kaminari/_page.html.haml index 2803f42919..4ba519eb69 100644 --- a/app/views/kaminari/_page.html.haml +++ b/app/views/kaminari/_page.html.haml @@ -4,7 +4,7 @@ - else %li - if params[:controller] == 'clients' - - pagination_params = url.include?('page') ? params.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : params.merge(page: 1) + - pagination_params = url.include?('page') ? request.parameters.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : request.parameters.merge(page: 1) = button_to page, ad_search_clients_path, params: pagination_params, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)), form_class: 'hidden-post-form' - else = link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) diff --git a/app/views/layouts/_side_menu.haml b/app/views/layouts/_side_menu.haml index 189f3a4095..2f4fe28148 100644 --- a/app/views/layouts/_side_menu.haml +++ b/app/views/layouts/_side_menu.haml @@ -5,7 +5,7 @@ .dropdown.profile-element .image-wrapper.text-center = link_to root_path do - = image_tag(Organization.current.logo.thumb, class: 'img-circle') + = image_tag(Organization.current.logo.thumb.url, class: 'img-circle') %hr.line-border %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"} %span.clear @@ -26,7 +26,7 @@ = link_to t('.log_out'), destroy_user_session_path, method: :delete .logo-element.custom = link_to root_path do - = image_tag(Organization.current.logo, class: 'log-min img-responsive') + = image_tag(Organization.current.logo.url, class: 'log-min img-responsive') - if user_signed_in? %li{class: "#{active_menu('dashboards')}"} = link_to root_path do diff --git a/app/views/layouts/_top_navbar.haml b/app/views/layouts/_top_navbar.haml index 393c5ddf88..80a27d4bf7 100644 --- a/app/views/layouts/_top_navbar.haml +++ b/app/views/layouts/_top_navbar.haml @@ -21,7 +21,7 @@ - request_method = (params[:controller] == 'clients' && params[:action] == 'index') ? 'Post' : 'Get' - supported_languages = (current_organization&.supported_languages || Organization::SUPPORTED_LANGUAGES) - supported_languages.each do |supported_lang| - = link_to(url_for(params.merge({locale: supported_lang})), id: "lang-#{supported_lang}", method: request_method) do + = link_to(url_for(request.parameters.merge({locale: supported_lang})), id: "lang-#{supported_lang}", method: request_method) do = image_tag(supported_languages_data.dig(supported_lang.to_sym, :flag_file_name)) = supported_languages_data.dig(supported_lang.to_sym, :label) diff --git a/app/views/layouts/mailer.html.haml b/app/views/layouts/mailer.html.haml index 28739ee901..f992a524d0 100644 --- a/app/views/layouts/mailer.html.haml +++ b/app/views/layouts/mailer.html.haml @@ -1,3 +1,7 @@ -%hmtl - %body - = yield \ No newline at end of file +!!! +%html + %head + %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/ + :css + /* Email styles need to be inline */ + %body= yield diff --git a/app/views/organizations/index.html.haml b/app/views/organizations/index.html.haml index b473b81137..2340f76495 100644 --- a/app/views/organizations/index.html.haml +++ b/app/views/organizations/index.html.haml @@ -6,4 +6,4 @@ .col-xs-6.col-sm-4 = link_to dashboards_url(subdomain: org.short_name), class: 'org-link' do .organization - = image_tag(org.logo.thumb) + = image_tag(org.logo.thumb.url) diff --git a/config/application.rb b/config/application.rb index 934f786f61..f23491beb5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,15 +1,29 @@ require_relative 'boot' require 'rails/all' + +# Pick the frameworks you want: +require 'active_model/railtie' +require 'active_job/railtie' +require 'active_record/railtie' +require 'active_storage/engine' +require 'action_controller/railtie' +require 'action_mailer/railtie' +require 'action_view/railtie' +require 'action_cable/engine' +require 'sprockets/railtie' +require 'apartment/elevators/subdomain' # Require the gems listed in Gemfile, including any gems + # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module CifWeb class Application < Rails::Application - config.load_defaults 5.0 - config.middleware.use 'Apartment::Elevators::Subdomain' - config.middleware.insert_before 'Warden::Manager', 'Apartment::Elevators::Subdomain' + config.load_defaults 5.2 + + config.middleware.use Apartment::Elevators::Subdomain + config.middleware.insert_before Warden::Manager, Apartment::Elevators::Subdomain # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. @@ -43,9 +57,6 @@ class Application < Rails::Application end end - # Do not allow errors in after_commit/after_rollback callbacks. - config.active_record.raise_in_transactional_callbacks = true - # custom error page config.exceptions_app = self.routes end diff --git a/config/environments/development.rb b/config/environments/development.rb index cb5b5e7d97..84db3154d8 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -21,11 +21,11 @@ 'Cache-Control' => "public, max-age=#{2.days.to_i}" } else - config.perform_caching = true - config.action_controller.perform_caching = true - config.cache_store = :mem_cache_store + # config.perform_caching = true + config.action_controller.perform_caching = false + # config.cache_store = :mem_cache_store - # config.cache_store = :null_store + config.cache_store = :null_store end # Store uploaded files on the local file system (see config/storage.yml for options) diff --git a/config/initializers/active_record_belongs_to_required_by_default.rb b/config/initializers/active_record_belongs_to_required_by_default.rb new file mode 100644 index 0000000000..6ee4b37e32 --- /dev/null +++ b/config/initializers/active_record_belongs_to_required_by_default.rb @@ -0,0 +1 @@ +Rails.application.config.active_record.belongs_to_required_by_default = true diff --git a/config/initializers/paper_trail.rb b/config/initializers/paper_trail.rb index 61426eb7be..af876e3590 100644 --- a/config/initializers/paper_trail.rb +++ b/config/initializers/paper_trail.rb @@ -1,13 +1,21 @@ -PaperTrail.config.track_associations = true +require 'rake' PaperTrail.config.version_limit = nil +PaperTrail.config.track_associations = true # set whodunnit in rails console PaperTrail::Rails::Engine.eager_load! +module PaperTrail + class Version < ::ActiveRecord::Base + include PaperTrail::VersionConcern + # belongs_to :user, foreign_key: :whodunnit + end +end + if defined?(::Rails::Console) # PaperTrail.whodunnit = "#{`whoami`.strip}: console" - PaperTrail.whodunnit = "#{`whoami`.strip}@rotati" + PaperTrail.request.whodunnit = "#{`whoami`.strip}@rotati" elsif defined?(Rake) && Rake.application.name # PaperTrail.whodunnit = "#{`whoami`.strip}: #{File.basename($0)} #{ARGV.join ' '}" - PaperTrail.whodunnit = "#{`whoami`.strip}@rotati" + PaperTrail.request.whodunnit = "#{`whoami`.strip}@rotati" end diff --git a/config/initializers/thredded.rb b/config/initializers/thredded.rb index 6c534f90a6..55e0b241cb 100644 --- a/config/initializers/thredded.rb +++ b/config/initializers/thredded.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Thredded configuration # ==> User Configuration @@ -7,23 +8,29 @@ # for your user class - change it here. Thredded.user_class = 'User' -# User email column, used in @mention syntax and should be unique. +# User name column, used in @mention syntax and *must* be unique. # This is the column used to search for users' names if/when someone is @ mentioned. Thredded.user_name_column = :email +# User display name method, by default thredded uses the user_name_column defined above +# You may want to use :to_s or some more elaborate method +# Thredded.user_display_name_method = :to_s + # The path (or URL) you will use to link to your users' profiles. # When linking to a user, Thredded will use this lambda to spit out # the path or url to your user. This lambda is evaluated in the view context. -Thredded.user_path = lambda do |user| - user_path = :"#{Thredded.user_class.name.underscore}_path" +# If the lambda returns nil, a span element is returned instead of a link; so +# setting this to always return nil effectively disables all user links. +Thredded.user_path = ->(user) { + user_path = :"#{Thredded.user_class_name.demodulize.underscore}_path" main_app.respond_to?(user_path) ? main_app.send(user_path, user) : "/users/#{user.to_param}" -end +} # This method is used by Thredded controllers and views to fetch the currently signed-in user -Thredded.current_user_method = :"current_#{Thredded.user_class.name.underscore}" +Thredded.current_user_method = :"current_#{Thredded.user_class_name.demodulize.underscore}" # User avatar URL. rb-gravatar gem is used by default: -Thredded.avatar_url = ->(user) { Gravatar.src(user.email, 128, 'mm') } +Thredded.avatar_url = ->(user) { Gravatar.src(user.email, 156, 'mm') } # ==> Permissions Configuration # By default, thredded uses a simple permission model, where all the users can post to all message boards, @@ -40,44 +47,139 @@ # This model can be customized further by overriding a handful of methods on the User model. # For more information, see app/models/thredded/user_extender.rb. +# ==> UI configuration + +# How to calculate the position of messageboards in a list: +# :position (default) set the position manually (new messageboards go to the bottom, by creation timestamp) +# :last_post_at_desc most recent post first +# :topics_count_desc most topics first +Thredded.messageboards_order = :position + +# Whether users that are following a topic are listed on the topic page. +Thredded.show_topic_followers = false + +# Whether the list of users who are currently online is displayed. +Thredded.currently_online_enabled = true + +# Whether private messaging functionality is enabled. +Thredded.private_messaging_enabled = true + +# The number of topics to display per page. +# Thredded.topics_per_page = 50 + +# The number of posts to display per page in a topic. +# Thredded.posts_per_page = 25 + +# The layout for rendering Thredded views. +Thredded.layout = 'thredded/application' + # ==> Email Configuration # Email "From:" field will use the following +# (this is also used as the "To" address for both email notifcations, as all the recipients are on bcc) Thredded.email_from = ENV['SENDER_EMAIL'] -# Incoming email will be directed to this host -Thredded.email_incoming_host = ENV['HOST_SERVER'] - # Emails going out will prefix the "Subject:" with the following string Thredded.email_outgoing_prefix = '[FAQ] ' +# +# The parent mailer for all Thredded mailers +# Thredded.parent_mailer = 'ActionMailer::Base' -# Reply to field for email notifications -Thredded.email_reply_to = -> postable { "#{postable.hash_id}@#{Thredded.email_incoming_host}" } +# ==> Model configuration +# The range of valid messageboard name lengths. Default: +# Thredded.messageboard_name_length_range = (1..60) +# +# The range of valid topic title lengths. Default: +# Thredded.topic_title_length_range = (1..200) -# ==> View Configuration -# Set the layout for rendering the thredded views. -Thredded.layout = 'thredded/application' +# ==> Routes and URLs +# How Thredded generates URL slugs from text: + +# Default: +# Thredded.slugifier = ->(input) { input.parameterize } + +# If your forum is in a language other than English, you might want to use the babosa gem instead +# Thredded.slugifier = ->(input) { Babosa::Identifier.new(input).normalize.transliterate(:russian).to_s } + +# By default, thredded uses integers for record ID route constraints. +# For integer based IDs (default): +# Thredded.routes_id_constraint = /[1-9]\d*/ +# +# For UUID based IDs (example): +# Thredded.routes_id_constraint = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ # ==> Post Content Formatting # Customize the way Thredded handles post formatting. -# Change the default html-pipeline filters used by thredded. -# E.g. to remove BBCode support: -# Thredded::ContentFormatter.pipeline_filters -= [HTML::Pipeline::BbcodeFilter] +# ===> Emoji using the 'gemoji' gem +# 1. Install `gemoji` following instruction at https://github.com/github/gemoji. +# 2. Uncomment the following line: +# Thredded::ContentFormatter.after_markup_filters.insert(1, HTML::Pipeline::EmojiFilter) # Change the HTML sanitization settings used by Thredded. # See the Sanitize docs for more information on the underlying library: https://github.com/rgrove/sanitize/#readme # E.g. to allow a custom element : # Thredded::ContentFormatter.whitelist[:elements] += %w(custom-element) +# ==> User autocompletion (Private messages and @-mentions) +# Thredded.autocomplete_min_length = 2 lower to 1 if have 1-letter names -- increase if you want + # ==> Error Handling # By default Thredded just renders a flash alert on errors such as Topic not found, or Login required. # Below is an example of overriding the default behavior on LoginRequired: # # Rails.application.config.to_prepare do # Thredded::ApplicationController.module_eval do +# # Render sign in page: # rescue_from Thredded::Errors::LoginRequired do |exception| -# @message = exception.message -# render template: 'sessions/new', status: :forbidden +# flash.now[:notice] = exception.message +# controller = Users::SessionsController.new +# controller.request = request +# controller.request.env['devise.mapping'] = Devise.mappings[:user] +# controller.response = response +# controller.response_options = { status: :forbidden } +# controller.process(:new) # end # end # end + +# ==> View hooks +# +# Customize the UI before/after/replacing individual components. +# See the full list of view hooks and their arguments by running: +# +# $ grep view_hooks -R --include '*.html.erb' "$(bundle show thredded)" +# +# Rails.application.config.to_prepare do +# Thredded.view_hooks.post_form.content_text_area.config.before do |form:, **args| +# # This is called in the Thredded view context, so all Thredded helpers and URLs are accessible here directly. +# 'hi' +# end +# end + +# ==> Topic following +# +# By default, a user will be subscribed to a topic they've created. Uncomment this to not subscribe them: +# +# Thredded.auto_follow_when_creating_topic = false +# +# By default, a user will be subscribed to (follow) a topic they post in. Uncomment this to not subscribe them: +# +# Thredded.auto_follow_when_posting_in_topic = false +# +# By default, a user will be subscribed to the topic they get @-mentioned in. +# Individual users can disable this in the Notification Settings. +# To change the default for all users, simply change the default value of the `follow_topics_on_mention` column +# of the `thredded_user_preferences` and `thredded_user_messageboard_preferences` tables. + +# ==> Notifiers +# +# Change how users can choose to be notified, by adding notifiers here, or removing the initializer altogether +# +# default: +# Thredded.notifiers = [Thredded::EmailNotifier.new] +# +# none: +# Thredded.notifiers = [] +# +# add in (must install separate gem (under development) as well): +# Thredded.notifiers = [Thredded::EmailNotifier.new, Thredded::PushoverNotifier.new(ENV['PUSHOVER_APP_ID'])] diff --git a/db/migrate/20201214014711_add_foreign_type_to_version_associations.rb b/db/migrate/20201214014711_add_foreign_type_to_version_associations.rb new file mode 100644 index 0000000000..8d8243d713 --- /dev/null +++ b/db/migrate/20201214014711_add_foreign_type_to_version_associations.rb @@ -0,0 +1,24 @@ +# This migration and AddTransactionIdColumnToVersions provide the necessary +# schema for tracking associations. +class AddForeignTypeToVersionAssociations < ActiveRecord::Migration[5.2] + def self.up + add_column :version_associations, :foreign_type, :string, index: true + remove_index :version_associations, + name: "index_version_associations_on_foreign_key" if index_exists?(:version_associations, [:foreign_key_name, :foreign_key_id]) + + remove_index :version_associations, column: [:foreign_key_name, :foreign_key_id] if index_exists?(:version_associations, [:foreign_key_name, :foreign_key_id]) + + add_index :version_associations, + %i(foreign_key_name foreign_key_id foreign_type), + name: "index_version_associations_on_foreign_key" + end + + def self.down + remove_index :version_associations, + name: "index_version_associations_on_foreign_key" + remove_column :version_associations, :foreign_type + add_index :version_associations, + %i(foreign_key_name foreign_key_id), + name: "index_version_associations_on_foreign_key" + end +end diff --git a/db/schema.rb b/db/schema.rb index 653e92b286..db8976893b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -11,2263 +10,5116 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20201020063259) do +ActiveRecord::Schema.define(version: 2020_12_14_014711) do # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" enable_extension "hstore" enable_extension "pgcrypto" + enable_extension "plpgsql" enable_extension "uuid-ossp" - create_table "able_screening_questions", force: :cascade do |t| - t.string "question" - t.string "mode" - t.integer "stage_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "alert_manager" - t.integer "question_group_id" + create_table "able_screening_questions", id: :serial, force: :cascade do |t| + t.string "question" + t.string "mode" + t.integer "stage_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "alert_manager" + t.integer "question_group_id" + t.index ["question_group_id"], name: "index_able_screening_questions_on_question_group_id" + t.index ["question_group_id"], name: "index_able_screening_questions_on_question_group_id" + t.index ["stage_id"], name: "index_able_screening_questions_on_stage_id" + t.index ["stage_id"], name: "index_able_screening_questions_on_stage_id" + end + + create_table "able_screening_questions", id: :serial, force: :cascade do |t| + t.string "question" + t.string "mode" + t.integer "stage_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "alert_manager" + t.integer "question_group_id" + t.index ["question_group_id"], name: "index_able_screening_questions_on_question_group_id" + t.index ["question_group_id"], name: "index_able_screening_questions_on_question_group_id" + t.index ["stage_id"], name: "index_able_screening_questions_on_stage_id" + t.index ["stage_id"], name: "index_able_screening_questions_on_stage_id" + end + + create_table "action_results", id: :serial, force: :cascade do |t| + t.text "action", default: "" + t.text "result", default: "" + t.integer "government_form_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["government_form_id"], name: "index_action_results_on_government_form_id" + t.index ["government_form_id"], name: "index_action_results_on_government_form_id" end - add_index "able_screening_questions", ["question_group_id"], name: "index_able_screening_questions_on_question_group_id", using: :btree - add_index "able_screening_questions", ["stage_id"], name: "index_able_screening_questions_on_stage_id", using: :btree - - create_table "action_results", force: :cascade do |t| - t.text "action", default: "" - t.text "result", default: "" - t.integer "government_form_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "action_results", id: :serial, force: :cascade do |t| + t.text "action", default: "" + t.text "result", default: "" + t.integer "government_form_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["government_form_id"], name: "index_action_results_on_government_form_id" + t.index ["government_form_id"], name: "index_action_results_on_government_form_id" end - add_index "action_results", ["government_form_id"], name: "index_action_results_on_government_form_id", using: :btree - - create_table "admin_users", force: :cascade do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + create_table "admin_users", id: :integer, default: nil, force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "token" + t.string "first_name" + t.string "last_name" + t.string "provider", default: "email", null: false + t.string "uid", default: "", null: false + t.json "tokens" + t.index ["email"], name: "index_admin_users_on_email", unique: true + t.index ["email"], name: "index_admin_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true + t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true + t.index ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true + t.index ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true + end + + create_table "admin_users", id: :integer, default: nil, force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "token" - t.string "first_name" - t.string "last_name" - t.string "provider", default: "email", null: false - t.string "uid", default: "", null: false - t.json "tokens" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "token" + t.string "first_name" + t.string "last_name" + t.string "provider", default: "email", null: false + t.string "uid", default: "", null: false + t.json "tokens" + t.index ["email"], name: "index_admin_users_on_email", unique: true + t.index ["email"], name: "index_admin_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true + t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true + t.index ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true + t.index ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true + end + + create_table "advanced_searches", id: :serial, force: :cascade do |t| + t.string "name" + t.text "description" + t.jsonb "queries" + t.jsonb "field_visible" + t.string "custom_forms" + t.string "program_streams" + t.string "enrollment_check", default: "" + t.string "tracking_check", default: "" + t.string "exit_form_check", default: "" + t.string "quantitative_check", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "user_id" + t.string "hotline_check", default: "" + t.index ["user_id"], name: "index_advanced_searches_on_user_id" + t.index ["user_id"], name: "index_advanced_searches_on_user_id" + end + + create_table "advanced_searches", id: :serial, force: :cascade do |t| + t.string "name" + t.text "description" + t.jsonb "queries" + t.jsonb "field_visible" + t.string "custom_forms" + t.string "program_streams" + t.string "enrollment_check", default: "" + t.string "tracking_check", default: "" + t.string "exit_form_check", default: "" + t.string "quantitative_check", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "user_id" + t.string "hotline_check", default: "" + t.index ["user_id"], name: "index_advanced_searches_on_user_id" + t.index ["user_id"], name: "index_advanced_searches_on_user_id" end - add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true, using: :btree - add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree - add_index "admin_users", ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true, using: :btree - - create_table "advanced_searches", force: :cascade do |t| - t.string "name" - t.text "description" - t.jsonb "queries" - t.jsonb "field_visible" - t.string "custom_forms" - t.string "program_streams" - t.string "enrollment_check", default: "" - t.string "tracking_check", default: "" - t.string "exit_form_check", default: "" - t.string "quantitative_check", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "user_id" - t.string "hotline_check", default: "" + create_table "agencies", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "agencies_clients_count", default: 0 end - add_index "advanced_searches", ["user_id"], name: "index_advanced_searches_on_user_id", using: :btree - - create_table "agencies", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" + create_table "agencies", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" t.datetime "created_at" t.datetime "updated_at" - t.integer "agencies_clients_count", default: 0 + t.integer "agencies_clients_count", default: 0 end - create_table "agencies_clients", force: :cascade do |t| - t.integer "client_id" - t.integer "agency_id" + create_table "agencies_clients", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "agency_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "agency_clients", force: :cascade do |t| - t.integer "agency_id" - t.integer "client_id" + create_table "agencies_clients", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "agency_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "ar_internal_metadata", primary_key: "key", force: :cascade do |t| - t.string "value" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + create_table "agency_clients", id: :serial, force: :cascade do |t| + t.integer "agency_id" + t.integer "client_id" + t.datetime "created_at" + t.datetime "updated_at" end - create_table "assessment_domains", force: :cascade do |t| - t.text "note", default: "" - t.integer "previous_score" - t.integer "score" - t.text "reason", default: "" - t.integer "assessment_id" - t.integer "domain_id" + create_table "agency_clients", id: :serial, force: :cascade do |t| + t.integer "agency_id" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" - t.text "goal", default: "" - t.string "attachments", default: [], array: true - t.boolean "goal_required", default: true - t.boolean "required_task_last", default: false end - add_index "assessment_domains", ["score"], name: "index_assessment_domains_on_score", using: :btree + create_table "assessment_domains", id: :serial, force: :cascade do |t| + t.text "note", default: "" + t.integer "previous_score" + t.integer "score" + t.text "reason", default: "" + t.integer "assessment_id" + t.integer "domain_id" + t.datetime "created_at" + t.datetime "updated_at" + t.text "goal", default: "" + t.string "attachments", default: [], array: true + t.boolean "goal_required", default: true + t.boolean "required_task_last", default: false + t.index ["score"], name: "index_assessment_domains_on_score" + t.index ["score"], name: "index_assessment_domains_on_score" + end + + create_table "assessment_domains", id: :serial, force: :cascade do |t| + t.text "note", default: "" + t.integer "previous_score" + t.integer "score" + t.text "reason", default: "" + t.integer "assessment_id" + t.integer "domain_id" + t.datetime "created_at" + t.datetime "updated_at" + t.text "goal", default: "" + t.string "attachments", default: [], array: true + t.boolean "goal_required", default: true + t.boolean "required_task_last", default: false + t.index ["score"], name: "index_assessment_domains_on_score" + t.index ["score"], name: "index_assessment_domains_on_score" + end - create_table "assessments", force: :cascade do |t| + create_table "assessments", id: :serial, force: :cascade do |t| t.datetime "created_at" t.datetime "updated_at" - t.integer "client_id" - t.boolean "completed", default: false - t.boolean "default", default: true + t.integer "client_id" + t.boolean "completed", default: false + t.boolean "default", default: true + t.index ["client_id"], name: "index_assessments_on_client_id" + t.index ["client_id"], name: "index_assessments_on_client_id" end - add_index "assessments", ["client_id"], name: "index_assessments_on_client_id", using: :btree + create_table "assessments", id: :serial, force: :cascade do |t| + t.datetime "created_at" + t.datetime "updated_at" + t.integer "client_id" + t.boolean "completed", default: false + t.boolean "default", default: true + t.index ["client_id"], name: "index_assessments_on_client_id" + t.index ["client_id"], name: "index_assessments_on_client_id" + end - create_table "attachments", force: :cascade do |t| - t.string "image" - t.integer "able_screening_question_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "file", default: "" - t.integer "progress_note_id" + create_table "attachments", id: :serial, force: :cascade do |t| + t.string "image" + t.integer "able_screening_question_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "file", default: "" + t.integer "progress_note_id" + t.index ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id" + t.index ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id" + t.index ["progress_note_id"], name: "index_attachments_on_progress_note_id" + t.index ["progress_note_id"], name: "index_attachments_on_progress_note_id" end - add_index "attachments", ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id", using: :btree - add_index "attachments", ["progress_note_id"], name: "index_attachments_on_progress_note_id", using: :btree + create_table "attachments", id: :serial, force: :cascade do |t| + t.string "image" + t.integer "able_screening_question_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "file", default: "" + t.integer "progress_note_id" + t.index ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id" + t.index ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id" + t.index ["progress_note_id"], name: "index_attachments_on_progress_note_id" + t.index ["progress_note_id"], name: "index_attachments_on_progress_note_id" + end - create_table "calendars", force: :cascade do |t| - t.string "title" + create_table "calendars", id: :serial, force: :cascade do |t| + t.string "title" t.datetime "start_date" t.datetime "end_date" - t.boolean "sync_status", default: false - t.integer "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.boolean "sync_status", default: false + t.integer "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_calendars_on_user_id" + t.index ["user_id"], name: "index_calendars_on_user_id" end - add_index "calendars", ["user_id"], name: "index_calendars_on_user_id", using: :btree + create_table "calendars", id: :serial, force: :cascade do |t| + t.string "title" + t.datetime "start_date" + t.datetime "end_date" + t.boolean "sync_status", default: false + t.integer "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_calendars_on_user_id" + t.index ["user_id"], name: "index_calendars_on_user_id" + end - create_table "call_necessities", force: :cascade do |t| - t.integer "call_id" - t.integer "necessity_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "call_necessities", id: :serial, force: :cascade do |t| + t.integer "call_id" + t.integer "necessity_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["call_id"], name: "index_call_necessities_on_call_id" + t.index ["call_id"], name: "index_call_necessities_on_call_id" + t.index ["necessity_id"], name: "index_call_necessities_on_necessity_id" + t.index ["necessity_id"], name: "index_call_necessities_on_necessity_id" end - add_index "call_necessities", ["call_id"], name: "index_call_necessities_on_call_id", using: :btree - add_index "call_necessities", ["necessity_id"], name: "index_call_necessities_on_necessity_id", using: :btree + create_table "call_necessities", id: :serial, force: :cascade do |t| + t.integer "call_id" + t.integer "necessity_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["call_id"], name: "index_call_necessities_on_call_id" + t.index ["call_id"], name: "index_call_necessities_on_call_id" + t.index ["necessity_id"], name: "index_call_necessities_on_necessity_id" + t.index ["necessity_id"], name: "index_call_necessities_on_necessity_id" + end - create_table "call_protection_concerns", force: :cascade do |t| - t.integer "call_id" - t.integer "protection_concern_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "call_protection_concerns", id: :serial, force: :cascade do |t| + t.integer "call_id" + t.integer "protection_concern_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["call_id"], name: "index_call_protection_concerns_on_call_id" + t.index ["call_id"], name: "index_call_protection_concerns_on_call_id" + t.index ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id" + t.index ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id" end - add_index "call_protection_concerns", ["call_id"], name: "index_call_protection_concerns_on_call_id", using: :btree - add_index "call_protection_concerns", ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id", using: :btree + create_table "call_protection_concerns", id: :serial, force: :cascade do |t| + t.integer "call_id" + t.integer "protection_concern_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["call_id"], name: "index_call_protection_concerns_on_call_id" + t.index ["call_id"], name: "index_call_protection_concerns_on_call_id" + t.index ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id" + t.index ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id" + end - create_table "calls", force: :cascade do |t| - t.integer "referee_id" - t.string "phone_call_id", default: "" - t.integer "receiving_staff_id" + create_table "calls", id: :serial, force: :cascade do |t| + t.integer "referee_id" + t.string "phone_call_id", default: "" + t.integer "receiving_staff_id" t.datetime "start_datetime" - t.string "call_type", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "information_provided", default: "" - t.date "date_of_call" - t.boolean "answered_call" - t.boolean "called_before" - t.boolean "requested_update", default: false - t.boolean "not_a_phone_call", default: false - t.boolean "childsafe_agent" - t.string "other_more_information", default: "" - t.string "brief_note_summary", default: "" - end - - add_index "calls", ["referee_id"], name: "index_calls_on_referee_id", using: :btree - - create_table "carers", force: :cascade do |t| - t.string "address_type", default: "" - t.string "current_address", default: "" - t.string "email", default: "" - t.string "gender", default: "" - t.string "house_number", default: "" - t.string "outside_address", default: "" - t.string "street_number", default: "" - t.string "client_relationship", default: "" - t.boolean "outside", default: false - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name", default: "" - t.string "phone", default: "" - t.boolean "same_as_client", default: false - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "state_id" - t.integer "township_id" - t.integer "subdistrict_id" - t.string "locality" - end - - add_index "carers", ["commune_id"], name: "index_carers_on_commune_id", using: :btree - add_index "carers", ["district_id"], name: "index_carers_on_district_id", using: :btree - add_index "carers", ["province_id"], name: "index_carers_on_province_id", using: :btree - add_index "carers", ["state_id"], name: "index_carers_on_state_id", using: :btree - add_index "carers", ["subdistrict_id"], name: "index_carers_on_subdistrict_id", using: :btree - add_index "carers", ["township_id"], name: "index_carers_on_township_id", using: :btree - add_index "carers", ["village_id"], name: "index_carers_on_village_id", using: :btree - - create_table "case_closures", force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "case_contracts", force: :cascade do |t| - t.date "signed_on" - t.integer "case_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "case_contracts", ["case_id"], name: "index_case_contracts_on_case_id", using: :btree - - create_table "case_note_domain_groups", force: :cascade do |t| - t.text "note", default: "" - t.integer "case_note_id" - t.integer "domain_group_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "attachments", default: [], array: true - end - - create_table "case_notes", force: :cascade do |t| - t.string "attendee", default: "" - t.datetime "meeting_date" - t.integer "assessment_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "client_id" - t.string "interaction_type", default: "" - t.boolean "custom", default: false - t.text "note", default: "" - t.integer "custom_assessment_setting_id" - t.string "selected_domain_group_ids", default: [], array: true + t.string "call_type", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "information_provided", default: "" + t.date "date_of_call" + t.boolean "answered_call" + t.boolean "called_before" + t.boolean "requested_update", default: false + t.boolean "not_a_phone_call", default: false + t.boolean "childsafe_agent" + t.string "other_more_information", default: "" + t.string "brief_note_summary", default: "" + t.index ["referee_id"], name: "index_calls_on_referee_id" + t.index ["referee_id"], name: "index_calls_on_referee_id" + end + + create_table "calls", id: :serial, force: :cascade do |t| + t.integer "referee_id" + t.string "phone_call_id", default: "" + t.integer "receiving_staff_id" + t.datetime "start_datetime" + t.string "call_type", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "information_provided", default: "" + t.date "date_of_call" + t.boolean "answered_call" + t.boolean "called_before" + t.boolean "requested_update", default: false + t.boolean "not_a_phone_call", default: false + t.boolean "childsafe_agent" + t.string "other_more_information", default: "" + t.string "brief_note_summary", default: "" + t.index ["referee_id"], name: "index_calls_on_referee_id" + t.index ["referee_id"], name: "index_calls_on_referee_id" + end + + create_table "carers", id: :serial, force: :cascade do |t| + t.string "address_type", default: "" + t.string "current_address", default: "" + t.string "email", default: "" + t.string "gender", default: "" + t.string "house_number", default: "" + t.string "outside_address", default: "" + t.string "street_number", default: "" + t.string "client_relationship", default: "" + t.boolean "outside", default: false + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name", default: "" + t.string "phone", default: "" + t.boolean "same_as_client", default: false + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "state_id" + t.integer "township_id" + t.integer "subdistrict_id" + t.string "locality" + t.index ["commune_id"], name: "index_carers_on_commune_id" + t.index ["commune_id"], name: "index_carers_on_commune_id" + t.index ["district_id"], name: "index_carers_on_district_id" + t.index ["district_id"], name: "index_carers_on_district_id" + t.index ["province_id"], name: "index_carers_on_province_id" + t.index ["province_id"], name: "index_carers_on_province_id" + t.index ["state_id"], name: "index_carers_on_state_id" + t.index ["state_id"], name: "index_carers_on_state_id" + t.index ["subdistrict_id"], name: "index_carers_on_subdistrict_id" + t.index ["subdistrict_id"], name: "index_carers_on_subdistrict_id" + t.index ["township_id"], name: "index_carers_on_township_id" + t.index ["township_id"], name: "index_carers_on_township_id" + t.index ["village_id"], name: "index_carers_on_village_id" + t.index ["village_id"], name: "index_carers_on_village_id" + end + + create_table "carers", id: :serial, force: :cascade do |t| + t.string "address_type", default: "" + t.string "current_address", default: "" + t.string "email", default: "" + t.string "gender", default: "" + t.string "house_number", default: "" + t.string "outside_address", default: "" + t.string "street_number", default: "" + t.string "client_relationship", default: "" + t.boolean "outside", default: false + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name", default: "" + t.string "phone", default: "" + t.boolean "same_as_client", default: false + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "state_id" + t.integer "township_id" + t.integer "subdistrict_id" + t.string "locality" + t.index ["commune_id"], name: "index_carers_on_commune_id" + t.index ["commune_id"], name: "index_carers_on_commune_id" + t.index ["district_id"], name: "index_carers_on_district_id" + t.index ["district_id"], name: "index_carers_on_district_id" + t.index ["province_id"], name: "index_carers_on_province_id" + t.index ["province_id"], name: "index_carers_on_province_id" + t.index ["state_id"], name: "index_carers_on_state_id" + t.index ["state_id"], name: "index_carers_on_state_id" + t.index ["subdistrict_id"], name: "index_carers_on_subdistrict_id" + t.index ["subdistrict_id"], name: "index_carers_on_subdistrict_id" + t.index ["township_id"], name: "index_carers_on_township_id" + t.index ["township_id"], name: "index_carers_on_township_id" + t.index ["village_id"], name: "index_carers_on_village_id" + t.index ["village_id"], name: "index_carers_on_village_id" + end + + create_table "case_closures", id: :serial, force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "case_notes", ["client_id"], name: "index_case_notes_on_client_id", using: :btree - add_index "case_notes", ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id", using: :btree - - create_table "case_worker_clients", force: :cascade do |t| - t.integer "user_id" - t.integer "client_id" - t.datetime "created_at" - t.datetime "updated_at" + create_table "case_closures", id: :serial, force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "case_worker_clients", ["client_id"], name: "index_case_worker_clients_on_client_id", using: :btree - add_index "case_worker_clients", ["user_id"], name: "index_case_worker_clients_on_user_id", using: :btree - - create_table "case_worker_tasks", force: :cascade do |t| - t.integer "user_id" - t.integer "task_id" + create_table "case_contracts", id: :serial, force: :cascade do |t| + t.date "signed_on" + t.integer "case_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["case_id"], name: "index_case_contracts_on_case_id" + t.index ["case_id"], name: "index_case_contracts_on_case_id" end - add_index "case_worker_tasks", ["task_id"], name: "index_case_worker_tasks_on_task_id", using: :btree - add_index "case_worker_tasks", ["user_id"], name: "index_case_worker_tasks_on_user_id", using: :btree - - create_table "cases", force: :cascade do |t| - t.date "start_date" - t.string "carer_names", default: "" - t.string "carer_address", default: "" - t.string "carer_phone_number", default: "" - t.float "support_amount", default: 0.0 - t.text "support_note", default: "" - t.text "case_type", default: "EC" - t.boolean "exited", default: false - t.date "exit_date" - t.text "exit_note", default: "" - t.integer "user_id" - t.integer "client_id" - t.integer "family_id" - t.integer "partner_id" - t.integer "province_id" + create_table "case_contracts", id: :serial, force: :cascade do |t| + t.date "signed_on" + t.integer "case_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "family_preservation", default: false - t.string "status", default: "" - t.date "placement_date" - t.date "initial_assessment_date" - t.float "case_length" - t.date "case_conference_date" - t.float "time_in_care" - t.boolean "exited_from_cif", default: false - t.boolean "current", default: true - t.datetime "deleted_at" + t.index ["case_id"], name: "index_case_contracts_on_case_id" + t.index ["case_id"], name: "index_case_contracts_on_case_id" end - add_index "cases", ["deleted_at"], name: "index_cases_on_deleted_at", using: :btree - - create_table "changelog_types", force: :cascade do |t| - t.integer "changelog_id" - t.string "change_type", default: "" - t.string "description", default: "" + create_table "case_note_domain_groups", id: :serial, force: :cascade do |t| + t.text "note", default: "" + t.integer "case_note_id" + t.integer "domain_group_id" t.datetime "created_at" t.datetime "updated_at" + t.string "attachments", default: [], array: true end - add_index "changelog_types", ["changelog_id"], name: "index_changelog_types_on_changelog_id", using: :btree - - create_table "changelogs", force: :cascade do |t| - t.string "change_version", default: "" - t.string "description", default: "" - t.integer "user_id" + create_table "case_note_domain_groups", id: :serial, force: :cascade do |t| + t.text "note", default: "" + t.integer "case_note_id" + t.integer "domain_group_id" t.datetime "created_at" t.datetime "updated_at" + t.string "attachments", default: [], array: true end - add_index "changelogs", ["user_id"], name: "index_changelogs_on_user_id", using: :btree - - create_table "children_plans", force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "client_client_types", force: :cascade do |t| - t.integer "client_id" - t.integer "client_type_id" + create_table "case_notes", id: :serial, force: :cascade do |t| + t.string "attendee", default: "" + t.datetime "meeting_date" + t.integer "assessment_id" t.datetime "created_at" t.datetime "updated_at" - end - - add_index "client_client_types", ["client_id"], name: "index_client_client_types_on_client_id", using: :btree - add_index "client_client_types", ["client_type_id"], name: "index_client_client_types_on_client_type_id", using: :btree - - create_table "client_enrollment_trackings", force: :cascade do |t| - t.jsonb "properties", default: {} - t.integer "client_enrollment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "tracking_id" - end - - add_index "client_enrollment_trackings", ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id", using: :btree - - create_table "client_enrollments", force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "status", default: "Active" - t.integer "client_id" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.date "enrollment_date" - t.datetime "deleted_at" - end - - add_index "client_enrollments", ["client_id"], name: "index_client_enrollments_on_client_id", using: :btree - add_index "client_enrollments", ["deleted_at"], name: "index_client_enrollments_on_deleted_at", using: :btree - add_index "client_enrollments", ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id", using: :btree - - create_table "client_interviewees", force: :cascade do |t| - t.integer "client_id" - t.integer "interviewee_id" + t.integer "client_id" + t.string "interaction_type", default: "" + t.boolean "custom", default: false + t.text "note", default: "" + t.integer "custom_assessment_setting_id" + t.string "selected_domain_group_ids", default: [], array: true + t.index ["client_id"], name: "index_case_notes_on_client_id" + t.index ["client_id"], name: "index_case_notes_on_client_id" + t.index ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id" + t.index ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id" + end + + create_table "case_notes", id: :serial, force: :cascade do |t| + t.string "attendee", default: "" + t.datetime "meeting_date" + t.integer "assessment_id" t.datetime "created_at" t.datetime "updated_at" - end - - add_index "client_interviewees", ["client_id"], name: "index_client_interviewees_on_client_id", using: :btree - add_index "client_interviewees", ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id", using: :btree - - create_table "client_needs", force: :cascade do |t| - t.integer "rank" - t.integer "client_id" - t.integer "need_id" + t.integer "client_id" + t.string "interaction_type", default: "" + t.boolean "custom", default: false + t.text "note", default: "" + t.integer "custom_assessment_setting_id" + t.string "selected_domain_group_ids", default: [], array: true + t.index ["client_id"], name: "index_case_notes_on_client_id" + t.index ["client_id"], name: "index_case_notes_on_client_id" + t.index ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id" + t.index ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id" + end + + create_table "case_worker_clients", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_case_worker_clients_on_client_id" + t.index ["client_id"], name: "index_case_worker_clients_on_client_id" + t.index ["user_id"], name: "index_case_worker_clients_on_user_id" + t.index ["user_id"], name: "index_case_worker_clients_on_user_id" end - add_index "client_needs", ["client_id"], name: "index_client_needs_on_client_id", using: :btree - add_index "client_needs", ["need_id"], name: "index_client_needs_on_need_id", using: :btree - - create_table "client_problems", force: :cascade do |t| - t.integer "rank" - t.integer "client_id" - t.integer "problem_id" + create_table "case_worker_clients", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_case_worker_clients_on_client_id" + t.index ["client_id"], name: "index_case_worker_clients_on_client_id" + t.index ["user_id"], name: "index_case_worker_clients_on_user_id" + t.index ["user_id"], name: "index_case_worker_clients_on_user_id" end - add_index "client_problems", ["client_id"], name: "index_client_problems_on_client_id", using: :btree - add_index "client_problems", ["problem_id"], name: "index_client_problems_on_problem_id", using: :btree - - create_table "client_quantitative_cases", force: :cascade do |t| - t.integer "quantitative_case_id" - t.integer "client_id" + create_table "case_worker_tasks", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "task_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["task_id"], name: "index_case_worker_tasks_on_task_id" + t.index ["task_id"], name: "index_case_worker_tasks_on_task_id" + t.index ["user_id"], name: "index_case_worker_tasks_on_user_id" + t.index ["user_id"], name: "index_case_worker_tasks_on_user_id" end - create_table "client_right_government_forms", force: :cascade do |t| - t.integer "government_form_id" - t.integer "client_right_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "client_right_government_forms", ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id", using: :btree - add_index "client_right_government_forms", ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id", using: :btree - - create_table "client_rights", force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "client_type_government_forms", force: :cascade do |t| - t.integer "client_type_id" - t.integer "government_form_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "client_type_government_forms", ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id", using: :btree - add_index "client_type_government_forms", ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id", using: :btree - - create_table "client_types", force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "clients", force: :cascade do |t| - t.string "code", default: "" - t.string "given_name", default: "" - t.string "family_name", default: "" - t.string "gender", default: "" - t.date "date_of_birth" - t.string "status", default: "Referred" - t.date "initial_referral_date" - t.string "referral_phone", default: "" - t.integer "birth_province_id" - t.integer "received_by_id" - t.integer "followed_up_by_id" - t.date "follow_up_date" - t.string "current_address", default: "" - t.string "school_name", default: "" - t.string "school_grade", default: "" - t.boolean "has_been_in_orphanage" - t.boolean "able", default: false - t.boolean "has_been_in_government_care" - t.text "relevant_referral_information", default: "" - t.string "archive_state", default: "" - t.text "rejected_note", default: "" - t.integer "province_id" - t.integer "referral_source_id" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "completed", default: false - t.text "reason_for_referral", default: "" - t.boolean "is_receiving_additional_benefits", default: false - t.text "background", default: "" - t.integer "grade" - t.string "slug" - t.string "able_state", default: "" - t.integer "donor_id" - t.string "local_given_name", default: "" - t.string "local_family_name", default: "" - t.string "kid_id", default: "" - t.string "house_number", default: "" - t.string "street_number", default: "" - t.string "old_village", default: "" - t.string "old_commune", default: "" - t.string "archive_district", default: "" - t.string "live_with", default: "" - t.integer "id_poor" - t.integer "rice_support", default: 0 - t.text "exit_note", default: "" - t.date "exit_date" - t.date "accepted_date" - t.string "gov_city", default: "" - t.string "gov_commune", default: "" - t.string "gov_district", default: "" - t.date "gov_date" - t.string "gov_village_code", default: "" - t.string "gov_client_code", default: "" - t.string "gov_interview_village", default: "" - t.string "gov_interview_commune", default: "" - t.string "gov_interview_district", default: "" - t.string "gov_interview_city", default: "" - t.string "gov_caseworker_name", default: "" - t.string "gov_caseworker_phone", default: "" - t.string "gov_carer_name", default: "" - t.string "gov_carer_relationship", default: "" - t.string "gov_carer_home", default: "" - t.string "gov_carer_street", default: "" - t.string "gov_carer_village", default: "" - t.string "gov_carer_commune", default: "" - t.string "gov_carer_district", default: "" - t.string "gov_carer_city", default: "" - t.string "gov_carer_phone", default: "" - t.string "gov_information_source", default: "" - t.text "gov_referral_reason", default: "" - t.text "gov_guardian_comment", default: "" - t.text "gov_caseworker_comment", default: "" - t.integer "district_id" - t.string "telephone_number", default: "" - t.string "name_of_referee", default: "" - t.string "main_school_contact", default: "" - t.string "rated_for_id_poor", default: "" - t.string "what3words", default: "" - t.string "exit_reasons", default: [], array: true - t.string "exit_circumstance", default: "" - t.string "other_info_of_exit", default: "" - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "subdistrict_id" - t.integer "township_id" - t.integer "state_id" - t.string "country_origin", default: "" - t.integer "commune_id" - t.integer "village_id" - t.string "profile" - t.integer "referral_source_category_id" - t.string "archived_slug" - t.integer "assessments_count", default: 0, null: false - t.integer "current_family_id" - t.boolean "outside", default: false - t.string "outside_address", default: "" - t.string "address_type", default: "" - t.string "client_phone", default: "" - t.string "phone_owner", default: "" - t.string "client_email", default: "" - t.string "referee_relationship", default: "" - t.integer "referee_id" - t.integer "carer_id" - t.string "nickname", default: "" - t.string "relation_to_referee", default: "" - t.boolean "concern_is_outside", default: false - t.string "concern_outside_address", default: "" - t.integer "concern_province_id" - t.integer "concern_district_id" - t.integer "concern_commune_id" - t.integer "concern_village_id" - t.string "concern_street", default: "" - t.string "concern_house", default: "" - t.string "concern_address", default: "" - t.string "concern_address_type", default: "" - t.string "concern_phone", default: "" - t.string "concern_phone_owner", default: "" - t.string "concern_email", default: "" - t.string "concern_email_owner", default: "" - t.string "concern_location", default: "" - t.boolean "concern_same_as_client", default: false - t.string "location_description", default: "" - t.string "phone_counselling_summary", default: "" - t.string "presented_id" - t.string "id_number" - t.string "other_phone_number" - t.string "brsc_branch" - t.string "current_island" - t.string "current_street" - t.string "current_po_box" - t.string "current_city" - t.string "current_settlement" - t.string "current_resident_own_or_rent" - t.string "current_household_type" - t.string "island2" - t.string "street2" - t.string "po_box2" - t.string "city2" - t.string "settlement2" - t.string "resident_own_or_rent2" - t.string "household_type2" - t.string "legacy_brcs_id" - t.boolean "whatsapp", default: false - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - t.boolean "other_phone_whatsapp", default: false - t.string "preferred_language", default: "English" - t.boolean "national_id", default: false, null: false - t.boolean "birth_cert", default: false, null: false - t.boolean "family_book", default: false, null: false - t.boolean "passport", default: false, null: false - t.boolean "travel_doc", default: false, null: false - t.boolean "referral_doc", default: false, null: false - t.boolean "local_consent", default: false, null: false - t.boolean "police_interview", default: false, null: false - t.boolean "other_legal_doc", default: false, null: false - t.string "national_id_files", default: [], array: true - t.string "birth_cert_files", default: [], array: true - t.string "family_book_files", default: [], array: true - t.string "passport_files", default: [], array: true - t.string "travel_doc_files", default: [], array: true - t.string "referral_doc_files", default: [], array: true - t.string "local_consent_files", default: [], array: true - t.string "police_interview_files", default: [], array: true - t.string "other_legal_doc_files", default: [], array: true - t.string "global_id" - t.boolean "referred_external", default: false - t.string "marital_status" - t.string "nationality" - t.string "ethnicity" - t.string "location_of_concern" - t.string "type_of_trafficking" - t.text "education_background" - t.string "department" - t.string "neighbor_name" - t.string "neighbor_phone" - t.string "dosavy_name" - t.string "dosavy_phone" - t.string "chief_commune_name" - t.string "chief_commune_phone" - t.string "chief_village_name" - t.string "chief_village_phone" - t.string "ccwc_name" - t.string "ccwc_phone" - t.string "legal_team_name" - t.string "legal_representative_name" - t.string "legal_team_phone" - t.string "other_agency_name" - t.string "other_representative_name" - t.string "other_agency_phone" - t.string "locality" - t.string "national_id_number" - t.string "passport_number" - end - - add_index "clients", ["commune_id"], name: "index_clients_on_commune_id", using: :btree - add_index "clients", ["current_family_id"], name: "index_clients_on_current_family_id", using: :btree - add_index "clients", ["district_id"], name: "index_clients_on_district_id", using: :btree - add_index "clients", ["donor_id"], name: "index_clients_on_donor_id", using: :btree - add_index "clients", ["external_id"], name: "index_clients_on_external_id", using: :btree - add_index "clients", ["global_id"], name: "index_clients_on_global_id", using: :btree - add_index "clients", ["mosvy_number"], name: "index_clients_on_mosvy_number", using: :btree - add_index "clients", ["slug"], name: "index_clients_on_slug", unique: true, using: :btree - add_index "clients", ["state_id"], name: "index_clients_on_state_id", using: :btree - add_index "clients", ["subdistrict_id"], name: "index_clients_on_subdistrict_id", using: :btree - add_index "clients", ["township_id"], name: "index_clients_on_township_id", using: :btree - add_index "clients", ["village_id"], name: "index_clients_on_village_id", using: :btree - - create_table "clients_quantitative_cases", force: :cascade do |t| - t.integer "client_id" - t.integer "quantitative_case_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "communes", force: :cascade do |t| - t.string "code", default: "" - t.string "name_kh", default: "" - t.string "name_en", default: "" - t.integer "district_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "district_type" - end - - add_index "communes", ["district_id"], name: "index_communes_on_district_id", using: :btree - - create_table "custom_assessment_settings", force: :cascade do |t| - t.string "custom_assessment_name", default: "Custom Assessment" - t.integer "max_custom_assessment", default: 6 - t.string "custom_assessment_frequency", default: "month" - t.integer "custom_age", default: 18 - t.integer "setting_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "enable_custom_assessment", default: false - end - - create_table "custom_field_permissions", force: :cascade do |t| - t.integer "user_id" - t.integer "custom_field_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "custom_field_permissions", ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id", using: :btree - add_index "custom_field_permissions", ["user_id"], name: "index_custom_field_permissions_on_user_id", using: :btree - - create_table "custom_field_properties", force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "custom_formable_type" - t.integer "custom_formable_id" - t.integer "custom_field_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.jsonb "attachments" - t.integer "user_id" - end - - add_index "custom_field_properties", ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id", using: :btree - - create_table "custom_fields", force: :cascade do |t| - t.string "entity_type", default: "" - t.text "properties", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "form_title", default: "" - t.string "frequency", default: "" - t.integer "time_of_frequency", default: 0 - t.string "ngo_name", default: "" - t.jsonb "fields" - end - - create_table "departments", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" + create_table "case_worker_tasks", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "task_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "users_count", default: 0 - end - - create_table "districts", force: :cascade do |t| - t.string "name" - t.integer "province_id" - t.string "code", default: "" + t.index ["task_id"], name: "index_case_worker_tasks_on_task_id" + t.index ["task_id"], name: "index_case_worker_tasks_on_task_id" + t.index ["user_id"], name: "index_case_worker_tasks_on_user_id" + t.index ["user_id"], name: "index_case_worker_tasks_on_user_id" + end + + create_table "cases", id: :serial, force: :cascade do |t| + t.date "start_date" + t.string "carer_names", default: "" + t.string "carer_address", default: "" + t.string "carer_phone_number", default: "" + t.float "support_amount", default: 0.0 + t.text "support_note", default: "" + t.text "case_type", default: "EC" + t.boolean "exited", default: false + t.date "exit_date" + t.text "exit_note", default: "" + t.integer "user_id" + t.integer "client_id" + t.integer "family_id" + t.integer "partner_id" + t.integer "province_id" t.datetime "created_at" t.datetime "updated_at" - end - - add_index "districts", ["province_id"], name: "index_districts_on_province_id", using: :btree - - create_table "domain_groups", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" + t.boolean "family_preservation", default: false + t.string "status", default: "" + t.date "placement_date" + t.date "initial_assessment_date" + t.float "case_length" + t.date "case_conference_date" + t.float "time_in_care" + t.boolean "exited_from_cif", default: false + t.boolean "current", default: true + t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_cases_on_deleted_at" + t.index ["deleted_at"], name: "index_cases_on_deleted_at" + end + + create_table "cases", id: :serial, force: :cascade do |t| + t.date "start_date" + t.string "carer_names", default: "" + t.string "carer_address", default: "" + t.string "carer_phone_number", default: "" + t.float "support_amount", default: 0.0 + t.text "support_note", default: "" + t.text "case_type", default: "EC" + t.boolean "exited", default: false + t.date "exit_date" + t.text "exit_note", default: "" + t.integer "user_id" + t.integer "client_id" + t.integer "family_id" + t.integer "partner_id" + t.integer "province_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "domains_count", default: 0 - end - - create_table "domain_program_streams", force: :cascade do |t| - t.integer "program_stream_id" - t.integer "domain_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.boolean "family_preservation", default: false + t.string "status", default: "" + t.date "placement_date" + t.date "initial_assessment_date" + t.float "case_length" + t.date "case_conference_date" + t.float "time_in_care" + t.boolean "exited_from_cif", default: false + t.boolean "current", default: true t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_cases_on_deleted_at" + t.index ["deleted_at"], name: "index_cases_on_deleted_at" end - add_index "domain_program_streams", ["deleted_at"], name: "index_domain_program_streams_on_deleted_at", using: :btree - - create_table "domains", force: :cascade do |t| - t.string "name", default: "" - t.string "identity", default: "" - t.text "description", default: "" - t.integer "domain_group_id" + create_table "changelog_types", id: :serial, force: :cascade do |t| + t.integer "changelog_id" + t.string "change_type", default: "" + t.string "description", default: "" t.datetime "created_at" t.datetime "updated_at" - t.integer "tasks_count", default: 0 - t.string "score_1_color", default: "danger" - t.string "score_2_color", default: "warning" - t.string "score_3_color", default: "info" - t.string "score_4_color", default: "primary" - t.text "score_1_definition", default: "" - t.text "score_2_definition", default: "" - t.text "score_3_definition", default: "" - t.text "score_4_definition", default: "" - t.boolean "custom_domain", default: false - t.text "local_description", default: "" - t.text "score_1_local_definition", default: "" - t.text "score_2_local_definition", default: "" - t.text "score_3_local_definition", default: "" - t.text "score_4_local_definition", default: "" - t.integer "custom_assessment_setting_id" - end - - add_index "domains", ["domain_group_id"], name: "index_domains_on_domain_group_id", using: :btree - - create_table "donor_organizations", force: :cascade do |t| - t.integer "donor_id" - t.integer "organization_id" + t.index ["changelog_id"], name: "index_changelog_types_on_changelog_id" + t.index ["changelog_id"], name: "index_changelog_types_on_changelog_id" end - add_index "donor_organizations", ["donor_id"], name: "index_donor_organizations_on_donor_id", using: :btree - add_index "donor_organizations", ["organization_id"], name: "index_donor_organizations_on_organization_id", using: :btree - - create_table "donors", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "code", default: "" - t.string "global_id", limit: 32, default: "", null: false + create_table "changelog_types", id: :serial, force: :cascade do |t| + t.integer "changelog_id" + t.string "change_type", default: "" + t.string "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["changelog_id"], name: "index_changelog_types_on_changelog_id" + t.index ["changelog_id"], name: "index_changelog_types_on_changelog_id" end - add_index "donors", ["global_id"], name: "index_donors_on_global_id", using: :btree - - create_table "enter_ngo_users", force: :cascade do |t| + create_table "changelogs", id: :serial, force: :cascade do |t| + t.string "change_version", default: "" + t.string "description", default: "" t.integer "user_id" - t.integer "enter_ngo_id" - end - - add_index "enter_ngo_users", ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id", using: :btree - add_index "enter_ngo_users", ["user_id"], name: "index_enter_ngo_users_on_user_id", using: :btree - - create_table "enter_ngos", force: :cascade do |t| - t.date "accepted_date" - t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" - t.datetime "deleted_at" + t.index ["user_id"], name: "index_changelogs_on_user_id" + t.index ["user_id"], name: "index_changelogs_on_user_id" end - add_index "enter_ngos", ["client_id"], name: "index_enter_ngos_on_client_id", using: :btree - add_index "enter_ngos", ["deleted_at"], name: "index_enter_ngos_on_deleted_at", using: :btree - - create_table "exit_ngos", force: :cascade do |t| - t.integer "client_id" - t.string "exit_circumstance", default: "" - t.string "other_info_of_exit", default: "" - t.string "exit_reasons", default: [], array: true - t.text "exit_note", default: "" - t.date "exit_date" + create_table "changelogs", id: :serial, force: :cascade do |t| + t.string "change_version", default: "" + t.string "description", default: "" + t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.datetime "deleted_at" + t.index ["user_id"], name: "index_changelogs_on_user_id" + t.index ["user_id"], name: "index_changelogs_on_user_id" end - add_index "exit_ngos", ["client_id"], name: "index_exit_ngos_on_client_id", using: :btree - add_index "exit_ngos", ["deleted_at"], name: "index_exit_ngos_on_deleted_at", using: :btree - - create_table "external_system_global_identities", force: :cascade do |t| - t.integer "external_system_id" - t.string "global_id" - t.string "external_id" - t.string "client_slug" - t.string "organization_name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "children_plans", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "external_system_global_identities", ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id", using: :btree - add_index "external_system_global_identities", ["global_id"], name: "index_external_system_global_identities_on_global_id", using: :btree - - create_table "external_systems", force: :cascade do |t| - t.string "name" - t.string "url" - t.string "token" + create_table "children_plans", id: :serial, force: :cascade do |t| + t.string "name", default: "" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "families", force: :cascade do |t| - t.string "code" - t.string "name", default: "" - t.string "address", default: "" - t.text "caregiver_information", default: "" - t.integer "significant_family_member_count", default: 1 - t.float "household_income", default: 0.0 - t.boolean "dependable_income", default: false - t.integer "female_children_count", default: 0 - t.integer "male_children_count", default: 0 - t.integer "female_adult_count", default: 0 - t.integer "male_adult_count", default: 0 - t.string "family_type", default: "kinship" - t.date "contract_date" - t.integer "province_id" + create_table "client_client_types", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "client_type_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.string "case_history", default: "" - t.datetime "deleted_at" - t.integer "children", default: [], array: true - t.string "status", default: "" - t.integer "district_id" - t.string "old_commune", default: "" - t.string "old_village", default: "" - t.string "house", default: "" - t.string "street", default: "" - t.integer "commune_id" - t.integer "village_id" - t.integer "user_id" - end - - add_index "families", ["commune_id"], name: "index_families_on_commune_id", using: :btree - add_index "families", ["deleted_at"], name: "index_families_on_deleted_at", using: :btree - add_index "families", ["district_id"], name: "index_families_on_district_id", using: :btree - add_index "families", ["user_id"], name: "index_families_on_user_id", using: :btree - add_index "families", ["village_id"], name: "index_families_on_village_id", using: :btree - - create_table "family_members", force: :cascade do |t| - t.string "adult_name", default: "" - t.date "date_of_birth" - t.string "occupation", default: "" - t.string "relation", default: "" - t.integer "family_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "guardian", default: false - t.string "gender" - t.text "note" - end - - add_index "family_members", ["family_id"], name: "index_family_members_on_family_id", using: :btree - - create_table "family_plans", force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "priority" - end - - create_table "field_setting_translations", force: :cascade do |t| - t.integer "field_setting_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "label" - end - - add_index "field_setting_translations", ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id", using: :btree - add_index "field_setting_translations", ["locale"], name: "index_field_setting_translations_on_locale", using: :btree - - create_table "field_settings", force: :cascade do |t| - t.string "name", null: false - t.string "group", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "type", default: "field", null: false - t.boolean "visible", default: true, null: false - t.string "current_label" - t.boolean "required", default: false - t.string "klass_name" - t.string "for_instances" - t.boolean "label_only", default: false - end - - create_table "form_builder_attachments", force: :cascade do |t| - t.string "name", default: "" - t.jsonb "file", default: [] - t.string "form_buildable_type" - t.integer "form_buildable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "friendly_id_slugs", force: :cascade do |t| - t.string "slug", null: false - t.integer "sluggable_id", null: false - t.string "sluggable_type", limit: 50 - t.string "scope" - t.datetime "created_at" - end - - add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree - add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree - add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree - add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree - - create_table "global_identities", id: false, force: :cascade do |t| - t.string "ulid" + t.index ["client_id"], name: "index_client_client_types_on_client_id" + t.index ["client_id"], name: "index_client_client_types_on_client_id" + t.index ["client_type_id"], name: "index_client_client_types_on_client_type_id" + t.index ["client_type_id"], name: "index_client_client_types_on_client_type_id" end - add_index "global_identities", ["ulid"], name: "index_global_identities_on_ulid", unique: true, using: :btree - - create_table "global_identity_organizations", force: :cascade do |t| - t.string "global_id" - t.integer "organization_id" + create_table "client_client_types", id: :serial, force: :cascade do |t| t.integer "client_id" + t.integer "client_type_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["client_id"], name: "index_client_client_types_on_client_id" + t.index ["client_id"], name: "index_client_client_types_on_client_id" + t.index ["client_type_id"], name: "index_client_client_types_on_client_type_id" + t.index ["client_type_id"], name: "index_client_client_types_on_client_type_id" end - add_index "global_identity_organizations", ["client_id"], name: "index_global_identity_organizations_on_client_id", using: :btree - add_index "global_identity_organizations", ["global_id"], name: "index_global_identity_organizations_on_global_id", using: :btree - add_index "global_identity_organizations", ["organization_id"], name: "index_global_identity_organizations_on_organization_id", using: :btree - - create_table "global_identity_tmp", force: :cascade do |t| - t.binary "ulid" - t.string "ngo_name" - t.integer "client_id" + create_table "client_enrollment_trackings", id: :serial, force: :cascade do |t| + t.jsonb "properties", default: {} + t.integer "client_enrollment_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "tracking_id" + t.index ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id" + t.index ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id" end - create_table "global_services", id: false, force: :cascade do |t| - t.uuid "uuid" + create_table "client_enrollment_trackings", id: :serial, force: :cascade do |t| + t.jsonb "properties", default: {} + t.integer "client_enrollment_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "tracking_id" + t.index ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id" + t.index ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id" end - add_index "global_services", ["uuid"], name: "index_global_services_on_uuid", unique: true, using: :btree - - create_table "government_form_children_plans", force: :cascade do |t| - t.text "goal", default: "" - t.text "action", default: "" - t.text "who", default: "" - t.integer "government_form_id" - t.integer "children_plan_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "score" - t.text "comment", default: "" - t.date "completion_date" + create_table "client_enrollments", id: :serial, force: :cascade do |t| + t.jsonb "properties", default: {} + t.string "status", default: "Active" + t.integer "client_id" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.date "enrollment_date" + t.datetime "deleted_at" + t.index ["client_id"], name: "index_client_enrollments_on_client_id" + t.index ["client_id"], name: "index_client_enrollments_on_client_id" + t.index ["deleted_at"], name: "index_client_enrollments_on_deleted_at" + t.index ["deleted_at"], name: "index_client_enrollments_on_deleted_at" + t.index ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id" + t.index ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id" end - add_index "government_form_children_plans", ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id", using: :btree - add_index "government_form_children_plans", ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id", using: :btree - - create_table "government_form_family_plans", force: :cascade do |t| - t.text "goal", default: "" - t.text "action", default: "" - t.text "result", default: "" - t.integer "government_form_id" - t.integer "family_plan_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "score" - t.text "comment", default: "" - end - - add_index "government_form_family_plans", ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id", using: :btree - add_index "government_form_family_plans", ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id", using: :btree - - create_table "government_form_interviewees", force: :cascade do |t| - t.integer "government_form_id" - t.integer "interviewee_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "government_form_interviewees", ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id", using: :btree - add_index "government_form_interviewees", ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id", using: :btree - - create_table "government_form_needs", force: :cascade do |t| - t.integer "rank" - t.integer "need_id" - t.integer "government_form_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "government_form_needs", ["government_form_id"], name: "index_government_form_needs_on_government_form_id", using: :btree - add_index "government_form_needs", ["need_id"], name: "index_government_form_needs_on_need_id", using: :btree - - create_table "government_form_problems", force: :cascade do |t| - t.integer "rank" - t.integer "problem_id" - t.integer "government_form_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "government_form_problems", ["government_form_id"], name: "index_government_form_problems_on_government_form_id", using: :btree - add_index "government_form_problems", ["problem_id"], name: "index_government_form_problems_on_problem_id", using: :btree - - create_table "government_form_service_types", force: :cascade do |t| - t.integer "government_form_id" - t.integer "service_type_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "government_form_service_types", ["government_form_id"], name: "index_government_form_service_types_on_government_form_id", using: :btree - add_index "government_form_service_types", ["service_type_id"], name: "index_government_form_service_types_on_service_type_id", using: :btree - - create_table "government_forms", force: :cascade do |t| - t.string "name", default: "" - t.date "date" - t.string "client_code", default: "" - t.integer "interview_district_id" - t.integer "interview_province_id" - t.integer "case_worker_id" - t.string "case_worker_phone", default: "" - t.integer "client_id" - t.string "primary_carer_relationship", default: "" - t.string "primary_carer_house", default: "" - t.string "primary_carer_street", default: "" - t.integer "primary_carer_district_id" - t.integer "primary_carer_province_id" - t.text "source_info", default: "" - t.text "summary_info_of_referral", default: "" - t.text "guardian_comment", default: "" - t.text "case_worker_comment", default: "" - t.string "other_interviewee", default: "" - t.string "other_client_type", default: "" - t.string "other_need", default: "" - t.string "other_problem", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.string "caseworker_assumption", default: "" - t.text "assumption_description", default: "" - t.date "assumption_date" - t.string "contact_type", default: "" - t.string "client_decision", default: "" - t.string "other_service_type", default: "" - t.date "gov_placement_date" - t.string "care_type", default: "" - t.string "primary_carer", default: "" - t.string "secondary_carer", default: "" - t.string "carer_contact_info", default: "" - t.integer "assessment_province_id" - t.integer "assessment_district_id" - t.string "new_carer", default: "" - t.string "new_carer_gender", default: "" - t.date "new_carer_date_of_birth" - t.string "new_carer_relationship", default: "" - t.integer "interview_commune_id" - t.integer "interview_village_id" - t.integer "assessment_commune_id" - t.integer "primary_carer_commune_id" - t.integer "primary_carer_village_id" - t.text "recent_issues_and_progress", default: "" - t.string "other_case_closure" - t.text "brief_case_history" - t.integer "case_closure_id" - end - - add_index "government_forms", ["client_id"], name: "index_government_forms_on_client_id", using: :btree - add_index "government_forms", ["commune_id"], name: "index_government_forms_on_commune_id", using: :btree - add_index "government_forms", ["district_id"], name: "index_government_forms_on_district_id", using: :btree - add_index "government_forms", ["province_id"], name: "index_government_forms_on_province_id", using: :btree - add_index "government_forms", ["village_id"], name: "index_government_forms_on_village_id", using: :btree - - create_table "government_reports", force: :cascade do |t| - t.string "code", default: "" - t.string "initial_capital", default: "" - t.string "initial_city", default: "" - t.string "initial_commune", default: "" - t.date "initial_date" - t.string "client_code", default: "" - t.string "commune", default: "" - t.string "city", default: "" - t.string "capital", default: "" - t.string "organisation_name", default: "" - t.string "organisation_phone_number", default: "" - t.string "client_name", default: "" - t.date "client_date_of_birth" - t.string "client_gender", default: "" - t.string "found_client_at", default: "" - t.string "found_client_village", default: "" - t.string "education", default: "" - t.string "carer_name", default: "" - t.string "client_contact", default: "" - t.string "carer_house_number", default: "" - t.string "carer_street_number", default: "" - t.string "carer_village", default: "" - t.string "carer_commune", default: "" - t.string "carer_city", default: "" - t.string "carer_capital", default: "" - t.string "carer_phone_number", default: "" - t.date "case_information_date" - t.string "referral_name", default: "" - t.string "referral_position", default: "" - t.boolean "anonymous", default: false - t.text "anonymous_description", default: "" - t.boolean "client_living_with_guardian", default: false - t.text "present_physical_health", default: "" - t.text "physical_health_need", default: "" - t.text "physical_health_plan", default: "" - t.text "present_supplies", default: "" - t.text "supplies_need", default: "" - t.text "supplies_plan", default: "" - t.text "present_education", default: "" - t.text "education_need", default: "" - t.text "education_plan", default: "" - t.text "present_family_communication", default: "" - t.text "family_communication_need", default: "" - t.text "family_communication_plan", default: "" - t.text "present_society_communication", default: "" - t.text "society_communication_need", default: "" - t.text "society_communication_plan", default: "" - t.text "present_emotional_health", default: "" - t.text "emotional_health_need", default: "" - t.text "emotional_health_plan", default: "" - t.boolean "mission_obtainable", default: false - t.boolean "first_mission", default: false - t.boolean "second_mission", default: false - t.boolean "third_mission", default: false - t.boolean "fourth_mission", default: false - t.date "done_date" - t.date "agreed_date" - t.integer "client_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "hotlines", force: :cascade do |t| - t.integer "client_id" - t.integer "call_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "hotlines", ["call_id"], name: "index_hotlines_on_call_id", using: :btree - add_index "hotlines", ["client_id"], name: "index_hotlines_on_client_id", using: :btree - - create_table "interventions", force: :cascade do |t| - t.string "action", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "interviewees", force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "leave_programs", force: :cascade do |t| - t.jsonb "properties", default: {} - t.integer "client_enrollment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "program_stream_id" - t.date "exit_date" + create_table "client_enrollments", id: :serial, force: :cascade do |t| + t.jsonb "properties", default: {} + t.string "status", default: "Active" + t.integer "client_id" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.date "enrollment_date" t.datetime "deleted_at" + t.index ["client_id"], name: "index_client_enrollments_on_client_id" + t.index ["client_id"], name: "index_client_enrollments_on_client_id" + t.index ["deleted_at"], name: "index_client_enrollments_on_deleted_at" + t.index ["deleted_at"], name: "index_client_enrollments_on_deleted_at" + t.index ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id" + t.index ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id" end - add_index "leave_programs", ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id", using: :btree - add_index "leave_programs", ["deleted_at"], name: "index_leave_programs_on_deleted_at", using: :btree - - create_table "locations", force: :cascade do |t| - t.string "name", default: "" + create_table "client_interviewees", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "interviewee_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "order_option", default: 0 + t.index ["client_id"], name: "index_client_interviewees_on_client_id" + t.index ["client_id"], name: "index_client_interviewees_on_client_id" + t.index ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id" + t.index ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id" end - create_table "materials", force: :cascade do |t| - t.string "status", default: "" + create_table "client_interviewees", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "interviewee_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_client_interviewees_on_client_id" + t.index ["client_id"], name: "index_client_interviewees_on_client_id" + t.index ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id" + t.index ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id" end - create_table "meta_fields", force: :cascade do |t| - t.string "field_name" - t.string "field_type" - t.boolean "hidden", default: true - t.boolean "required", default: false - t.string "label" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "client_needs", id: :serial, force: :cascade do |t| + t.integer "rank" + t.integer "client_id" + t.integer "need_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["client_id"], name: "index_client_needs_on_client_id" + t.index ["client_id"], name: "index_client_needs_on_client_id" + t.index ["need_id"], name: "index_client_needs_on_need_id" + t.index ["need_id"], name: "index_client_needs_on_need_id" end - create_table "necessities", force: :cascade do |t| - t.string "content", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "client_needs", id: :serial, force: :cascade do |t| + t.integer "rank" + t.integer "client_id" + t.integer "need_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["client_id"], name: "index_client_needs_on_client_id" + t.index ["client_id"], name: "index_client_needs_on_client_id" + t.index ["need_id"], name: "index_client_needs_on_need_id" + t.index ["need_id"], name: "index_client_needs_on_need_id" end - create_table "needs", force: :cascade do |t| - t.string "name", default: "" + create_table "client_problems", id: :serial, force: :cascade do |t| + t.integer "rank" + t.integer "client_id" + t.integer "problem_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_client_problems_on_client_id" + t.index ["client_id"], name: "index_client_problems_on_client_id" + t.index ["problem_id"], name: "index_client_problems_on_problem_id" + t.index ["problem_id"], name: "index_client_problems_on_problem_id" end - create_table "oauth_access_grants", force: :cascade do |t| - t.integer "resource_owner_id", null: false - t.integer "application_id", null: false - t.string "token", null: false - t.integer "expires_in", null: false - t.text "redirect_uri", null: false - t.datetime "created_at", null: false - t.datetime "revoked_at" - t.string "scopes" + create_table "client_problems", id: :serial, force: :cascade do |t| + t.integer "rank" + t.integer "client_id" + t.integer "problem_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["client_id"], name: "index_client_problems_on_client_id" + t.index ["client_id"], name: "index_client_problems_on_client_id" + t.index ["problem_id"], name: "index_client_problems_on_problem_id" + t.index ["problem_id"], name: "index_client_problems_on_problem_id" end - add_index "oauth_access_grants", ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree - - create_table "oauth_access_tokens", force: :cascade do |t| - t.integer "resource_owner_id" - t.integer "application_id" - t.string "token", null: false - t.string "refresh_token" - t.integer "expires_in" - t.datetime "revoked_at" - t.datetime "created_at", null: false - t.string "scopes" - t.string "previous_refresh_token", default: "", null: false + create_table "client_quantitative_cases", id: :serial, force: :cascade do |t| + t.integer "quantitative_case_id" + t.integer "client_id" + t.datetime "created_at" + t.datetime "updated_at" end - add_index "oauth_access_tokens", ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree - add_index "oauth_access_tokens", ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree - add_index "oauth_access_tokens", ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree - - create_table "oauth_applications", force: :cascade do |t| - t.string "name", null: false - t.string "uid", null: false - t.string "secret", null: false - t.text "redirect_uri", null: false - t.string "scopes", default: "", null: false - t.boolean "confidential", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "client_quantitative_cases", id: :serial, force: :cascade do |t| + t.integer "quantitative_case_id" + t.integer "client_id" + t.datetime "created_at" + t.datetime "updated_at" end - add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree - - create_table "organization_types", force: :cascade do |t| - t.string "name" + create_table "client_right_government_forms", id: :serial, force: :cascade do |t| + t.integer "government_form_id" + t.integer "client_right_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id" + t.index ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id" + t.index ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id" + t.index ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id" end - create_table "organizations", force: :cascade do |t| - t.string "full_name" - t.string "short_name" - t.string "logo" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "fcf_ngo", default: false - t.string "country", default: "" - t.boolean "aht", default: false - t.boolean "integrated", default: false - t.string "supported_languages", default: ["km", "en", "my"], array: true - t.integer "clients_count", default: 0 - t.integer "active_client", default: 0 - t.integer "accepted_client", default: 0 - t.boolean "demo", default: false - t.string "referral_source_category_name" + create_table "client_right_government_forms", id: :serial, force: :cascade do |t| + t.integer "government_form_id" + t.integer "client_right_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id" + t.index ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id" + t.index ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id" + t.index ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id" end - create_table "partners", force: :cascade do |t| - t.string "name", default: "" - t.string "address", default: "" - t.date "start_date" - t.string "contact_person_name", default: "" - t.string "contact_person_email", default: "" - t.string "contact_person_mobile", default: "" - t.string "archive_organization_type", default: "" - t.string "affiliation", default: "" - t.string "engagement", default: "" - t.text "background", default: "" - t.integer "province_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.integer "organization_type_id" + create_table "client_rights", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "partners", ["organization_type_id"], name: "index_partners_on_organization_type_id", using: :btree - - create_table "permissions", force: :cascade do |t| - t.integer "user_id" - t.boolean "case_notes_readable", default: true - t.boolean "case_notes_editable", default: true - t.boolean "assessments_editable", default: true - t.boolean "assessments_readable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "client_rights", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "permissions", ["user_id"], name: "index_permissions_on_user_id", using: :btree - - create_table "problems", force: :cascade do |t| - t.string "name", default: "" + create_table "client_type_government_forms", id: :serial, force: :cascade do |t| + t.integer "client_type_id" + t.integer "government_form_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id" + t.index ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id" + t.index ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id" + t.index ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id" end - create_table "program_stream_permissions", force: :cascade do |t| - t.integer "user_id" - t.integer "program_stream_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "deleted_at" - end - - add_index "program_stream_permissions", ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at", using: :btree - add_index "program_stream_permissions", ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id", using: :btree - add_index "program_stream_permissions", ["user_id"], name: "index_program_stream_permissions_on_user_id", using: :btree - - create_table "program_stream_services", force: :cascade do |t| - t.datetime "deleted_at" - t.integer "program_stream_id" - t.integer "service_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "program_stream_services", ["deleted_at"], name: "index_program_stream_services_on_deleted_at", using: :btree - add_index "program_stream_services", ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id", using: :btree - add_index "program_stream_services", ["service_id"], name: "index_program_stream_services_on_service_id", using: :btree - - create_table "program_streams", force: :cascade do |t| - t.string "name" - t.text "description" - t.jsonb "rules", default: {} - t.jsonb "enrollment", default: {} - t.jsonb "exit_program", default: {} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "quantity" - t.string "ngo_name", default: "" - t.boolean "completed", default: false - t.integer "program_exclusive", default: [], array: true - t.integer "mutual_dependence", default: [], array: true - t.boolean "tracking_required", default: false - t.datetime "archived_at" - end - - add_index "program_streams", ["archived_at"], name: "index_program_streams_on_archived_at", using: :btree - - create_table "progress_note_types", force: :cascade do |t| - t.string "note_type", default: "" + create_table "client_type_government_forms", id: :serial, force: :cascade do |t| + t.integer "client_type_id" + t.integer "government_form_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id" + t.index ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id" + t.index ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id" + t.index ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id" end - create_table "progress_notes", force: :cascade do |t| - t.date "date" - t.string "other_location", default: "" - t.text "response", default: "" - t.text "additional_note", default: "" - t.integer "client_id" - t.integer "progress_note_type_id" - t.integer "location_id" - t.integer "material_id" + create_table "client_types", id: :serial, force: :cascade do |t| + t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" - t.integer "user_id" end - add_index "progress_notes", ["client_id"], name: "index_progress_notes_on_client_id", using: :btree - add_index "progress_notes", ["location_id"], name: "index_progress_notes_on_location_id", using: :btree - add_index "progress_notes", ["material_id"], name: "index_progress_notes_on_material_id", using: :btree - add_index "progress_notes", ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id", using: :btree - add_index "progress_notes", ["user_id"], name: "index_progress_notes_on_user_id", using: :btree - - create_table "protection_concerns", force: :cascade do |t| - t.string "content", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "client_types", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" end - create_table "provinces", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" + create_table "clients", id: :serial, force: :cascade do |t| + t.string "code", default: "" + t.string "given_name", default: "" + t.string "family_name", default: "" + t.string "gender", default: "" + t.date "date_of_birth" + t.string "status", default: "Referred" + t.date "initial_referral_date" + t.string "referral_phone", default: "" + t.integer "birth_province_id" + t.integer "received_by_id" + t.integer "followed_up_by_id" + t.date "follow_up_date" + t.string "current_address", default: "" + t.string "school_name", default: "" + t.string "school_grade", default: "" + t.boolean "has_been_in_orphanage" + t.boolean "able", default: false + t.boolean "has_been_in_government_care" + t.text "relevant_referral_information", default: "" + t.string "archive_state", default: "" + t.text "rejected_note", default: "" + t.integer "province_id" + t.integer "referral_source_id" + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "completed", default: false + t.text "reason_for_referral", default: "" + t.boolean "is_receiving_additional_benefits", default: false + t.text "background", default: "" + t.integer "grade" + t.string "slug" + t.string "able_state", default: "" + t.integer "donor_id" + t.string "local_given_name", default: "" + t.string "local_family_name", default: "" + t.string "kid_id", default: "" + t.string "house_number", default: "" + t.string "street_number", default: "" + t.string "old_village", default: "" + t.string "old_commune", default: "" + t.string "archive_district", default: "" + t.string "live_with", default: "" + t.integer "id_poor" + t.integer "rice_support", default: 0 + t.text "exit_note", default: "" + t.date "exit_date" + t.date "accepted_date" + t.string "gov_city", default: "" + t.string "gov_commune", default: "" + t.string "gov_district", default: "" + t.date "gov_date" + t.string "gov_village_code", default: "" + t.string "gov_client_code", default: "" + t.string "gov_interview_village", default: "" + t.string "gov_interview_commune", default: "" + t.string "gov_interview_district", default: "" + t.string "gov_interview_city", default: "" + t.string "gov_caseworker_name", default: "" + t.string "gov_caseworker_phone", default: "" + t.string "gov_carer_name", default: "" + t.string "gov_carer_relationship", default: "" + t.string "gov_carer_home", default: "" + t.string "gov_carer_street", default: "" + t.string "gov_carer_village", default: "" + t.string "gov_carer_commune", default: "" + t.string "gov_carer_district", default: "" + t.string "gov_carer_city", default: "" + t.string "gov_carer_phone", default: "" + t.string "gov_information_source", default: "" + t.text "gov_referral_reason", default: "" + t.text "gov_guardian_comment", default: "" + t.text "gov_caseworker_comment", default: "" + t.integer "district_id" + t.string "telephone_number", default: "" + t.string "name_of_referee", default: "" + t.string "main_school_contact", default: "" + t.string "rated_for_id_poor", default: "" + t.string "what3words", default: "" + t.string "exit_reasons", default: [], array: true + t.string "exit_circumstance", default: "" + t.string "other_info_of_exit", default: "" + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "subdistrict_id" + t.integer "township_id" + t.integer "state_id" + t.string "country_origin", default: "" + t.integer "commune_id" + t.integer "village_id" + t.string "profile" + t.integer "referral_source_category_id" + t.string "archived_slug" + t.integer "assessments_count", default: 0, null: false + t.integer "current_family_id" + t.boolean "outside", default: false + t.string "outside_address", default: "" + t.string "address_type", default: "" + t.string "client_phone", default: "" + t.string "phone_owner", default: "" + t.string "client_email", default: "" + t.string "referee_relationship", default: "" + t.integer "referee_id" + t.integer "carer_id" + t.string "nickname", default: "" + t.string "relation_to_referee", default: "" + t.boolean "concern_is_outside", default: false + t.string "concern_outside_address", default: "" + t.integer "concern_province_id" + t.integer "concern_district_id" + t.integer "concern_commune_id" + t.integer "concern_village_id" + t.string "concern_street", default: "" + t.string "concern_house", default: "" + t.string "concern_address", default: "" + t.string "concern_address_type", default: "" + t.string "concern_phone", default: "" + t.string "concern_phone_owner", default: "" + t.string "concern_email", default: "" + t.string "concern_email_owner", default: "" + t.string "concern_location", default: "" + t.boolean "concern_same_as_client", default: false + t.string "location_description", default: "" + t.string "phone_counselling_summary", default: "" + t.string "presented_id" + t.string "id_number" + t.string "other_phone_number" + t.string "brsc_branch" + t.string "current_island" + t.string "current_street" + t.string "current_po_box" + t.string "current_city" + t.string "current_settlement" + t.string "current_resident_own_or_rent" + t.string "current_household_type" + t.string "island2" + t.string "street2" + t.string "po_box2" + t.string "city2" + t.string "settlement2" + t.string "resident_own_or_rent2" + t.string "household_type2" + t.string "legacy_brcs_id" + t.boolean "whatsapp", default: false + t.string "global_id" + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + t.boolean "other_phone_whatsapp", default: false + t.string "preferred_language", default: "English" + t.boolean "national_id", default: false, null: false + t.boolean "birth_cert", default: false, null: false + t.boolean "family_book", default: false, null: false + t.boolean "passport", default: false, null: false + t.boolean "travel_doc", default: false, null: false + t.boolean "referral_doc", default: false, null: false + t.boolean "local_consent", default: false, null: false + t.boolean "police_interview", default: false, null: false + t.boolean "other_legal_doc", default: false, null: false + t.string "national_id_files", default: [], array: true + t.string "birth_cert_files", default: [], array: true + t.string "family_book_files", default: [], array: true + t.string "passport_files", default: [], array: true + t.string "travel_doc_files", default: [], array: true + t.string "referral_doc_files", default: [], array: true + t.string "local_consent_files", default: [], array: true + t.string "police_interview_files", default: [], array: true + t.string "other_legal_doc_files", default: [], array: true + t.boolean "referred_external", default: false + t.string "marital_status" + t.string "nationality" + t.string "ethnicity" + t.string "location_of_concern" + t.string "type_of_trafficking" + t.text "education_background" + t.string "department" + t.string "neighbor_name" + t.string "neighbor_phone" + t.string "dosavy_name" + t.string "dosavy_phone" + t.string "chief_commune_name" + t.string "chief_commune_phone" + t.string "chief_village_name" + t.string "chief_village_phone" + t.string "ccwc_name" + t.string "ccwc_phone" + t.string "legal_team_name" + t.string "legal_representative_name" + t.string "legal_team_phone" + t.string "other_agency_name" + t.string "other_representative_name" + t.string "other_agency_phone" + t.string "locality" + t.string "national_id_number" + t.string "passport_number" + t.index ["commune_id"], name: "index_clients_on_commune_id" + t.index ["commune_id"], name: "index_clients_on_commune_id" + t.index ["current_family_id"], name: "index_clients_on_current_family_id" + t.index ["current_family_id"], name: "index_clients_on_current_family_id" + t.index ["district_id"], name: "index_clients_on_district_id" + t.index ["district_id"], name: "index_clients_on_district_id" + t.index ["donor_id"], name: "index_clients_on_donor_id" + t.index ["donor_id"], name: "index_clients_on_donor_id" + t.index ["external_id"], name: "index_clients_on_external_id" + t.index ["external_id"], name: "index_clients_on_external_id" + t.index ["global_id"], name: "index_clients_on_global_id" + t.index ["global_id"], name: "index_clients_on_global_id" + t.index ["mosvy_number"], name: "index_clients_on_mosvy_number" + t.index ["mosvy_number"], name: "index_clients_on_mosvy_number" + t.index ["slug"], name: "index_clients_on_slug", unique: true + t.index ["slug"], name: "index_clients_on_slug", unique: true + t.index ["state_id"], name: "index_clients_on_state_id" + t.index ["state_id"], name: "index_clients_on_state_id" + t.index ["subdistrict_id"], name: "index_clients_on_subdistrict_id" + t.index ["subdistrict_id"], name: "index_clients_on_subdistrict_id" + t.index ["township_id"], name: "index_clients_on_township_id" + t.index ["township_id"], name: "index_clients_on_township_id" + t.index ["village_id"], name: "index_clients_on_village_id" + t.index ["village_id"], name: "index_clients_on_village_id" + end + + create_table "clients", id: :serial, force: :cascade do |t| + t.string "code", default: "" + t.string "given_name", default: "" + t.string "family_name", default: "" + t.string "gender", default: "" + t.date "date_of_birth" + t.string "status", default: "Referred" + t.date "initial_referral_date" + t.string "referral_phone", default: "" + t.integer "birth_province_id" + t.integer "received_by_id" + t.integer "followed_up_by_id" + t.date "follow_up_date" + t.string "current_address", default: "" + t.string "school_name", default: "" + t.string "school_grade", default: "" + t.boolean "has_been_in_orphanage" + t.boolean "able", default: false + t.boolean "has_been_in_government_care" + t.text "relevant_referral_information", default: "" + t.string "archive_state", default: "" + t.text "rejected_note", default: "" + t.integer "province_id" + t.integer "referral_source_id" + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "completed", default: false + t.text "reason_for_referral", default: "" + t.boolean "is_receiving_additional_benefits", default: false + t.text "background", default: "" + t.integer "grade" + t.string "slug" + t.string "able_state", default: "" + t.integer "donor_id" + t.string "local_given_name", default: "" + t.string "local_family_name", default: "" + t.string "kid_id", default: "" + t.string "house_number", default: "" + t.string "street_number", default: "" + t.string "old_village", default: "" + t.string "old_commune", default: "" + t.string "archive_district", default: "" + t.string "live_with", default: "" + t.integer "id_poor" + t.integer "rice_support", default: 0 + t.text "exit_note", default: "" + t.date "exit_date" + t.date "accepted_date" + t.string "gov_city", default: "" + t.string "gov_commune", default: "" + t.string "gov_district", default: "" + t.date "gov_date" + t.string "gov_village_code", default: "" + t.string "gov_client_code", default: "" + t.string "gov_interview_village", default: "" + t.string "gov_interview_commune", default: "" + t.string "gov_interview_district", default: "" + t.string "gov_interview_city", default: "" + t.string "gov_caseworker_name", default: "" + t.string "gov_caseworker_phone", default: "" + t.string "gov_carer_name", default: "" + t.string "gov_carer_relationship", default: "" + t.string "gov_carer_home", default: "" + t.string "gov_carer_street", default: "" + t.string "gov_carer_village", default: "" + t.string "gov_carer_commune", default: "" + t.string "gov_carer_district", default: "" + t.string "gov_carer_city", default: "" + t.string "gov_carer_phone", default: "" + t.string "gov_information_source", default: "" + t.text "gov_referral_reason", default: "" + t.text "gov_guardian_comment", default: "" + t.text "gov_caseworker_comment", default: "" + t.integer "district_id" + t.string "telephone_number", default: "" + t.string "name_of_referee", default: "" + t.string "main_school_contact", default: "" + t.string "rated_for_id_poor", default: "" + t.string "what3words", default: "" + t.string "exit_reasons", default: [], array: true + t.string "exit_circumstance", default: "" + t.string "other_info_of_exit", default: "" + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "subdistrict_id" + t.integer "township_id" + t.integer "state_id" + t.string "country_origin", default: "" + t.integer "commune_id" + t.integer "village_id" + t.string "profile" + t.integer "referral_source_category_id" + t.string "archived_slug" + t.integer "assessments_count", default: 0, null: false + t.integer "current_family_id" + t.boolean "outside", default: false + t.string "outside_address", default: "" + t.string "address_type", default: "" + t.string "client_phone", default: "" + t.string "phone_owner", default: "" + t.string "client_email", default: "" + t.string "referee_relationship", default: "" + t.integer "referee_id" + t.integer "carer_id" + t.string "nickname", default: "" + t.string "relation_to_referee", default: "" + t.boolean "concern_is_outside", default: false + t.string "concern_outside_address", default: "" + t.integer "concern_province_id" + t.integer "concern_district_id" + t.integer "concern_commune_id" + t.integer "concern_village_id" + t.string "concern_street", default: "" + t.string "concern_house", default: "" + t.string "concern_address", default: "" + t.string "concern_address_type", default: "" + t.string "concern_phone", default: "" + t.string "concern_phone_owner", default: "" + t.string "concern_email", default: "" + t.string "concern_email_owner", default: "" + t.string "concern_location", default: "" + t.boolean "concern_same_as_client", default: false + t.string "location_description", default: "" + t.string "phone_counselling_summary", default: "" + t.string "presented_id" + t.string "id_number" + t.string "other_phone_number" + t.string "brsc_branch" + t.string "current_island" + t.string "current_street" + t.string "current_po_box" + t.string "current_city" + t.string "current_settlement" + t.string "current_resident_own_or_rent" + t.string "current_household_type" + t.string "island2" + t.string "street2" + t.string "po_box2" + t.string "city2" + t.string "settlement2" + t.string "resident_own_or_rent2" + t.string "household_type2" + t.string "legacy_brcs_id" + t.boolean "whatsapp", default: false + t.string "global_id" + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + t.boolean "other_phone_whatsapp", default: false + t.string "preferred_language", default: "English" + t.boolean "national_id", default: false, null: false + t.boolean "birth_cert", default: false, null: false + t.boolean "family_book", default: false, null: false + t.boolean "passport", default: false, null: false + t.boolean "travel_doc", default: false, null: false + t.boolean "referral_doc", default: false, null: false + t.boolean "local_consent", default: false, null: false + t.boolean "police_interview", default: false, null: false + t.boolean "other_legal_doc", default: false, null: false + t.string "national_id_files", default: [], array: true + t.string "birth_cert_files", default: [], array: true + t.string "family_book_files", default: [], array: true + t.string "passport_files", default: [], array: true + t.string "travel_doc_files", default: [], array: true + t.string "referral_doc_files", default: [], array: true + t.string "local_consent_files", default: [], array: true + t.string "police_interview_files", default: [], array: true + t.string "other_legal_doc_files", default: [], array: true + t.boolean "referred_external", default: false + t.string "marital_status" + t.string "nationality" + t.string "ethnicity" + t.string "location_of_concern" + t.string "type_of_trafficking" + t.text "education_background" + t.string "department" + t.string "neighbor_name" + t.string "neighbor_phone" + t.string "dosavy_name" + t.string "dosavy_phone" + t.string "chief_commune_name" + t.string "chief_commune_phone" + t.string "chief_village_name" + t.string "chief_village_phone" + t.string "ccwc_name" + t.string "ccwc_phone" + t.string "legal_team_name" + t.string "legal_representative_name" + t.string "legal_team_phone" + t.string "other_agency_name" + t.string "other_representative_name" + t.string "other_agency_phone" + t.string "locality" + t.string "national_id_number" + t.string "passport_number" + t.index ["commune_id"], name: "index_clients_on_commune_id" + t.index ["commune_id"], name: "index_clients_on_commune_id" + t.index ["current_family_id"], name: "index_clients_on_current_family_id" + t.index ["current_family_id"], name: "index_clients_on_current_family_id" + t.index ["district_id"], name: "index_clients_on_district_id" + t.index ["district_id"], name: "index_clients_on_district_id" + t.index ["donor_id"], name: "index_clients_on_donor_id" + t.index ["donor_id"], name: "index_clients_on_donor_id" + t.index ["external_id"], name: "index_clients_on_external_id" + t.index ["external_id"], name: "index_clients_on_external_id" + t.index ["global_id"], name: "index_clients_on_global_id" + t.index ["global_id"], name: "index_clients_on_global_id" + t.index ["mosvy_number"], name: "index_clients_on_mosvy_number" + t.index ["mosvy_number"], name: "index_clients_on_mosvy_number" + t.index ["slug"], name: "index_clients_on_slug", unique: true + t.index ["slug"], name: "index_clients_on_slug", unique: true + t.index ["state_id"], name: "index_clients_on_state_id" + t.index ["state_id"], name: "index_clients_on_state_id" + t.index ["subdistrict_id"], name: "index_clients_on_subdistrict_id" + t.index ["subdistrict_id"], name: "index_clients_on_subdistrict_id" + t.index ["township_id"], name: "index_clients_on_township_id" + t.index ["township_id"], name: "index_clients_on_township_id" + t.index ["village_id"], name: "index_clients_on_village_id" + t.index ["village_id"], name: "index_clients_on_village_id" + end + + create_table "clients_quantitative_cases", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "quantitative_case_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.integer "clients_count", default: 0 - t.integer "families_count", default: 0 - t.integer "partners_count", default: 0 - t.integer "users_count", default: 0, null: false - t.string "country" end - create_table "quantitative_cases", force: :cascade do |t| - t.string "value", default: "" - t.integer "quantitative_type_id" + create_table "clients_quantitative_cases", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "quantitative_case_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "quantitative_type_permissions", force: :cascade do |t| - t.integer "user_id" - t.integer "quantitative_type_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "communes", id: :serial, force: :cascade do |t| + t.string "code", default: "" + t.string "name_kh", default: "" + t.string "name_en", default: "" + t.integer "district_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "district_type" + t.index ["district_id"], name: "index_communes_on_district_id" + t.index ["district_id"], name: "index_communes_on_district_id" end - add_index "quantitative_type_permissions", ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id", using: :btree - add_index "quantitative_type_permissions", ["user_id"], name: "index_quantitative_type_permissions_on_user_id", using: :btree - - create_table "quantitative_types", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.integer "quantitative_cases_count", default: 0 + create_table "communes", id: :serial, force: :cascade do |t| + t.string "code", default: "" + t.string "name_kh", default: "" + t.string "name_en", default: "" + t.integer "district_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "multiple", default: true + t.string "district_type" + t.index ["district_id"], name: "index_communes_on_district_id" + t.index ["district_id"], name: "index_communes_on_district_id" end - create_table "quarterly_reports", force: :cascade do |t| - t.date "visit_date" - t.integer "code", limit: 8 - t.integer "case_id" - t.text "general_health_or_appearance", default: "" - t.text "child_school_attendance_or_progress", default: "" - t.text "general_appearance_of_home", default: "" - t.text "observations_of_drug_alchohol_abuse", default: "" - t.text "describe_if_yes", default: "" - t.text "describe_the_family_current_situation", default: "" - t.text "has_the_situation_changed_from_the_previous_visit", default: "" - t.text "how_did_i_encourage_the_client", default: "" - t.text "what_future_teachings_or_trainings_could_help_the_client", default: "" - t.text "what_is_my_plan_for_the_next_visit_to_the_client", default: "" - t.boolean "money_and_supplies_being_used_appropriately", default: false - t.text "how_are_they_being_misused", default: "" - t.integer "staff_id" - t.text "spiritual_developments_with_the_child_or_family", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "quarterly_reports", ["case_id"], name: "index_quarterly_reports_on_case_id", using: :btree - - create_table "question_groups", force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "referees", force: :cascade do |t| - t.string "address_type", default: "" - t.string "current_address", default: "" - t.string "email", default: "" - t.string "gender", default: "" - t.string "house_number", default: "" - t.string "outside_address", default: "" - t.string "street_number", default: "" - t.boolean "outside", default: false - t.boolean "anonymous", default: false - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name", default: "" - t.string "phone", default: "" - t.boolean "adult" - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "state_id" - t.integer "township_id" - t.integer "subdistrict_id" - t.string "locality" - end - - add_index "referees", ["commune_id"], name: "index_referees_on_commune_id", using: :btree - add_index "referees", ["district_id"], name: "index_referees_on_district_id", using: :btree - add_index "referees", ["province_id"], name: "index_referees_on_province_id", using: :btree - add_index "referees", ["state_id"], name: "index_referees_on_state_id", using: :btree - add_index "referees", ["subdistrict_id"], name: "index_referees_on_subdistrict_id", using: :btree - add_index "referees", ["township_id"], name: "index_referees_on_township_id", using: :btree - add_index "referees", ["village_id"], name: "index_referees_on_village_id", using: :btree - - create_table "referral_sources", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "clients_count", default: 0 - t.string "name_en", default: "" - t.string "ancestry" - end - - add_index "referral_sources", ["ancestry"], name: "index_referral_sources_on_ancestry", using: :btree - - create_table "referrals", force: :cascade do |t| - t.string "slug", default: "" - t.date "date_of_referral" - t.string "referred_to", default: "" - t.string "referred_from", default: "" - t.text "referral_reason", default: "" - t.string "name_of_referee", default: "" - t.string "referral_phone", default: "" - t.integer "referee_id" - t.string "client_name", default: "" - t.string "consent_form", default: [], array: true - t.boolean "saved", default: false - t.integer "client_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "ngo_name", default: "" - t.string "client_global_id" - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - t.string "client_gender", default: "" - t.date "client_date_of_birth" - t.string "village_code", default: "" - end - - add_index "referrals", ["client_global_id"], name: "index_referrals_on_client_global_id", using: :btree - add_index "referrals", ["client_id"], name: "index_referrals_on_client_id", using: :btree - add_index "referrals", ["external_id"], name: "index_referrals_on_external_id", using: :btree - add_index "referrals", ["mosvy_number"], name: "index_referrals_on_mosvy_number", using: :btree + create_table "custom_assessment_settings", id: :serial, force: :cascade do |t| + t.string "custom_assessment_name", default: "Custom Assessment" + t.integer "max_custom_assessment", default: 6 + t.string "custom_assessment_frequency", default: "month" + t.integer "custom_age", default: 18 + t.integer "setting_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "enable_custom_assessment", default: false + end - create_table "referrals_services", id: false, force: :cascade do |t| - t.integer "referral_id" - t.integer "service_id" + create_table "custom_assessment_settings", id: :serial, force: :cascade do |t| + t.string "custom_assessment_name", default: "Custom Assessment" + t.integer "max_custom_assessment", default: 6 + t.string "custom_assessment_frequency", default: "month" + t.integer "custom_age", default: 18 + t.integer "setting_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "enable_custom_assessment", default: false end - create_table "service_types", force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "custom_field_permissions", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "custom_field_id" + t.boolean "readable", default: true + t.boolean "editable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id" + t.index ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id" + t.index ["user_id"], name: "index_custom_field_permissions_on_user_id" + t.index ["user_id"], name: "index_custom_field_permissions_on_user_id" end - create_table "services", force: :cascade do |t| - t.string "name" - t.integer "parent_id" - t.datetime "deleted_at" + create_table "custom_field_permissions", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "custom_field_id" + t.boolean "readable", default: true + t.boolean "editable", default: true t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.uuid "uuid" - end - - add_index "services", ["deleted_at"], name: "index_services_on_deleted_at", using: :btree - add_index "services", ["name"], name: "index_services_on_name", using: :btree - add_index "services", ["parent_id"], name: "index_services_on_parent_id", using: :btree - add_index "services", ["uuid"], name: "index_services_on_uuid", using: :btree - - create_table "settings", force: :cascade do |t| - t.string "assessment_frequency", default: "month" - t.integer "min_assessment" - t.integer "max_assessment", default: 6 - t.string "country_name", default: "" - t.integer "max_case_note" - t.string "case_note_frequency" - t.string "client_default_columns", default: [], array: true - t.string "family_default_columns", default: [], array: true - t.string "partner_default_columns", default: [], array: true - t.string "user_default_columns", default: [], array: true - t.datetime "created_at" - t.datetime "updated_at" - t.string "org_name", default: "" - t.string "old_commune", default: "" - t.integer "province_id" - t.integer "district_id" - t.integer "age", default: 18 - t.integer "commune_id" - t.string "custom_assessment", default: "Custom Assessment" - t.boolean "enable_custom_assessment", default: false - t.boolean "enable_default_assessment", default: true - t.integer "max_custom_assessment", default: 6 - t.string "custom_assessment_frequency", default: "month" - t.integer "custom_age", default: 18 - t.string "default_assessment", default: "CSI Assessment" - t.boolean "sharing_data", default: false - t.string "custom_id1_latin", default: "" - t.string "custom_id1_local", default: "" - t.string "custom_id2_latin", default: "" - t.string "custom_id2_local", default: "" - t.boolean "enable_hotline", default: false - t.boolean "enable_client_form", default: true - t.string "assessment_score_order", default: "random_order", null: false - t.boolean "disable_required_fields", default: false, null: false - t.boolean "never_delete_incomplete_assessment", default: false, null: false - t.integer "delete_incomplete_after_period_value", default: 7 - t.string "delete_incomplete_after_period_unit", default: "days" - t.boolean "use_screening_assessment", default: false - t.integer "screening_assessment_form_id" - t.boolean "show_prev_assessment", default: false - t.boolean "two_weeks_assessment_reminder", default: false - end - - add_index "settings", ["commune_id"], name: "index_settings_on_commune_id", using: :btree - add_index "settings", ["district_id"], name: "index_settings_on_district_id", using: :btree - add_index "settings", ["province_id"], name: "index_settings_on_province_id", using: :btree - - create_table "shared_clients", force: :cascade do |t| - t.string "slug", default: "" - t.string "given_name", default: "" - t.string "family_name", default: "" - t.string "local_given_name", default: "" - t.string "local_family_name", default: "" - t.string "gender", default: "" - t.date "date_of_birth" - t.string "live_with", default: "" - t.string "telephone_number", default: "" - t.integer "birth_province_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "country_origin", default: "" - t.string "duplicate_checker" - t.string "archived_slug" - t.string "global_id" - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - end - - add_index "shared_clients", ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker", using: :btree - add_index "shared_clients", ["external_id"], name: "index_shared_clients_on_external_id", using: :btree - add_index "shared_clients", ["global_id"], name: "index_shared_clients_on_global_id", using: :btree - add_index "shared_clients", ["mosvy_number"], name: "index_shared_clients_on_mosvy_number", using: :btree - add_index "shared_clients", ["slug"], name: "index_shared_clients_on_slug", unique: true, using: :btree - - create_table "sponsors", force: :cascade do |t| - t.integer "client_id" - t.integer "donor_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "sponsors", ["client_id"], name: "index_sponsors_on_client_id", using: :btree - add_index "sponsors", ["donor_id"], name: "index_sponsors_on_donor_id", using: :btree - - create_table "stages", force: :cascade do |t| - t.float "from_age" - t.float "to_age" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "states", force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "subdistricts", force: :cascade do |t| - t.string "name" - t.integer "district_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "subdistricts", ["district_id"], name: "index_subdistricts_on_district_id", using: :btree - - create_table "surveys", force: :cascade do |t| - t.integer "client_id" - t.integer "user_id" - t.integer "listening_score" - t.integer "problem_solving_score" - t.integer "getting_in_touch_score" - t.integer "trust_score" - t.integer "difficulty_help_score" - t.integer "support_score" - t.integer "family_need_score" - t.integer "care_score" + t.index ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id" + t.index ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id" + t.index ["user_id"], name: "index_custom_field_permissions_on_user_id" + t.index ["user_id"], name: "index_custom_field_permissions_on_user_id" + end + + create_table "custom_field_properties", id: :serial, force: :cascade do |t| + t.jsonb "properties", default: {} + t.string "custom_formable_type" + t.integer "custom_formable_id" + t.integer "custom_field_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "attachments" + t.integer "user_id" + t.index ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id" + t.index ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id" + end + + create_table "custom_field_properties", id: :serial, force: :cascade do |t| + t.jsonb "properties", default: {} + t.string "custom_formable_type" + t.integer "custom_formable_id" + t.integer "custom_field_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "attachments" + t.integer "user_id" + t.index ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id" + t.index ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id" + end + + create_table "custom_fields", id: :serial, force: :cascade do |t| + t.string "entity_type", default: "" + t.text "properties", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "form_title", default: "" + t.string "frequency", default: "" + t.integer "time_of_frequency", default: 0 + t.string "ngo_name", default: "" + t.jsonb "fields" + end + + create_table "custom_fields", id: :serial, force: :cascade do |t| + t.string "entity_type", default: "" + t.text "properties", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "form_title", default: "" + t.string "frequency", default: "" + t.integer "time_of_frequency", default: 0 + t.string "ngo_name", default: "" + t.jsonb "fields" + end + + create_table "departments", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "users_count", default: 0 + end + + create_table "departments", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "users_count", default: 0 + end + + create_table "districts", id: :serial, force: :cascade do |t| + t.string "name" + t.integer "province_id" + t.string "code", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["province_id"], name: "index_districts_on_province_id" + t.index ["province_id"], name: "index_districts_on_province_id" + end + + create_table "districts", id: :serial, force: :cascade do |t| + t.string "name" + t.integer "province_id" + t.string "code", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["province_id"], name: "index_districts_on_province_id" + t.index ["province_id"], name: "index_districts_on_province_id" + end + + create_table "domain_groups", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "domains_count", default: 0 + end + + create_table "domain_groups", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "domains_count", default: 0 + end + + create_table "domain_program_streams", id: :serial, force: :cascade do |t| + t.integer "program_stream_id" + t.integer "domain_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_domain_program_streams_on_deleted_at" + t.index ["deleted_at"], name: "index_domain_program_streams_on_deleted_at" + end + + create_table "domain_program_streams", id: :serial, force: :cascade do |t| + t.integer "program_stream_id" + t.integer "domain_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_domain_program_streams_on_deleted_at" + t.index ["deleted_at"], name: "index_domain_program_streams_on_deleted_at" + end + + create_table "domains", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.string "identity", default: "" + t.text "description", default: "" + t.integer "domain_group_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "tasks_count", default: 0 + t.string "score_1_color", default: "danger" + t.string "score_2_color", default: "warning" + t.string "score_3_color", default: "info" + t.string "score_4_color", default: "primary" + t.text "score_1_definition", default: "" + t.text "score_2_definition", default: "" + t.text "score_3_definition", default: "" + t.text "score_4_definition", default: "" + t.boolean "custom_domain", default: false + t.text "local_description", default: "" + t.text "score_1_local_definition", default: "" + t.text "score_2_local_definition", default: "" + t.text "score_3_local_definition", default: "" + t.text "score_4_local_definition", default: "" + t.integer "custom_assessment_setting_id" + t.index ["domain_group_id"], name: "index_domains_on_domain_group_id" + t.index ["domain_group_id"], name: "index_domains_on_domain_group_id" + end + + create_table "domains", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.string "identity", default: "" + t.text "description", default: "" + t.integer "domain_group_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "tasks_count", default: 0 + t.string "score_1_color", default: "danger" + t.string "score_2_color", default: "warning" + t.string "score_3_color", default: "info" + t.string "score_4_color", default: "primary" + t.text "score_1_definition", default: "" + t.text "score_2_definition", default: "" + t.text "score_3_definition", default: "" + t.text "score_4_definition", default: "" + t.boolean "custom_domain", default: false + t.text "local_description", default: "" + t.text "score_1_local_definition", default: "" + t.text "score_2_local_definition", default: "" + t.text "score_3_local_definition", default: "" + t.text "score_4_local_definition", default: "" + t.integer "custom_assessment_setting_id" + t.index ["domain_group_id"], name: "index_domains_on_domain_group_id" + t.index ["domain_group_id"], name: "index_domains_on_domain_group_id" + end + + create_table "donor_organizations", id: :integer, default: nil, force: :cascade do |t| + t.integer "donor_id" + t.integer "organization_id" + t.index ["donor_id"], name: "index_donor_organizations_on_donor_id" + t.index ["donor_id"], name: "index_donor_organizations_on_donor_id" + t.index ["organization_id"], name: "index_donor_organizations_on_organization_id" + t.index ["organization_id"], name: "index_donor_organizations_on_organization_id" + end + + create_table "donor_organizations", id: :integer, default: nil, force: :cascade do |t| + t.integer "donor_id" + t.integer "organization_id" + t.index ["donor_id"], name: "index_donor_organizations_on_donor_id" + t.index ["donor_id"], name: "index_donor_organizations_on_donor_id" + t.index ["organization_id"], name: "index_donor_organizations_on_organization_id" + t.index ["organization_id"], name: "index_donor_organizations_on_organization_id" + end + + create_table "donors", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "code", default: "" + t.string "global_id", limit: 32, default: "" + t.index ["global_id"], name: "index_donors_on_global_id" + t.index ["global_id"], name: "index_donors_on_global_id" + end + + create_table "donors", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "code", default: "" + t.string "global_id", limit: 32, default: "" + t.index ["global_id"], name: "index_donors_on_global_id" + t.index ["global_id"], name: "index_donors_on_global_id" + end + + create_table "enrollment_trackings", id: :serial, force: :cascade do |t| + t.integer "enrollment_id" + t.integer "tracking_id" + t.jsonb "properties", default: {} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id" + t.index ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id" + t.index ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id" + t.index ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id" + end + + create_table "enrollment_trackings", id: :serial, force: :cascade do |t| + t.integer "enrollment_id" + t.integer "tracking_id" + t.jsonb "properties", default: {} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id" + t.index ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id" + t.index ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id" + t.index ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id" + end + + create_table "enrollments", id: :serial, force: :cascade do |t| + t.jsonb "properties", default: {} + t.string "status", default: "Active" + t.date "enrollment_date" + t.datetime "deleted_at" + t.string "programmable_type" + t.integer "programmable_id" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["deleted_at"], name: "index_enrollments_on_deleted_at" + t.index ["deleted_at"], name: "index_enrollments_on_deleted_at" + t.index ["program_stream_id"], name: "index_enrollments_on_program_stream_id" + t.index ["program_stream_id"], name: "index_enrollments_on_program_stream_id" + end + + create_table "enrollments", id: :serial, force: :cascade do |t| + t.jsonb "properties", default: {} + t.string "status", default: "Active" + t.date "enrollment_date" + t.datetime "deleted_at" + t.string "programmable_type" + t.integer "programmable_id" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["deleted_at"], name: "index_enrollments_on_deleted_at" + t.index ["deleted_at"], name: "index_enrollments_on_deleted_at" + t.index ["program_stream_id"], name: "index_enrollments_on_program_stream_id" + t.index ["program_stream_id"], name: "index_enrollments_on_program_stream_id" + end + + create_table "enter_ngo_users", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "enter_ngo_id" + t.index ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id" + t.index ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id" + t.index ["user_id"], name: "index_enter_ngo_users_on_user_id" + t.index ["user_id"], name: "index_enter_ngo_users_on_user_id" + end + + create_table "enter_ngo_users", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "enter_ngo_id" + t.index ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id" + t.index ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id" + t.index ["user_id"], name: "index_enter_ngo_users_on_user_id" + t.index ["user_id"], name: "index_enter_ngo_users_on_user_id" + end + + create_table "enter_ngos", id: :serial, force: :cascade do |t| + t.date "accepted_date" + t.integer "client_id" + t.datetime "created_at" + t.datetime "updated_at" + t.datetime "deleted_at" + t.index ["client_id"], name: "index_enter_ngos_on_client_id" + t.index ["client_id"], name: "index_enter_ngos_on_client_id" + t.index ["deleted_at"], name: "index_enter_ngos_on_deleted_at" + t.index ["deleted_at"], name: "index_enter_ngos_on_deleted_at" + end + + create_table "enter_ngos", id: :serial, force: :cascade do |t| + t.date "accepted_date" + t.integer "client_id" + t.datetime "created_at" + t.datetime "updated_at" + t.datetime "deleted_at" + t.index ["client_id"], name: "index_enter_ngos_on_client_id" + t.index ["client_id"], name: "index_enter_ngos_on_client_id" + t.index ["deleted_at"], name: "index_enter_ngos_on_deleted_at" + t.index ["deleted_at"], name: "index_enter_ngos_on_deleted_at" + end + + create_table "exit_ngos", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.string "exit_circumstance", default: "" + t.string "other_info_of_exit", default: "" + t.string "exit_reasons", default: [], array: true + t.text "exit_note", default: "" + t.date "exit_date" + t.datetime "created_at" + t.datetime "updated_at" + t.datetime "deleted_at" + t.index ["client_id"], name: "index_exit_ngos_on_client_id" + t.index ["client_id"], name: "index_exit_ngos_on_client_id" + t.index ["deleted_at"], name: "index_exit_ngos_on_deleted_at" + t.index ["deleted_at"], name: "index_exit_ngos_on_deleted_at" + end + + create_table "exit_ngos", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.string "exit_circumstance", default: "" + t.string "other_info_of_exit", default: "" + t.string "exit_reasons", default: [], array: true + t.text "exit_note", default: "" + t.date "exit_date" + t.datetime "created_at" + t.datetime "updated_at" + t.datetime "deleted_at" + t.index ["client_id"], name: "index_exit_ngos_on_client_id" + t.index ["client_id"], name: "index_exit_ngos_on_client_id" + t.index ["deleted_at"], name: "index_exit_ngos_on_deleted_at" + t.index ["deleted_at"], name: "index_exit_ngos_on_deleted_at" + end + + create_table "external_system_global_identities", id: :integer, default: nil, force: :cascade do |t| + t.integer "external_system_id" + t.string "global_id" + t.string "external_id" + t.string "client_slug" + t.string "organization_name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id" + t.index ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id" + t.index ["global_id"], name: "index_external_system_global_identities_on_global_id" + t.index ["global_id"], name: "index_external_system_global_identities_on_global_id" + end + + create_table "external_system_global_identities", id: :integer, default: nil, force: :cascade do |t| + t.integer "external_system_id" + t.string "global_id" + t.string "external_id" + t.string "client_slug" + t.string "organization_name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id" + t.index ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id" + t.index ["global_id"], name: "index_external_system_global_identities_on_global_id" + t.index ["global_id"], name: "index_external_system_global_identities_on_global_id" + end + + create_table "external_systems", id: :integer, default: nil, force: :cascade do |t| + t.string "name" + t.string "url" + t.string "token" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "external_systems", id: :integer, default: nil, force: :cascade do |t| + t.string "name" + t.string "url" + t.string "token" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "families", id: :serial, force: :cascade do |t| + t.string "code" + t.string "name", default: "" + t.string "address", default: "" + t.text "caregiver_information", default: "" + t.integer "significant_family_member_count", default: 1 + t.float "household_income", default: 0.0 + t.boolean "dependable_income", default: false + t.integer "female_children_count", default: 0 + t.integer "male_children_count", default: 0 + t.integer "female_adult_count", default: 0 + t.integer "male_adult_count", default: 0 + t.string "family_type", default: "kinship" + t.date "contract_date" + t.integer "province_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "cases_count", default: 0 + t.string "case_history", default: "" + t.integer "children", default: [], array: true + t.string "status", default: "" + t.integer "district_id" + t.string "old_commune", default: "" + t.string "old_village", default: "" + t.string "house", default: "" + t.string "street", default: "" + t.integer "commune_id" + t.integer "village_id" + t.integer "user_id" + t.datetime "deleted_at" + t.string "slug", default: "" + t.index ["commune_id"], name: "index_families_on_commune_id" + t.index ["commune_id"], name: "index_families_on_commune_id" + t.index ["deleted_at"], name: "index_families_on_deleted_at" + t.index ["deleted_at"], name: "index_families_on_deleted_at" + t.index ["district_id"], name: "index_families_on_district_id" + t.index ["district_id"], name: "index_families_on_district_id" + t.index ["user_id"], name: "index_families_on_user_id" + t.index ["user_id"], name: "index_families_on_user_id" + t.index ["village_id"], name: "index_families_on_village_id" + t.index ["village_id"], name: "index_families_on_village_id" + end + + create_table "families", id: :serial, force: :cascade do |t| + t.string "code" + t.string "name", default: "" + t.string "address", default: "" + t.text "caregiver_information", default: "" + t.integer "significant_family_member_count", default: 1 + t.float "household_income", default: 0.0 + t.boolean "dependable_income", default: false + t.integer "female_children_count", default: 0 + t.integer "male_children_count", default: 0 + t.integer "female_adult_count", default: 0 + t.integer "male_adult_count", default: 0 + t.string "family_type", default: "kinship" + t.date "contract_date" + t.integer "province_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "cases_count", default: 0 + t.string "case_history", default: "" + t.integer "children", default: [], array: true + t.string "status", default: "" + t.integer "district_id" + t.string "old_commune", default: "" + t.string "old_village", default: "" + t.string "house", default: "" + t.string "street", default: "" + t.integer "commune_id" + t.integer "village_id" + t.integer "user_id" + t.datetime "deleted_at" + t.string "slug", default: "" + t.index ["commune_id"], name: "index_families_on_commune_id" + t.index ["commune_id"], name: "index_families_on_commune_id" + t.index ["deleted_at"], name: "index_families_on_deleted_at" + t.index ["deleted_at"], name: "index_families_on_deleted_at" + t.index ["district_id"], name: "index_families_on_district_id" + t.index ["district_id"], name: "index_families_on_district_id" + t.index ["user_id"], name: "index_families_on_user_id" + t.index ["user_id"], name: "index_families_on_user_id" + t.index ["village_id"], name: "index_families_on_village_id" + t.index ["village_id"], name: "index_families_on_village_id" + end + + create_table "family_members", id: :serial, force: :cascade do |t| + t.string "adult_name", default: "" + t.date "date_of_birth" + t.string "occupation", default: "" + t.string "relation", default: "" + t.integer "family_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "guardian", default: false + t.string "gender" + t.text "note" + t.index ["family_id"], name: "index_family_members_on_family_id" + t.index ["family_id"], name: "index_family_members_on_family_id" + end + + create_table "family_members", id: :serial, force: :cascade do |t| + t.string "adult_name", default: "" + t.date "date_of_birth" + t.string "occupation", default: "" + t.string "relation", default: "" + t.integer "family_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "guardian", default: false + t.string "gender" + t.text "note" + t.index ["family_id"], name: "index_family_members_on_family_id" + t.index ["family_id"], name: "index_family_members_on_family_id" + end + + create_table "family_plans", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "priority" + end + + create_table "family_plans", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "priority" + end + + create_table "family_referrals", id: :serial, force: :cascade do |t| + t.string "slug", default: "" + t.date "date_of_referral" + t.string "referred_to", default: "" + t.string "referred_from", default: "" + t.text "referral_reason", default: "" + t.string "name_of_referee", default: "" + t.string "referral_phone", default: "" + t.string "name_of_family", default: "" + t.string "ngo_name", default: "" + t.integer "referee_id" + t.boolean "saved", default: false + t.string "consent_form", default: [], array: true + t.integer "family_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["family_id"], name: "index_family_referrals_on_family_id" + t.index ["family_id"], name: "index_family_referrals_on_family_id" + end + + create_table "family_referrals", id: :serial, force: :cascade do |t| + t.string "slug", default: "" + t.date "date_of_referral" + t.string "referred_to", default: "" + t.string "referred_from", default: "" + t.text "referral_reason", default: "" + t.string "name_of_referee", default: "" + t.string "referral_phone", default: "" + t.string "name_of_family", default: "" + t.string "ngo_name", default: "" + t.integer "referee_id" + t.boolean "saved", default: false + t.string "consent_form", default: [], array: true + t.integer "family_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["family_id"], name: "index_family_referrals_on_family_id" + t.index ["family_id"], name: "index_family_referrals_on_family_id" + end + + create_table "field_setting_translations", id: :serial, force: :cascade do |t| + t.integer "field_setting_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "label" + t.index ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id" + t.index ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id" + t.index ["locale"], name: "index_field_setting_translations_on_locale" + t.index ["locale"], name: "index_field_setting_translations_on_locale" + end + + create_table "field_setting_translations", id: :serial, force: :cascade do |t| + t.integer "field_setting_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "label" + t.index ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id" + t.index ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id" + t.index ["locale"], name: "index_field_setting_translations_on_locale" + t.index ["locale"], name: "index_field_setting_translations_on_locale" + end + + create_table "field_settings", id: :serial, force: :cascade do |t| + t.string "name", null: false + t.string "group", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "type", default: "field", null: false + t.boolean "visible", default: true, null: false + t.string "current_label" + t.boolean "required", default: false + t.string "klass_name" + t.string "for_instances" + t.boolean "label_only", default: false + end + + create_table "field_settings", id: :serial, force: :cascade do |t| + t.string "name", null: false + t.string "group", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "type", default: "field", null: false + t.boolean "visible", default: true, null: false + t.string "current_label" + t.boolean "required", default: false + t.string "klass_name" + t.string "for_instances" + t.boolean "label_only", default: false + end + + create_table "form_builder_attachments", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.jsonb "file", default: [] + t.string "form_buildable_type" + t.integer "form_buildable_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "form_builder_attachments", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.jsonb "file", default: [] + t.string "form_buildable_type" + t.integer "form_buildable_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "friendly_id_slugs", id: :serial, force: :cascade do |t| + t.string "slug", null: false + t.integer "sluggable_id", null: false + t.string "sluggable_type", limit: 50 + t.string "scope" + t.datetime "created_at" + t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true + t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true + t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" + t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" + t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" + t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" + end + + create_table "friendly_id_slugs", id: :serial, force: :cascade do |t| + t.string "slug", null: false + t.integer "sluggable_id", null: false + t.string "sluggable_type", limit: 50 + t.string "scope" + t.datetime "created_at" + t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true + t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true + t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" + t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" + t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" + t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" + end + + create_table "global_identities", id: false, force: :cascade do |t| + t.string "ulid" + t.index ["ulid"], name: "index_global_identities_on_ulid", unique: true + t.index ["ulid"], name: "index_global_identities_on_ulid", unique: true + end + + create_table "global_identities", id: false, force: :cascade do |t| + t.string "ulid" + t.index ["ulid"], name: "index_global_identities_on_ulid", unique: true + t.index ["ulid"], name: "index_global_identities_on_ulid", unique: true + end + + create_table "global_identity_organizations", id: :integer, default: nil, force: :cascade do |t| + t.string "global_id" + t.integer "organization_id" + t.integer "client_id" + t.index ["client_id"], name: "index_global_identity_organizations_on_client_id" + t.index ["client_id"], name: "index_global_identity_organizations_on_client_id" + t.index ["global_id"], name: "index_global_identity_organizations_on_global_id" + t.index ["global_id"], name: "index_global_identity_organizations_on_global_id" + t.index ["organization_id"], name: "index_global_identity_organizations_on_organization_id" + t.index ["organization_id"], name: "index_global_identity_organizations_on_organization_id" + end + + create_table "global_identity_organizations", id: :integer, default: nil, force: :cascade do |t| + t.string "global_id" + t.integer "organization_id" + t.integer "client_id" + t.index ["client_id"], name: "index_global_identity_organizations_on_client_id" + t.index ["client_id"], name: "index_global_identity_organizations_on_client_id" + t.index ["global_id"], name: "index_global_identity_organizations_on_global_id" + t.index ["global_id"], name: "index_global_identity_organizations_on_global_id" + t.index ["organization_id"], name: "index_global_identity_organizations_on_organization_id" + t.index ["organization_id"], name: "index_global_identity_organizations_on_organization_id" + end + + create_table "global_identity_tmp", id: :integer, default: nil, force: :cascade do |t| + t.binary "ulid" + t.string "ngo_name" + t.integer "client_id" + end + + create_table "global_identity_tmp", id: :integer, default: nil, force: :cascade do |t| + t.binary "ulid" + t.string "ngo_name" + t.integer "client_id" + end + + create_table "global_services", id: false, force: :cascade do |t| + t.uuid "uuid" + t.index ["uuid"], name: "index_global_services_on_uuid", unique: true + t.index ["uuid"], name: "index_global_services_on_uuid", unique: true + end + + create_table "global_services", id: false, force: :cascade do |t| + t.uuid "uuid" + t.index ["uuid"], name: "index_global_services_on_uuid", unique: true + t.index ["uuid"], name: "index_global_services_on_uuid", unique: true + end + + create_table "government_form_children_plans", id: :serial, force: :cascade do |t| + t.text "goal", default: "" + t.text "action", default: "" + t.text "who", default: "" + t.integer "government_form_id" + t.integer "children_plan_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "score" + t.text "comment", default: "" + t.date "completion_date" + t.index ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id" + t.index ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id" + t.index ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id" + end + + create_table "government_form_children_plans", id: :serial, force: :cascade do |t| + t.text "goal", default: "" + t.text "action", default: "" + t.text "who", default: "" + t.integer "government_form_id" + t.integer "children_plan_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "score" + t.text "comment", default: "" + t.date "completion_date" + t.index ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id" + t.index ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id" + t.index ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id" + end + + create_table "government_form_family_plans", id: :serial, force: :cascade do |t| + t.text "goal", default: "" + t.text "action", default: "" + t.text "result", default: "" + t.integer "government_form_id" + t.integer "family_plan_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "score" + t.text "comment", default: "" + t.index ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id" + t.index ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id" + t.index ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id" + end + + create_table "government_form_family_plans", id: :serial, force: :cascade do |t| + t.text "goal", default: "" + t.text "action", default: "" + t.text "result", default: "" + t.integer "government_form_id" + t.integer "family_plan_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "score" + t.text "comment", default: "" + t.index ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id" + t.index ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id" + t.index ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id" + end + + create_table "government_form_interviewees", id: :serial, force: :cascade do |t| + t.integer "government_form_id" + t.integer "interviewee_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id" + t.index ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id" + t.index ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id" + end + + create_table "government_form_interviewees", id: :serial, force: :cascade do |t| + t.integer "government_form_id" + t.integer "interviewee_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id" + t.index ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id" + t.index ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id" + end + + create_table "government_form_needs", id: :serial, force: :cascade do |t| + t.integer "rank" + t.integer "need_id" + t.integer "government_form_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["government_form_id"], name: "index_government_form_needs_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_needs_on_government_form_id" + t.index ["need_id"], name: "index_government_form_needs_on_need_id" + t.index ["need_id"], name: "index_government_form_needs_on_need_id" + end + + create_table "government_form_needs", id: :serial, force: :cascade do |t| + t.integer "rank" + t.integer "need_id" + t.integer "government_form_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["government_form_id"], name: "index_government_form_needs_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_needs_on_government_form_id" + t.index ["need_id"], name: "index_government_form_needs_on_need_id" + t.index ["need_id"], name: "index_government_form_needs_on_need_id" + end + + create_table "government_form_problems", id: :serial, force: :cascade do |t| + t.integer "rank" + t.integer "problem_id" + t.integer "government_form_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["government_form_id"], name: "index_government_form_problems_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_problems_on_government_form_id" + t.index ["problem_id"], name: "index_government_form_problems_on_problem_id" + t.index ["problem_id"], name: "index_government_form_problems_on_problem_id" + end + + create_table "government_form_problems", id: :serial, force: :cascade do |t| + t.integer "rank" + t.integer "problem_id" + t.integer "government_form_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["government_form_id"], name: "index_government_form_problems_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_problems_on_government_form_id" + t.index ["problem_id"], name: "index_government_form_problems_on_problem_id" + t.index ["problem_id"], name: "index_government_form_problems_on_problem_id" + end + + create_table "government_form_service_types", id: :serial, force: :cascade do |t| + t.integer "government_form_id" + t.integer "service_type_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["government_form_id"], name: "index_government_form_service_types_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_service_types_on_government_form_id" + t.index ["service_type_id"], name: "index_government_form_service_types_on_service_type_id" + t.index ["service_type_id"], name: "index_government_form_service_types_on_service_type_id" + end + + create_table "government_form_service_types", id: :serial, force: :cascade do |t| + t.integer "government_form_id" + t.integer "service_type_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["government_form_id"], name: "index_government_form_service_types_on_government_form_id" + t.index ["government_form_id"], name: "index_government_form_service_types_on_government_form_id" + t.index ["service_type_id"], name: "index_government_form_service_types_on_service_type_id" + t.index ["service_type_id"], name: "index_government_form_service_types_on_service_type_id" + end + + create_table "government_forms", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.date "date" + t.string "client_code", default: "" + t.integer "interview_district_id" + t.integer "interview_province_id" + t.integer "case_worker_id" + t.string "case_worker_phone", default: "" + t.integer "client_id" + t.string "primary_carer_relationship", default: "" + t.string "primary_carer_house", default: "" + t.string "primary_carer_street", default: "" + t.integer "primary_carer_district_id" + t.integer "primary_carer_province_id" + t.text "source_info", default: "" + t.text "summary_info_of_referral", default: "" + t.text "guardian_comment", default: "" + t.text "case_worker_comment", default: "" + t.string "other_interviewee", default: "" + t.string "other_client_type", default: "" + t.string "other_need", default: "" + t.string "other_problem", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.string "caseworker_assumption", default: "" + t.text "assumption_description", default: "" + t.date "assumption_date" + t.string "contact_type", default: "" + t.string "client_decision", default: "" + t.string "other_service_type", default: "" + t.date "gov_placement_date" + t.string "care_type", default: "" + t.string "primary_carer", default: "" + t.string "secondary_carer", default: "" + t.string "carer_contact_info", default: "" + t.integer "assessment_province_id" + t.integer "assessment_district_id" + t.string "new_carer", default: "" + t.string "new_carer_gender", default: "" + t.date "new_carer_date_of_birth" + t.string "new_carer_relationship", default: "" + t.integer "interview_commune_id" + t.integer "interview_village_id" + t.integer "assessment_commune_id" + t.integer "primary_carer_commune_id" + t.integer "primary_carer_village_id" + t.text "recent_issues_and_progress", default: "" + t.string "other_case_closure" + t.text "brief_case_history" + t.integer "case_closure_id" + t.index ["client_id"], name: "index_government_forms_on_client_id" + t.index ["client_id"], name: "index_government_forms_on_client_id" + t.index ["commune_id"], name: "index_government_forms_on_commune_id" + t.index ["commune_id"], name: "index_government_forms_on_commune_id" + t.index ["district_id"], name: "index_government_forms_on_district_id" + t.index ["district_id"], name: "index_government_forms_on_district_id" + t.index ["province_id"], name: "index_government_forms_on_province_id" + t.index ["province_id"], name: "index_government_forms_on_province_id" + t.index ["village_id"], name: "index_government_forms_on_village_id" + t.index ["village_id"], name: "index_government_forms_on_village_id" + end + + create_table "government_forms", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.date "date" + t.string "client_code", default: "" + t.integer "interview_district_id" + t.integer "interview_province_id" + t.integer "case_worker_id" + t.string "case_worker_phone", default: "" + t.integer "client_id" + t.string "primary_carer_relationship", default: "" + t.string "primary_carer_house", default: "" + t.string "primary_carer_street", default: "" + t.integer "primary_carer_district_id" + t.integer "primary_carer_province_id" + t.text "source_info", default: "" + t.text "summary_info_of_referral", default: "" + t.text "guardian_comment", default: "" + t.text "case_worker_comment", default: "" + t.string "other_interviewee", default: "" + t.string "other_client_type", default: "" + t.string "other_need", default: "" + t.string "other_problem", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.string "caseworker_assumption", default: "" + t.text "assumption_description", default: "" + t.date "assumption_date" + t.string "contact_type", default: "" + t.string "client_decision", default: "" + t.string "other_service_type", default: "" + t.date "gov_placement_date" + t.string "care_type", default: "" + t.string "primary_carer", default: "" + t.string "secondary_carer", default: "" + t.string "carer_contact_info", default: "" + t.integer "assessment_province_id" + t.integer "assessment_district_id" + t.string "new_carer", default: "" + t.string "new_carer_gender", default: "" + t.date "new_carer_date_of_birth" + t.string "new_carer_relationship", default: "" + t.integer "interview_commune_id" + t.integer "interview_village_id" + t.integer "assessment_commune_id" + t.integer "primary_carer_commune_id" + t.integer "primary_carer_village_id" + t.text "recent_issues_and_progress", default: "" + t.string "other_case_closure" + t.text "brief_case_history" + t.integer "case_closure_id" + t.index ["client_id"], name: "index_government_forms_on_client_id" + t.index ["client_id"], name: "index_government_forms_on_client_id" + t.index ["commune_id"], name: "index_government_forms_on_commune_id" + t.index ["commune_id"], name: "index_government_forms_on_commune_id" + t.index ["district_id"], name: "index_government_forms_on_district_id" + t.index ["district_id"], name: "index_government_forms_on_district_id" + t.index ["province_id"], name: "index_government_forms_on_province_id" + t.index ["province_id"], name: "index_government_forms_on_province_id" + t.index ["village_id"], name: "index_government_forms_on_village_id" + t.index ["village_id"], name: "index_government_forms_on_village_id" + end + + create_table "government_reports", id: :serial, force: :cascade do |t| + t.string "code", default: "" + t.string "initial_capital", default: "" + t.string "initial_city", default: "" + t.string "initial_commune", default: "" + t.date "initial_date" + t.string "client_code", default: "" + t.string "commune", default: "" + t.string "city", default: "" + t.string "capital", default: "" + t.string "organisation_name", default: "" + t.string "organisation_phone_number", default: "" + t.string "client_name", default: "" + t.date "client_date_of_birth" + t.string "client_gender", default: "" + t.string "found_client_at", default: "" + t.string "found_client_village", default: "" + t.string "education", default: "" + t.string "carer_name", default: "" + t.string "client_contact", default: "" + t.string "carer_house_number", default: "" + t.string "carer_street_number", default: "" + t.string "carer_village", default: "" + t.string "carer_commune", default: "" + t.string "carer_city", default: "" + t.string "carer_capital", default: "" + t.string "carer_phone_number", default: "" + t.date "case_information_date" + t.string "referral_name", default: "" + t.string "referral_position", default: "" + t.boolean "anonymous", default: false + t.text "anonymous_description", default: "" + t.boolean "client_living_with_guardian", default: false + t.text "present_physical_health", default: "" + t.text "physical_health_need", default: "" + t.text "physical_health_plan", default: "" + t.text "present_supplies", default: "" + t.text "supplies_need", default: "" + t.text "supplies_plan", default: "" + t.text "present_education", default: "" + t.text "education_need", default: "" + t.text "education_plan", default: "" + t.text "present_family_communication", default: "" + t.text "family_communication_need", default: "" + t.text "family_communication_plan", default: "" + t.text "present_society_communication", default: "" + t.text "society_communication_need", default: "" + t.text "society_communication_plan", default: "" + t.text "present_emotional_health", default: "" + t.text "emotional_health_need", default: "" + t.text "emotional_health_plan", default: "" + t.boolean "mission_obtainable", default: false + t.boolean "first_mission", default: false + t.boolean "second_mission", default: false + t.boolean "third_mission", default: false + t.boolean "fourth_mission", default: false + t.date "done_date" + t.date "agreed_date" + t.integer "client_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "government_reports", id: :serial, force: :cascade do |t| + t.string "code", default: "" + t.string "initial_capital", default: "" + t.string "initial_city", default: "" + t.string "initial_commune", default: "" + t.date "initial_date" + t.string "client_code", default: "" + t.string "commune", default: "" + t.string "city", default: "" + t.string "capital", default: "" + t.string "organisation_name", default: "" + t.string "organisation_phone_number", default: "" + t.string "client_name", default: "" + t.date "client_date_of_birth" + t.string "client_gender", default: "" + t.string "found_client_at", default: "" + t.string "found_client_village", default: "" + t.string "education", default: "" + t.string "carer_name", default: "" + t.string "client_contact", default: "" + t.string "carer_house_number", default: "" + t.string "carer_street_number", default: "" + t.string "carer_village", default: "" + t.string "carer_commune", default: "" + t.string "carer_city", default: "" + t.string "carer_capital", default: "" + t.string "carer_phone_number", default: "" + t.date "case_information_date" + t.string "referral_name", default: "" + t.string "referral_position", default: "" + t.boolean "anonymous", default: false + t.text "anonymous_description", default: "" + t.boolean "client_living_with_guardian", default: false + t.text "present_physical_health", default: "" + t.text "physical_health_need", default: "" + t.text "physical_health_plan", default: "" + t.text "present_supplies", default: "" + t.text "supplies_need", default: "" + t.text "supplies_plan", default: "" + t.text "present_education", default: "" + t.text "education_need", default: "" + t.text "education_plan", default: "" + t.text "present_family_communication", default: "" + t.text "family_communication_need", default: "" + t.text "family_communication_plan", default: "" + t.text "present_society_communication", default: "" + t.text "society_communication_need", default: "" + t.text "society_communication_plan", default: "" + t.text "present_emotional_health", default: "" + t.text "emotional_health_need", default: "" + t.text "emotional_health_plan", default: "" + t.boolean "mission_obtainable", default: false + t.boolean "first_mission", default: false + t.boolean "second_mission", default: false + t.boolean "third_mission", default: false + t.boolean "fourth_mission", default: false + t.date "done_date" + t.date "agreed_date" + t.integer "client_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "hotlines", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "call_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["call_id"], name: "index_hotlines_on_call_id" + t.index ["call_id"], name: "index_hotlines_on_call_id" + t.index ["client_id"], name: "index_hotlines_on_client_id" + t.index ["client_id"], name: "index_hotlines_on_client_id" + end + + create_table "hotlines", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "call_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["call_id"], name: "index_hotlines_on_call_id" + t.index ["call_id"], name: "index_hotlines_on_call_id" + t.index ["client_id"], name: "index_hotlines_on_client_id" + t.index ["client_id"], name: "index_hotlines_on_client_id" + end + + create_table "interventions", id: :serial, force: :cascade do |t| + t.string "action", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "interventions", id: :serial, force: :cascade do |t| + t.string "action", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "interviewees", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "interviewees", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "leave_programs", id: :serial, force: :cascade do |t| + t.jsonb "properties", default: {} + t.integer "client_enrollment_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "program_stream_id" + t.date "exit_date" + t.datetime "deleted_at" + t.integer "enrollment_id" + t.index ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id" + t.index ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id" + t.index ["deleted_at"], name: "index_leave_programs_on_deleted_at" + t.index ["deleted_at"], name: "index_leave_programs_on_deleted_at" + t.index ["enrollment_id"], name: "index_leave_programs_on_enrollment_id" + t.index ["enrollment_id"], name: "index_leave_programs_on_enrollment_id" + end + + create_table "leave_programs", id: :serial, force: :cascade do |t| + t.jsonb "properties", default: {} + t.integer "client_enrollment_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "program_stream_id" + t.date "exit_date" + t.datetime "deleted_at" + t.integer "enrollment_id" + t.index ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id" + t.index ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id" + t.index ["deleted_at"], name: "index_leave_programs_on_deleted_at" + t.index ["deleted_at"], name: "index_leave_programs_on_deleted_at" + t.index ["enrollment_id"], name: "index_leave_programs_on_enrollment_id" + t.index ["enrollment_id"], name: "index_leave_programs_on_enrollment_id" + end + + create_table "locations", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "order_option", default: 0 + end + + create_table "locations", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "order_option", default: 0 + end + + create_table "materials", id: :serial, force: :cascade do |t| + t.string "status", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "materials", id: :serial, force: :cascade do |t| + t.string "status", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "meta_fields", id: :serial, force: :cascade do |t| + t.string "field_name" + t.string "field_type" + t.boolean "hidden", default: true + t.boolean "required", default: false + t.string "label" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "necessities", id: :serial, force: :cascade do |t| + t.string "content", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "necessities", id: :serial, force: :cascade do |t| + t.string "content", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "needs", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "needs", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "oauth_access_grants", id: :integer, default: nil, force: :cascade do |t| + t.integer "resource_owner_id", null: false + t.integer "application_id", null: false + t.string "token", null: false + t.integer "expires_in", null: false + t.text "redirect_uri", null: false + t.datetime "created_at", null: false + t.datetime "revoked_at" + t.string "scopes" + t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true + t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true + end + + create_table "oauth_access_grants", id: :integer, default: nil, force: :cascade do |t| + t.integer "resource_owner_id", null: false + t.integer "application_id", null: false + t.string "token", null: false + t.integer "expires_in", null: false + t.text "redirect_uri", null: false + t.datetime "created_at", null: false + t.datetime "revoked_at" + t.string "scopes" + t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true + t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true + end + + create_table "oauth_access_tokens", id: :integer, default: nil, force: :cascade do |t| + t.integer "resource_owner_id" + t.integer "application_id" + t.string "token", null: false + t.string "refresh_token" + t.integer "expires_in" + t.datetime "revoked_at" + t.datetime "created_at", null: false + t.string "scopes" + t.string "previous_refresh_token", default: "", null: false + t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true + t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true + t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" + t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" + t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true + t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true + end + + create_table "oauth_access_tokens", id: :integer, default: nil, force: :cascade do |t| + t.integer "resource_owner_id" + t.integer "application_id" + t.string "token", null: false + t.string "refresh_token" + t.integer "expires_in" + t.datetime "revoked_at" + t.datetime "created_at", null: false + t.string "scopes" + t.string "previous_refresh_token", default: "", null: false + t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true + t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true + t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" + t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" + t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true + t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true + end + + create_table "oauth_applications", id: :integer, default: nil, force: :cascade do |t| + t.string "name", null: false + t.string "uid", null: false + t.string "secret", null: false + t.text "redirect_uri", null: false + t.string "scopes", default: "", null: false + t.boolean "confidential", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true + t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true + end + + create_table "oauth_applications", id: :integer, default: nil, force: :cascade do |t| + t.string "name", null: false + t.string "uid", null: false + t.string "secret", null: false + t.text "redirect_uri", null: false + t.string "scopes", default: "", null: false + t.boolean "confidential", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true + t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true + end + + create_table "organization_types", id: :serial, force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "organization_types", id: :serial, force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "organizations", id: :serial, force: :cascade do |t| + t.string "full_name" + t.string "short_name" + t.string "logo" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "fcf_ngo", default: false + t.string "country", default: "" + t.boolean "aht", default: false + t.boolean "integrated", default: false + t.string "supported_languages", default: ["km", "en", "my"], array: true + t.integer "clients_count", default: 0 + t.integer "active_client", default: 0 + t.integer "accepted_client", default: 0 + t.boolean "demo", default: false + t.string "referral_source_category_name" + end + + create_table "organizations", id: :serial, force: :cascade do |t| + t.string "full_name" + t.string "short_name" + t.string "logo" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "fcf_ngo", default: false + t.string "country", default: "" + t.boolean "aht", default: false + t.boolean "integrated", default: false + t.string "supported_languages", default: ["km", "en", "my"], array: true + t.integer "clients_count", default: 0 + t.integer "active_client", default: 0 + t.integer "accepted_client", default: 0 + t.boolean "demo", default: false + t.string "referral_source_category_name" + end + + create_table "partners", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.string "address", default: "" + t.date "start_date" + t.string "contact_person_name", default: "" + t.string "contact_person_email", default: "" + t.string "contact_person_mobile", default: "" + t.string "archive_organization_type", default: "" + t.string "affiliation", default: "" + t.string "engagement", default: "" + t.text "background", default: "" + t.integer "province_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "cases_count", default: 0 + t.integer "organization_type_id" + t.index ["organization_type_id"], name: "index_partners_on_organization_type_id" + t.index ["organization_type_id"], name: "index_partners_on_organization_type_id" + end + + create_table "partners", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.string "address", default: "" + t.date "start_date" + t.string "contact_person_name", default: "" + t.string "contact_person_email", default: "" + t.string "contact_person_mobile", default: "" + t.string "archive_organization_type", default: "" + t.string "affiliation", default: "" + t.string "engagement", default: "" + t.text "background", default: "" + t.integer "province_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "cases_count", default: 0 + t.integer "organization_type_id" + t.index ["organization_type_id"], name: "index_partners_on_organization_type_id" + t.index ["organization_type_id"], name: "index_partners_on_organization_type_id" + end + + create_table "permissions", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.boolean "case_notes_readable", default: true + t.boolean "case_notes_editable", default: true + t.boolean "assessments_editable", default: true + t.boolean "assessments_readable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_permissions_on_user_id" + t.index ["user_id"], name: "index_permissions_on_user_id" + end + + create_table "permissions", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.boolean "case_notes_readable", default: true + t.boolean "case_notes_editable", default: true + t.boolean "assessments_editable", default: true + t.boolean "assessments_readable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_permissions_on_user_id" + t.index ["user_id"], name: "index_permissions_on_user_id" + end + + create_table "problems", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "problems", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "program_stream_permissions", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "program_stream_id" + t.boolean "readable", default: true + t.boolean "editable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at" + t.index ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at" + t.index ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id" + t.index ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id" + t.index ["user_id"], name: "index_program_stream_permissions_on_user_id" + t.index ["user_id"], name: "index_program_stream_permissions_on_user_id" + end + + create_table "program_stream_permissions", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "program_stream_id" + t.boolean "readable", default: true + t.boolean "editable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at" + t.index ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at" + t.index ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id" + t.index ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id" + t.index ["user_id"], name: "index_program_stream_permissions_on_user_id" + t.index ["user_id"], name: "index_program_stream_permissions_on_user_id" + end + + create_table "program_stream_services", id: :serial, force: :cascade do |t| + t.datetime "deleted_at" + t.integer "program_stream_id" + t.integer "service_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["deleted_at"], name: "index_program_stream_services_on_deleted_at" + t.index ["deleted_at"], name: "index_program_stream_services_on_deleted_at" + t.index ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id" + t.index ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id" + t.index ["service_id"], name: "index_program_stream_services_on_service_id" + t.index ["service_id"], name: "index_program_stream_services_on_service_id" + end + + create_table "program_stream_services", id: :serial, force: :cascade do |t| + t.datetime "deleted_at" + t.integer "program_stream_id" + t.integer "service_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["deleted_at"], name: "index_program_stream_services_on_deleted_at" + t.index ["deleted_at"], name: "index_program_stream_services_on_deleted_at" + t.index ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id" + t.index ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id" + t.index ["service_id"], name: "index_program_stream_services_on_service_id" + t.index ["service_id"], name: "index_program_stream_services_on_service_id" + end + + create_table "program_streams", id: :serial, force: :cascade do |t| + t.string "name" + t.text "description" + t.jsonb "rules", default: {} + t.jsonb "enrollment", default: {} + t.jsonb "exit_program", default: {} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "quantity" + t.string "ngo_name", default: "" + t.boolean "completed", default: false + t.integer "program_exclusive", default: [], array: true + t.integer "mutual_dependence", default: [], array: true + t.boolean "tracking_required", default: false + t.datetime "archived_at" + t.index ["archived_at"], name: "index_program_streams_on_archived_at" + t.index ["archived_at"], name: "index_program_streams_on_archived_at" + end + + create_table "program_streams", id: :serial, force: :cascade do |t| + t.string "name" + t.text "description" + t.jsonb "rules", default: {} + t.jsonb "enrollment", default: {} + t.jsonb "exit_program", default: {} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "quantity" + t.string "ngo_name", default: "" + t.boolean "completed", default: false + t.integer "program_exclusive", default: [], array: true + t.integer "mutual_dependence", default: [], array: true + t.boolean "tracking_required", default: false + t.datetime "archived_at" + t.index ["archived_at"], name: "index_program_streams_on_archived_at" + t.index ["archived_at"], name: "index_program_streams_on_archived_at" + end + + create_table "progress_note_types", id: :serial, force: :cascade do |t| + t.string "note_type", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "progress_note_types", id: :serial, force: :cascade do |t| + t.string "note_type", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "progress_notes", id: :serial, force: :cascade do |t| + t.date "date" + t.string "other_location", default: "" + t.text "response", default: "" + t.text "additional_note", default: "" + t.integer "client_id" + t.integer "progress_note_type_id" + t.integer "location_id" + t.integer "material_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "user_id" + t.index ["client_id"], name: "index_progress_notes_on_client_id" + t.index ["client_id"], name: "index_progress_notes_on_client_id" + t.index ["location_id"], name: "index_progress_notes_on_location_id" + t.index ["location_id"], name: "index_progress_notes_on_location_id" + t.index ["material_id"], name: "index_progress_notes_on_material_id" + t.index ["material_id"], name: "index_progress_notes_on_material_id" + t.index ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id" + t.index ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id" + t.index ["user_id"], name: "index_progress_notes_on_user_id" + t.index ["user_id"], name: "index_progress_notes_on_user_id" + end + + create_table "progress_notes", id: :serial, force: :cascade do |t| + t.date "date" + t.string "other_location", default: "" + t.text "response", default: "" + t.text "additional_note", default: "" + t.integer "client_id" + t.integer "progress_note_type_id" + t.integer "location_id" + t.integer "material_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "user_id" + t.index ["client_id"], name: "index_progress_notes_on_client_id" + t.index ["client_id"], name: "index_progress_notes_on_client_id" + t.index ["location_id"], name: "index_progress_notes_on_location_id" + t.index ["location_id"], name: "index_progress_notes_on_location_id" + t.index ["material_id"], name: "index_progress_notes_on_material_id" + t.index ["material_id"], name: "index_progress_notes_on_material_id" + t.index ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id" + t.index ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id" + t.index ["user_id"], name: "index_progress_notes_on_user_id" + t.index ["user_id"], name: "index_progress_notes_on_user_id" + end + + create_table "protection_concerns", id: :serial, force: :cascade do |t| + t.string "content", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "protection_concerns", id: :serial, force: :cascade do |t| + t.string "content", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "provinces", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "cases_count", default: 0 + t.integer "clients_count", default: 0 + t.integer "families_count", default: 0 + t.integer "partners_count", default: 0 + t.integer "users_count", default: 0, null: false + t.string "country" + end + + create_table "provinces", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "cases_count", default: 0 + t.integer "clients_count", default: 0 + t.integer "families_count", default: 0 + t.integer "partners_count", default: 0 + t.integer "users_count", default: 0, null: false + t.string "country" + end + + create_table "quantitative_cases", id: :serial, force: :cascade do |t| + t.string "value", default: "" + t.integer "quantitative_type_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "quantitative_cases", id: :serial, force: :cascade do |t| + t.string "value", default: "" + t.integer "quantitative_type_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "quantitative_type_permissions", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "quantitative_type_id" + t.boolean "readable", default: true + t.boolean "editable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id" + t.index ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id" + t.index ["user_id"], name: "index_quantitative_type_permissions_on_user_id" + t.index ["user_id"], name: "index_quantitative_type_permissions_on_user_id" + end + + create_table "quantitative_type_permissions", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "quantitative_type_id" + t.boolean "readable", default: true + t.boolean "editable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id" + t.index ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id" + t.index ["user_id"], name: "index_quantitative_type_permissions_on_user_id" + t.index ["user_id"], name: "index_quantitative_type_permissions_on_user_id" + end + + create_table "quantitative_types", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.integer "quantitative_cases_count", default: 0 + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "multiple", default: true + end + + create_table "quantitative_types", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.integer "quantitative_cases_count", default: 0 + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "multiple", default: true + end + + create_table "quarterly_reports", id: :serial, force: :cascade do |t| + t.date "visit_date" + t.bigint "code" + t.integer "case_id" + t.text "general_health_or_appearance", default: "" + t.text "child_school_attendance_or_progress", default: "" + t.text "general_appearance_of_home", default: "" + t.text "observations_of_drug_alchohol_abuse", default: "" + t.text "describe_if_yes", default: "" + t.text "describe_the_family_current_situation", default: "" + t.text "has_the_situation_changed_from_the_previous_visit", default: "" + t.text "how_did_i_encourage_the_client", default: "" + t.text "what_future_teachings_or_trainings_could_help_the_client", default: "" + t.text "what_is_my_plan_for_the_next_visit_to_the_client", default: "" + t.boolean "money_and_supplies_being_used_appropriately", default: false + t.text "how_are_they_being_misused", default: "" + t.integer "staff_id" + t.text "spiritual_developments_with_the_child_or_family", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["case_id"], name: "index_quarterly_reports_on_case_id" + t.index ["case_id"], name: "index_quarterly_reports_on_case_id" + end + + create_table "quarterly_reports", id: :serial, force: :cascade do |t| + t.date "visit_date" + t.bigint "code" + t.integer "case_id" + t.text "general_health_or_appearance", default: "" + t.text "child_school_attendance_or_progress", default: "" + t.text "general_appearance_of_home", default: "" + t.text "observations_of_drug_alchohol_abuse", default: "" + t.text "describe_if_yes", default: "" + t.text "describe_the_family_current_situation", default: "" + t.text "has_the_situation_changed_from_the_previous_visit", default: "" + t.text "how_did_i_encourage_the_client", default: "" + t.text "what_future_teachings_or_trainings_could_help_the_client", default: "" + t.text "what_is_my_plan_for_the_next_visit_to_the_client", default: "" + t.boolean "money_and_supplies_being_used_appropriately", default: false + t.text "how_are_they_being_misused", default: "" + t.integer "staff_id" + t.text "spiritual_developments_with_the_child_or_family", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["case_id"], name: "index_quarterly_reports_on_case_id" + t.index ["case_id"], name: "index_quarterly_reports_on_case_id" + end + + create_table "question_groups", id: :serial, force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "question_groups", id: :serial, force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "referees", id: :serial, force: :cascade do |t| + t.string "address_type", default: "" + t.string "current_address", default: "" + t.string "email", default: "" + t.string "gender", default: "" + t.string "house_number", default: "" + t.string "outside_address", default: "" + t.string "street_number", default: "" + t.boolean "outside", default: false + t.boolean "anonymous", default: false + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name", default: "" + t.string "phone", default: "" + t.boolean "adult" + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "state_id" + t.integer "township_id" + t.integer "subdistrict_id" + t.string "locality" + t.index ["commune_id"], name: "index_referees_on_commune_id" + t.index ["commune_id"], name: "index_referees_on_commune_id" + t.index ["district_id"], name: "index_referees_on_district_id" + t.index ["district_id"], name: "index_referees_on_district_id" + t.index ["province_id"], name: "index_referees_on_province_id" + t.index ["province_id"], name: "index_referees_on_province_id" + t.index ["state_id"], name: "index_referees_on_state_id" + t.index ["state_id"], name: "index_referees_on_state_id" + t.index ["subdistrict_id"], name: "index_referees_on_subdistrict_id" + t.index ["subdistrict_id"], name: "index_referees_on_subdistrict_id" + t.index ["township_id"], name: "index_referees_on_township_id" + t.index ["township_id"], name: "index_referees_on_township_id" + t.index ["village_id"], name: "index_referees_on_village_id" + t.index ["village_id"], name: "index_referees_on_village_id" + end + + create_table "referees", id: :serial, force: :cascade do |t| + t.string "address_type", default: "" + t.string "current_address", default: "" + t.string "email", default: "" + t.string "gender", default: "" + t.string "house_number", default: "" + t.string "outside_address", default: "" + t.string "street_number", default: "" + t.boolean "outside", default: false + t.boolean "anonymous", default: false + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name", default: "" + t.string "phone", default: "" + t.boolean "adult" + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "state_id" + t.integer "township_id" + t.integer "subdistrict_id" + t.string "locality" + t.index ["commune_id"], name: "index_referees_on_commune_id" + t.index ["commune_id"], name: "index_referees_on_commune_id" + t.index ["district_id"], name: "index_referees_on_district_id" + t.index ["district_id"], name: "index_referees_on_district_id" + t.index ["province_id"], name: "index_referees_on_province_id" + t.index ["province_id"], name: "index_referees_on_province_id" + t.index ["state_id"], name: "index_referees_on_state_id" + t.index ["state_id"], name: "index_referees_on_state_id" + t.index ["subdistrict_id"], name: "index_referees_on_subdistrict_id" + t.index ["subdistrict_id"], name: "index_referees_on_subdistrict_id" + t.index ["township_id"], name: "index_referees_on_township_id" + t.index ["township_id"], name: "index_referees_on_township_id" + t.index ["village_id"], name: "index_referees_on_village_id" + t.index ["village_id"], name: "index_referees_on_village_id" + end + + create_table "referral_sources", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "clients_count", default: 0 + t.string "name_en", default: "" + t.string "ancestry" + t.index ["ancestry"], name: "index_referral_sources_on_ancestry" + t.index ["ancestry"], name: "index_referral_sources_on_ancestry" + end + + create_table "referral_sources", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "clients_count", default: 0 + t.string "name_en", default: "" + t.string "ancestry" + t.index ["ancestry"], name: "index_referral_sources_on_ancestry" + t.index ["ancestry"], name: "index_referral_sources_on_ancestry" + end + + create_table "referrals", id: :serial, force: :cascade do |t| + t.string "slug", default: "" + t.date "date_of_referral" + t.string "referred_to", default: "" + t.string "referred_from", default: "" + t.text "referral_reason", default: "" + t.string "name_of_referee", default: "" + t.string "referral_phone", default: "" + t.integer "referee_id" + t.string "client_name", default: "" + t.string "consent_form", default: [], array: true + t.boolean "saved", default: false + t.integer "client_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "ngo_name", default: "" + t.string "client_global_id" + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + t.string "client_gender", default: "" + t.date "client_date_of_birth" + t.string "village_code", default: "" + t.string "referee_email" + t.index ["client_global_id"], name: "index_referrals_on_client_global_id" + t.index ["client_global_id"], name: "index_referrals_on_client_global_id" + t.index ["client_id"], name: "index_referrals_on_client_id" + t.index ["client_id"], name: "index_referrals_on_client_id" + t.index ["external_id"], name: "index_referrals_on_external_id" + t.index ["external_id"], name: "index_referrals_on_external_id" + t.index ["mosvy_number"], name: "index_referrals_on_mosvy_number" + t.index ["mosvy_number"], name: "index_referrals_on_mosvy_number" + end + + create_table "referrals", id: :serial, force: :cascade do |t| + t.string "slug", default: "" + t.date "date_of_referral" + t.string "referred_to", default: "" + t.string "referred_from", default: "" + t.text "referral_reason", default: "" + t.string "name_of_referee", default: "" + t.string "referral_phone", default: "" + t.integer "referee_id" + t.string "client_name", default: "" + t.string "consent_form", default: [], array: true + t.boolean "saved", default: false + t.integer "client_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "ngo_name", default: "" + t.string "client_global_id" + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + t.string "client_gender", default: "" + t.date "client_date_of_birth" + t.string "village_code", default: "" + t.string "referee_email" + t.index ["client_global_id"], name: "index_referrals_on_client_global_id" + t.index ["client_global_id"], name: "index_referrals_on_client_global_id" + t.index ["client_id"], name: "index_referrals_on_client_id" + t.index ["client_id"], name: "index_referrals_on_client_id" + t.index ["external_id"], name: "index_referrals_on_external_id" + t.index ["external_id"], name: "index_referrals_on_external_id" + t.index ["mosvy_number"], name: "index_referrals_on_mosvy_number" + t.index ["mosvy_number"], name: "index_referrals_on_mosvy_number" + end + + create_table "referrals_services", id: false, force: :cascade do |t| + t.integer "referral_id" + t.integer "service_id" + end + + create_table "referrals_services", id: false, force: :cascade do |t| + t.integer "referral_id" + t.integer "service_id" + end + + create_table "service_types", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "service_types", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "services", id: :serial, force: :cascade do |t| + t.string "name" + t.integer "parent_id" + t.datetime "deleted_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.uuid "uuid" + t.index ["deleted_at"], name: "index_services_on_deleted_at" + t.index ["deleted_at"], name: "index_services_on_deleted_at" + t.index ["name"], name: "index_services_on_name" + t.index ["name"], name: "index_services_on_name" + t.index ["parent_id"], name: "index_services_on_parent_id" + t.index ["parent_id"], name: "index_services_on_parent_id" + t.index ["uuid"], name: "index_services_on_uuid" + t.index ["uuid"], name: "index_services_on_uuid" + end + + create_table "services", id: :serial, force: :cascade do |t| + t.string "name" + t.integer "parent_id" + t.datetime "deleted_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.uuid "uuid" + t.index ["deleted_at"], name: "index_services_on_deleted_at" + t.index ["deleted_at"], name: "index_services_on_deleted_at" + t.index ["name"], name: "index_services_on_name" + t.index ["name"], name: "index_services_on_name" + t.index ["parent_id"], name: "index_services_on_parent_id" + t.index ["parent_id"], name: "index_services_on_parent_id" + t.index ["uuid"], name: "index_services_on_uuid" + t.index ["uuid"], name: "index_services_on_uuid" + end + + create_table "settings", id: :serial, force: :cascade do |t| + t.string "assessment_frequency", default: "month" + t.integer "min_assessment" + t.integer "max_assessment", default: 6 + t.string "country_name", default: "" + t.integer "max_case_note" + t.string "case_note_frequency" + t.string "client_default_columns", default: [], array: true + t.string "family_default_columns", default: [], array: true + t.string "partner_default_columns", default: [], array: true + t.string "user_default_columns", default: [], array: true + t.datetime "created_at" + t.datetime "updated_at" + t.string "org_name", default: "" + t.string "old_commune", default: "" + t.integer "province_id" + t.integer "district_id" + t.integer "age", default: 18 + t.integer "commune_id" + t.string "custom_assessment", default: "Custom Assessment" + t.boolean "enable_custom_assessment", default: false + t.boolean "enable_default_assessment", default: true + t.integer "max_custom_assessment", default: 6 + t.string "custom_assessment_frequency", default: "month" + t.integer "custom_age", default: 18 + t.string "default_assessment", default: "CSI Assessment" + t.boolean "sharing_data", default: false + t.string "custom_id1_latin", default: "" + t.string "custom_id1_local", default: "" + t.string "custom_id2_latin", default: "" + t.string "custom_id2_local", default: "" + t.boolean "enable_hotline", default: false + t.boolean "enable_client_form", default: true + t.string "assessment_score_order", default: "random_order", null: false + t.boolean "disable_required_fields", default: false, null: false + t.boolean "never_delete_incomplete_assessment", default: false, null: false + t.integer "delete_incomplete_after_period_value", default: 7 + t.string "delete_incomplete_after_period_unit", default: "days" + t.boolean "use_screening_assessment", default: false + t.integer "screening_assessment_form_id" + t.boolean "show_prev_assessment", default: false + t.boolean "two_weeks_assessment_reminder", default: false + t.index ["commune_id"], name: "index_settings_on_commune_id" + t.index ["commune_id"], name: "index_settings_on_commune_id" + t.index ["district_id"], name: "index_settings_on_district_id" + t.index ["district_id"], name: "index_settings_on_district_id" + t.index ["province_id"], name: "index_settings_on_province_id" + t.index ["province_id"], name: "index_settings_on_province_id" + end + + create_table "settings", id: :serial, force: :cascade do |t| + t.string "assessment_frequency", default: "month" + t.integer "min_assessment" + t.integer "max_assessment", default: 6 + t.string "country_name", default: "" + t.integer "max_case_note" + t.string "case_note_frequency" + t.string "client_default_columns", default: [], array: true + t.string "family_default_columns", default: [], array: true + t.string "partner_default_columns", default: [], array: true + t.string "user_default_columns", default: [], array: true + t.datetime "created_at" + t.datetime "updated_at" + t.string "org_name", default: "" + t.string "old_commune", default: "" + t.integer "province_id" + t.integer "district_id" + t.integer "age", default: 18 + t.integer "commune_id" + t.string "custom_assessment", default: "Custom Assessment" + t.boolean "enable_custom_assessment", default: false + t.boolean "enable_default_assessment", default: true + t.integer "max_custom_assessment", default: 6 + t.string "custom_assessment_frequency", default: "month" + t.integer "custom_age", default: 18 + t.string "default_assessment", default: "CSI Assessment" + t.boolean "sharing_data", default: false + t.string "custom_id1_latin", default: "" + t.string "custom_id1_local", default: "" + t.string "custom_id2_latin", default: "" + t.string "custom_id2_local", default: "" + t.boolean "enable_hotline", default: false + t.boolean "enable_client_form", default: true + t.string "assessment_score_order", default: "random_order", null: false + t.boolean "disable_required_fields", default: false, null: false + t.boolean "never_delete_incomplete_assessment", default: false, null: false + t.integer "delete_incomplete_after_period_value", default: 7 + t.string "delete_incomplete_after_period_unit", default: "days" + t.boolean "use_screening_assessment", default: false + t.integer "screening_assessment_form_id" + t.boolean "show_prev_assessment", default: false + t.boolean "two_weeks_assessment_reminder", default: false + t.index ["commune_id"], name: "index_settings_on_commune_id" + t.index ["commune_id"], name: "index_settings_on_commune_id" + t.index ["district_id"], name: "index_settings_on_district_id" + t.index ["district_id"], name: "index_settings_on_district_id" + t.index ["province_id"], name: "index_settings_on_province_id" + t.index ["province_id"], name: "index_settings_on_province_id" + end + + create_table "shared_clients", id: :serial, force: :cascade do |t| + t.string "slug", default: "" + t.string "given_name", default: "" + t.string "family_name", default: "" + t.string "local_given_name", default: "" + t.string "local_family_name", default: "" + t.string "gender", default: "" + t.date "date_of_birth" + t.string "live_with", default: "" + t.string "telephone_number", default: "" + t.integer "birth_province_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "country_origin", default: "" + t.string "duplicate_checker" + t.string "archived_slug" + t.string "global_id" + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + t.index ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker" + t.index ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker" + t.index ["external_id"], name: "index_shared_clients_on_external_id" + t.index ["external_id"], name: "index_shared_clients_on_external_id" + t.index ["global_id"], name: "index_shared_clients_on_global_id" + t.index ["global_id"], name: "index_shared_clients_on_global_id" + t.index ["mosvy_number"], name: "index_shared_clients_on_mosvy_number" + t.index ["mosvy_number"], name: "index_shared_clients_on_mosvy_number" + t.index ["slug"], name: "index_shared_clients_on_slug", unique: true + t.index ["slug"], name: "index_shared_clients_on_slug", unique: true + end + + create_table "shared_clients", id: :serial, force: :cascade do |t| + t.string "slug", default: "" + t.string "given_name", default: "" + t.string "family_name", default: "" + t.string "local_given_name", default: "" + t.string "local_family_name", default: "" + t.string "gender", default: "" + t.date "date_of_birth" + t.string "live_with", default: "" + t.string "telephone_number", default: "" + t.integer "birth_province_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "country_origin", default: "" + t.string "duplicate_checker" + t.string "archived_slug" + t.string "global_id" + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + t.index ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker" + t.index ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker" + t.index ["external_id"], name: "index_shared_clients_on_external_id" + t.index ["external_id"], name: "index_shared_clients_on_external_id" + t.index ["global_id"], name: "index_shared_clients_on_global_id" + t.index ["global_id"], name: "index_shared_clients_on_global_id" + t.index ["mosvy_number"], name: "index_shared_clients_on_mosvy_number" + t.index ["mosvy_number"], name: "index_shared_clients_on_mosvy_number" + t.index ["slug"], name: "index_shared_clients_on_slug", unique: true + t.index ["slug"], name: "index_shared_clients_on_slug", unique: true + end + + create_table "sponsors", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "donor_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["client_id"], name: "index_sponsors_on_client_id" + t.index ["client_id"], name: "index_sponsors_on_client_id" + t.index ["donor_id"], name: "index_sponsors_on_donor_id" + t.index ["donor_id"], name: "index_sponsors_on_donor_id" + end + + create_table "sponsors", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "donor_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["client_id"], name: "index_sponsors_on_client_id" + t.index ["client_id"], name: "index_sponsors_on_client_id" + t.index ["donor_id"], name: "index_sponsors_on_donor_id" + t.index ["donor_id"], name: "index_sponsors_on_donor_id" + end + + create_table "stages", id: :serial, force: :cascade do |t| + t.float "from_age" + t.float "to_age" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "stages", id: :serial, force: :cascade do |t| + t.float "from_age" + t.float "to_age" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "states", id: :serial, force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "states", id: :serial, force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "subdistricts", id: :serial, force: :cascade do |t| + t.string "name" + t.integer "district_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["district_id"], name: "index_subdistricts_on_district_id" + t.index ["district_id"], name: "index_subdistricts_on_district_id" + end + + create_table "subdistricts", id: :serial, force: :cascade do |t| + t.string "name" + t.integer "district_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["district_id"], name: "index_subdistricts_on_district_id" + t.index ["district_id"], name: "index_subdistricts_on_district_id" + end + + create_table "surveys", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "user_id" + t.integer "listening_score" + t.integer "problem_solving_score" + t.integer "getting_in_touch_score" + t.integer "trust_score" + t.integer "difficulty_help_score" + t.integer "support_score" + t.integer "family_need_score" + t.integer "care_score" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["client_id"], name: "index_surveys_on_client_id" + t.index ["client_id"], name: "index_surveys_on_client_id" + end + + create_table "surveys", id: :serial, force: :cascade do |t| + t.integer "client_id" + t.integer "user_id" + t.integer "listening_score" + t.integer "problem_solving_score" + t.integer "getting_in_touch_score" + t.integer "trust_score" + t.integer "difficulty_help_score" + t.integer "support_score" + t.integer "family_need_score" + t.integer "care_score" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_surveys_on_client_id" + t.index ["client_id"], name: "index_surveys_on_client_id" end - add_index "surveys", ["client_id"], name: "index_surveys_on_client_id", using: :btree - - create_table "tasks", force: :cascade do |t| - t.string "name", default: "" - t.date "completion_date" + create_table "tasks", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.date "completion_date" t.datetime "remind_at" - t.boolean "completed", default: false - t.integer "user_id" - t.integer "case_note_domain_group_id" - t.integer "domain_id" + t.boolean "completed", default: false + t.integer "user_id" + t.integer "case_note_domain_group_id" + t.integer "domain_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "client_id" - t.string "relation", default: "" - t.string "case_note_id", default: "" - t.integer "taskable_id" - t.string "taskable_type" + t.integer "client_id" + t.string "relation", default: "" + t.string "case_note_id", default: "" + t.integer "taskable_id" + t.string "taskable_type" t.datetime "deleted_at" + t.index ["client_id"], name: "index_tasks_on_client_id" + t.index ["client_id"], name: "index_tasks_on_client_id" + t.index ["deleted_at"], name: "index_tasks_on_deleted_at" + t.index ["deleted_at"], name: "index_tasks_on_deleted_at" + t.index ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id" + t.index ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id" end - add_index "tasks", ["client_id"], name: "index_tasks_on_client_id", using: :btree - add_index "tasks", ["deleted_at"], name: "index_tasks_on_deleted_at", using: :btree - add_index "tasks", ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id", using: :btree - - create_table "thredded_categories", force: :cascade do |t| - t.integer "messageboard_id", null: false - t.string "name", limit: 191, null: false - t.string "description", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "slug", limit: 191, null: false + create_table "tasks", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.date "completion_date" + t.datetime "remind_at" + t.boolean "completed", default: false + t.integer "user_id" + t.integer "case_note_domain_group_id" + t.integer "domain_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "client_id" + t.string "relation", default: "" + t.string "case_note_id", default: "" + t.integer "taskable_id" + t.string "taskable_type" + t.datetime "deleted_at" + t.index ["client_id"], name: "index_tasks_on_client_id" + t.index ["client_id"], name: "index_tasks_on_client_id" + t.index ["deleted_at"], name: "index_tasks_on_deleted_at" + t.index ["deleted_at"], name: "index_tasks_on_deleted_at" + t.index ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id" + t.index ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id" + end + + create_table "thredded_categories", id: :serial, force: :cascade do |t| + t.integer "messageboard_id", null: false + t.string "name", limit: 191, null: false + t.string "description", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "slug", limit: 191, null: false + t.index "lower((name)::text) text_pattern_ops", name: "thredded_categories_name_ci" + t.index ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true + t.index ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true + t.index ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id" + t.index ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id" + end + + create_table "thredded_categories", id: :serial, force: :cascade do |t| + t.integer "messageboard_id", null: false + t.string "name", limit: 191, null: false + t.string "description", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "slug", limit: 191, null: false + t.index "lower((name)::text) text_pattern_ops", name: "thredded_categories_name_ci" + t.index ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true + t.index ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true + t.index ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id" + t.index ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id" end - add_index "thredded_categories", ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true, using: :btree - add_index "thredded_categories", ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id", using: :btree - - create_table "thredded_messageboard_groups", force: :cascade do |t| - t.string "name" + create_table "thredded_messageboard_groups", id: :serial, force: :cascade do |t| + t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "thredded_messageboards", force: :cascade do |t| - t.string "name", limit: 255, null: false - t.string "slug", limit: 191 - t.text "description" - t.integer "topics_count", default: 0 - t.integer "posts_count", default: 0 - t.boolean "closed", default: false, null: false - t.integer "last_topic_id" - t.integer "messageboard_group_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "thredded_messageboard_groups", id: :serial, force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "thredded_messageboards", ["closed"], name: "index_thredded_messageboards_on_closed", using: :btree - add_index "thredded_messageboards", ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id", using: :btree - add_index "thredded_messageboards", ["slug"], name: "index_thredded_messageboards_on_slug", using: :btree - - create_table "thredded_post_moderation_records", force: :cascade do |t| - t.integer "post_id" - t.integer "messageboard_id" - t.text "post_content" - t.integer "post_user_id" - t.text "post_user_name" - t.integer "moderator_id" - t.integer "moderation_state", null: false - t.integer "previous_moderation_state", null: false - t.datetime "created_at", null: false + create_table "thredded_messageboards", id: :serial, force: :cascade do |t| + t.string "name", limit: 255, null: false + t.string "slug", limit: 191 + t.text "description" + t.integer "topics_count", default: 0 + t.integer "posts_count", default: 0 + t.boolean "closed", default: false, null: false + t.integer "last_topic_id" + t.integer "messageboard_group_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["closed"], name: "index_thredded_messageboards_on_closed" + t.index ["closed"], name: "index_thredded_messageboards_on_closed" + t.index ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id" + t.index ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id" + t.index ["slug"], name: "index_thredded_messageboards_on_slug" + t.index ["slug"], name: "index_thredded_messageboards_on_slug" + end + + create_table "thredded_messageboards", id: :serial, force: :cascade do |t| + t.string "name", limit: 255, null: false + t.string "slug", limit: 191 + t.text "description" + t.integer "topics_count", default: 0 + t.integer "posts_count", default: 0 + t.boolean "closed", default: false, null: false + t.integer "last_topic_id" + t.integer "messageboard_group_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["closed"], name: "index_thredded_messageboards_on_closed" + t.index ["closed"], name: "index_thredded_messageboards_on_closed" + t.index ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id" + t.index ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id" + t.index ["slug"], name: "index_thredded_messageboards_on_slug" + t.index ["slug"], name: "index_thredded_messageboards_on_slug" + end + + create_table "thredded_post_moderation_records", id: :serial, force: :cascade do |t| + t.integer "post_id" + t.integer "messageboard_id" + t.text "post_content" + t.integer "post_user_id" + t.text "post_user_name" + t.integer "moderator_id" + t.integer "moderation_state", null: false + t.integer "previous_moderation_state", null: false + t.datetime "created_at", null: false + t.index ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: { created_at: :desc } + t.index ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: { created_at: :desc } + end + + create_table "thredded_post_moderation_records", id: :serial, force: :cascade do |t| + t.integer "post_id" + t.integer "messageboard_id" + t.text "post_content" + t.integer "post_user_id" + t.text "post_user_name" + t.integer "moderator_id" + t.integer "moderation_state", null: false + t.integer "previous_moderation_state", null: false + t.datetime "created_at", null: false + t.index ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: { created_at: :desc } + t.index ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: { created_at: :desc } end - add_index "thredded_post_moderation_records", ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: {"created_at"=>:desc}, using: :btree - - create_table "thredded_post_notifications", force: :cascade do |t| - t.string "email", limit: 191, null: false - t.integer "post_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "post_type", limit: 191 + create_table "thredded_post_notifications", id: :serial, force: :cascade do |t| + t.string "email", limit: 191, null: false + t.integer "post_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "post_type", limit: 191 + t.index ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post" + t.index ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post" end - add_index "thredded_post_notifications", ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post", using: :btree + create_table "thredded_post_notifications", id: :serial, force: :cascade do |t| + t.string "email", limit: 191, null: false + t.integer "post_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "post_type", limit: 191 + t.index ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post" + t.index ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post" + end - create_table "thredded_posts", force: :cascade do |t| - t.integer "user_id" - t.text "content" - t.string "ip", limit: 255 - t.string "source", limit: 255, default: "web" - t.integer "postable_id", null: false - t.integer "messageboard_id", null: false - t.integer "moderation_state", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "thredded_posts", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.text "content" + t.string "ip", limit: 255 + t.string "source", limit: 255, default: "web" + t.integer "postable_id", null: false + t.integer "messageboard_id", null: false + t.integer "moderation_state", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index "to_tsvector('english'::regconfig, content)", name: "thredded_posts_content_fts", using: :gist + t.index ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id" + t.index ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id" + t.index ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display" + t.index ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display" + t.index ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type" + t.index ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type" + t.index ["user_id"], name: "index_thredded_posts_on_user_id" + t.index ["user_id"], name: "index_thredded_posts_on_user_id" + end + + create_table "thredded_posts", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.text "content" + t.string "ip", limit: 255 + t.string "source", limit: 255, default: "web" + t.integer "postable_id", null: false + t.integer "messageboard_id", null: false + t.integer "moderation_state", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index "to_tsvector('english'::regconfig, content)", name: "thredded_posts_content_fts", using: :gist + t.index ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id" + t.index ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id" + t.index ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display" + t.index ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display" + t.index ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type" + t.index ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type" + t.index ["user_id"], name: "index_thredded_posts_on_user_id" + t.index ["user_id"], name: "index_thredded_posts_on_user_id" + end + + create_table "thredded_private_posts", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.text "content" + t.integer "postable_id", null: false + t.string "ip", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "thredded_posts", ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id", using: :btree - add_index "thredded_posts", ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display", using: :btree - add_index "thredded_posts", ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type", using: :btree - add_index "thredded_posts", ["user_id"], name: "index_thredded_posts_on_user_id", using: :btree + create_table "thredded_private_posts", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.text "content" + t.integer "postable_id", null: false + t.string "ip", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end - create_table "thredded_private_posts", force: :cascade do |t| - t.integer "user_id" - t.text "content" - t.integer "postable_id", null: false - t.string "ip", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "thredded_private_topics", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "last_user_id" + t.string "title", limit: 255, null: false + t.string "slug", limit: 191, null: false + t.integer "posts_count", default: 0 + t.string "hash_id", limit: 191, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["hash_id"], name: "index_thredded_private_topics_on_hash_id" + t.index ["hash_id"], name: "index_thredded_private_topics_on_hash_id" + t.index ["slug"], name: "index_thredded_private_topics_on_slug" + t.index ["slug"], name: "index_thredded_private_topics_on_slug" end - create_table "thredded_private_topics", force: :cascade do |t| - t.integer "user_id" - t.integer "last_user_id" - t.string "title", limit: 255, null: false - t.string "slug", limit: 191, null: false - t.integer "posts_count", default: 0 - t.string "hash_id", limit: 191, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "thredded_private_topics", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "last_user_id" + t.string "title", limit: 255, null: false + t.string "slug", limit: 191, null: false + t.integer "posts_count", default: 0 + t.string "hash_id", limit: 191, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["hash_id"], name: "index_thredded_private_topics_on_hash_id" + t.index ["hash_id"], name: "index_thredded_private_topics_on_hash_id" + t.index ["slug"], name: "index_thredded_private_topics_on_slug" + t.index ["slug"], name: "index_thredded_private_topics_on_slug" end - add_index "thredded_private_topics", ["hash_id"], name: "index_thredded_private_topics_on_hash_id", using: :btree - add_index "thredded_private_topics", ["slug"], name: "index_thredded_private_topics_on_slug", using: :btree + create_table "thredded_private_users", id: :serial, force: :cascade do |t| + t.integer "private_topic_id" + t.integer "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id" + t.index ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id" + t.index ["user_id"], name: "index_thredded_private_users_on_user_id" + t.index ["user_id"], name: "index_thredded_private_users_on_user_id" + end - create_table "thredded_private_users", force: :cascade do |t| - t.integer "private_topic_id" - t.integer "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "thredded_private_users", id: :serial, force: :cascade do |t| + t.integer "private_topic_id" + t.integer "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id" + t.index ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id" + t.index ["user_id"], name: "index_thredded_private_users_on_user_id" + t.index ["user_id"], name: "index_thredded_private_users_on_user_id" end - add_index "thredded_private_users", ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id", using: :btree - add_index "thredded_private_users", ["user_id"], name: "index_thredded_private_users_on_user_id", using: :btree + create_table "thredded_topic_categories", id: :serial, force: :cascade do |t| + t.integer "topic_id", null: false + t.integer "category_id", null: false + t.index ["category_id"], name: "index_thredded_topic_categories_on_category_id" + t.index ["category_id"], name: "index_thredded_topic_categories_on_category_id" + t.index ["topic_id"], name: "index_thredded_topic_categories_on_topic_id" + t.index ["topic_id"], name: "index_thredded_topic_categories_on_topic_id" + end - create_table "thredded_topic_categories", force: :cascade do |t| - t.integer "topic_id", null: false + create_table "thredded_topic_categories", id: :serial, force: :cascade do |t| + t.integer "topic_id", null: false t.integer "category_id", null: false + t.index ["category_id"], name: "index_thredded_topic_categories_on_category_id" + t.index ["category_id"], name: "index_thredded_topic_categories_on_category_id" + t.index ["topic_id"], name: "index_thredded_topic_categories_on_topic_id" + t.index ["topic_id"], name: "index_thredded_topic_categories_on_topic_id" end - add_index "thredded_topic_categories", ["category_id"], name: "index_thredded_topic_categories_on_category_id", using: :btree - add_index "thredded_topic_categories", ["topic_id"], name: "index_thredded_topic_categories_on_topic_id", using: :btree - - create_table "thredded_topics", force: :cascade do |t| - t.integer "user_id" - t.integer "last_user_id" - t.string "title", limit: 255, null: false - t.string "slug", limit: 191, null: false - t.integer "messageboard_id", null: false - t.integer "posts_count", default: 0, null: false - t.boolean "sticky", default: false, null: false - t.boolean "locked", default: false, null: false - t.string "hash_id", limit: 191, null: false - t.string "type", limit: 191 - t.integer "moderation_state", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "thredded_topics", ["hash_id"], name: "index_thredded_topics_on_hash_id", using: :btree - add_index "thredded_topics", ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true, using: :btree - add_index "thredded_topics", ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id", using: :btree - add_index "thredded_topics", ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: {"sticky"=>:desc, "updated_at"=>:desc}, using: :btree - add_index "thredded_topics", ["user_id"], name: "index_thredded_topics_on_user_id", using: :btree - - create_table "thredded_user_details", force: :cascade do |t| - t.integer "user_id", null: false + create_table "thredded_topics", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "last_user_id" + t.string "title", limit: 255, null: false + t.string "slug", limit: 191, null: false + t.integer "messageboard_id", null: false + t.integer "posts_count", default: 0, null: false + t.boolean "sticky", default: false, null: false + t.boolean "locked", default: false, null: false + t.string "hash_id", limit: 191, null: false + t.string "type", limit: 191 + t.integer "moderation_state", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index "to_tsvector('english'::regconfig, (title)::text)", name: "thredded_topics_title_fts", using: :gist + t.index ["hash_id"], name: "index_thredded_topics_on_hash_id" + t.index ["hash_id"], name: "index_thredded_topics_on_hash_id" + t.index ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true + t.index ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true + t.index ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id" + t.index ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id" + t.index ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: { sticky: :desc, updated_at: :desc } + t.index ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: { sticky: :desc, updated_at: :desc } + t.index ["user_id"], name: "index_thredded_topics_on_user_id" + t.index ["user_id"], name: "index_thredded_topics_on_user_id" + end + + create_table "thredded_topics", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.integer "last_user_id" + t.string "title", limit: 255, null: false + t.string "slug", limit: 191, null: false + t.integer "messageboard_id", null: false + t.integer "posts_count", default: 0, null: false + t.boolean "sticky", default: false, null: false + t.boolean "locked", default: false, null: false + t.string "hash_id", limit: 191, null: false + t.string "type", limit: 191 + t.integer "moderation_state", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index "to_tsvector('english'::regconfig, (title)::text)", name: "thredded_topics_title_fts", using: :gist + t.index ["hash_id"], name: "index_thredded_topics_on_hash_id" + t.index ["hash_id"], name: "index_thredded_topics_on_hash_id" + t.index ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true + t.index ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true + t.index ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id" + t.index ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id" + t.index ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: { sticky: :desc, updated_at: :desc } + t.index ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: { sticky: :desc, updated_at: :desc } + t.index ["user_id"], name: "index_thredded_topics_on_user_id" + t.index ["user_id"], name: "index_thredded_topics_on_user_id" + end + + create_table "thredded_user_details", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false t.datetime "latest_activity_at" - t.integer "posts_count", default: 0 - t.integer "topics_count", default: 0 + t.integer "posts_count", default: 0 + t.integer "topics_count", default: 0 t.datetime "last_seen_at" - t.integer "moderation_state", default: 1, null: false + t.integer "moderation_state", default: 1, null: false t.datetime "moderation_state_changed_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at" + t.index ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at" + t.index ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: { moderation_state_changed_at: :desc } + t.index ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: { moderation_state_changed_at: :desc } + t.index ["user_id"], name: "index_thredded_user_details_on_user_id" + t.index ["user_id"], name: "index_thredded_user_details_on_user_id" end - add_index "thredded_user_details", ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at", using: :btree - add_index "thredded_user_details", ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: {"moderation_state_changed_at"=>:desc}, using: :btree - add_index "thredded_user_details", ["user_id"], name: "index_thredded_user_details_on_user_id", using: :btree - - create_table "thredded_user_messageboard_preferences", force: :cascade do |t| - t.integer "user_id", null: false - t.integer "messageboard_id", null: false - t.boolean "notify_on_mention", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "thredded_user_details", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.datetime "latest_activity_at" + t.integer "posts_count", default: 0 + t.integer "topics_count", default: 0 + t.datetime "last_seen_at" + t.integer "moderation_state", default: 1, null: false + t.datetime "moderation_state_changed_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at" + t.index ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at" + t.index ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: { moderation_state_changed_at: :desc } + t.index ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: { moderation_state_changed_at: :desc } + t.index ["user_id"], name: "index_thredded_user_details_on_user_id" + t.index ["user_id"], name: "index_thredded_user_details_on_user_id" + end + + create_table "thredded_user_messageboard_preferences", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.integer "messageboard_id", null: false + t.boolean "notify_on_mention", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true + t.index ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true end - add_index "thredded_user_messageboard_preferences", ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true, using: :btree + create_table "thredded_user_messageboard_preferences", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.integer "messageboard_id", null: false + t.boolean "notify_on_mention", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true + t.index ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true + end - create_table "thredded_user_preferences", force: :cascade do |t| - t.integer "user_id", null: false - t.boolean "notify_on_mention", default: true, null: false - t.boolean "notify_on_message", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "thredded_user_preferences", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.boolean "notify_on_mention", default: true, null: false + t.boolean "notify_on_message", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_thredded_user_preferences_on_user_id" + t.index ["user_id"], name: "index_thredded_user_preferences_on_user_id" end - add_index "thredded_user_preferences", ["user_id"], name: "index_thredded_user_preferences_on_user_id", using: :btree + create_table "thredded_user_preferences", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.boolean "notify_on_mention", default: true, null: false + t.boolean "notify_on_message", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_thredded_user_preferences_on_user_id" + t.index ["user_id"], name: "index_thredded_user_preferences_on_user_id" + end - create_table "thredded_user_private_topic_read_states", force: :cascade do |t| - t.integer "user_id", null: false - t.integer "postable_id", null: false - t.integer "page", default: 1, null: false - t.datetime "read_at", null: false + create_table "thredded_user_private_topic_read_states", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.integer "postable_id", null: false + t.integer "page", default: 1, null: false + t.datetime "read_at", null: false + t.index ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true + t.index ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true end - add_index "thredded_user_private_topic_read_states", ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true, using: :btree + create_table "thredded_user_private_topic_read_states", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.integer "postable_id", null: false + t.integer "page", default: 1, null: false + t.datetime "read_at", null: false + t.index ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true + t.index ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true + end - create_table "thredded_user_topic_follows", force: :cascade do |t| - t.integer "user_id", null: false - t.integer "topic_id", null: false - t.datetime "created_at", null: false - t.integer "reason", limit: 2 + create_table "thredded_user_topic_follows", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.integer "topic_id", null: false + t.datetime "created_at", null: false + t.integer "reason", limit: 2 + t.index ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true + t.index ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true end - add_index "thredded_user_topic_follows", ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true, using: :btree + create_table "thredded_user_topic_follows", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.integer "topic_id", null: false + t.datetime "created_at", null: false + t.integer "reason", limit: 2 + t.index ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true + t.index ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true + end - create_table "thredded_user_topic_read_states", force: :cascade do |t| - t.integer "user_id", null: false - t.integer "postable_id", null: false - t.integer "page", default: 1, null: false - t.datetime "read_at", null: false + create_table "thredded_user_topic_read_states", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.integer "postable_id", null: false + t.integer "page", default: 1, null: false + t.datetime "read_at", null: false + t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true + t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true end - add_index "thredded_user_topic_read_states", ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true, using: :btree + create_table "thredded_user_topic_read_states", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.integer "postable_id", null: false + t.integer "page", default: 1, null: false + t.datetime "read_at", null: false + t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true + t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true + end - create_table "townships", force: :cascade do |t| - t.string "name" - t.integer "state_id" + create_table "townships", id: :serial, force: :cascade do |t| + t.string "name" + t.integer "state_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["state_id"], name: "index_townships_on_state_id" + t.index ["state_id"], name: "index_townships_on_state_id" end - add_index "townships", ["state_id"], name: "index_townships_on_state_id", using: :btree - - create_table "trackings", force: :cascade do |t| - t.string "name", default: "" - t.jsonb "fields", default: {} - t.string "frequency", default: "" - t.integer "time_of_frequency" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "deleted_at" + create_table "townships", id: :serial, force: :cascade do |t| + t.string "name" + t.integer "state_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["state_id"], name: "index_townships_on_state_id" + t.index ["state_id"], name: "index_townships_on_state_id" end - add_index "trackings", ["deleted_at"], name: "index_trackings_on_deleted_at", using: :btree - add_index "trackings", ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true, using: :btree - add_index "trackings", ["program_stream_id"], name: "index_trackings_on_program_stream_id", using: :btree - - create_table "users", force: :cascade do |t| - t.string "first_name", default: "" - t.string "last_name", default: "" - t.string "roles", default: "case worker" - t.date "start_date" - t.string "job_title", default: "" - t.string "mobile", default: "" - t.date "date_of_birth" - t.boolean "archived", default: false - t.integer "province_id" - t.integer "department_id" + create_table "trackings", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.jsonb "fields", default: {} + t.string "frequency", default: "" + t.integer "time_of_frequency" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_trackings_on_deleted_at" + t.index ["deleted_at"], name: "index_trackings_on_deleted_at" + t.index ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true + t.index ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true + t.index ["program_stream_id"], name: "index_trackings_on_program_stream_id" + t.index ["program_stream_id"], name: "index_trackings_on_program_stream_id" + end + + create_table "trackings", id: :serial, force: :cascade do |t| + t.string "name", default: "" + t.jsonb "fields", default: {} + t.string "frequency", default: "" + t.integer "time_of_frequency" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_trackings_on_deleted_at" + t.index ["deleted_at"], name: "index_trackings_on_deleted_at" + t.index ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true + t.index ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true + t.index ["program_stream_id"], name: "index_trackings_on_program_stream_id" + t.index ["program_stream_id"], name: "index_trackings_on_program_stream_id" + end + + create_table "users", id: :serial, force: :cascade do |t| + t.string "first_name", default: "" + t.string "last_name", default: "" + t.string "roles", default: "case worker" + t.date "start_date" + t.string "job_title", default: "" + t.string "mobile", default: "" + t.date "date_of_birth" + t.boolean "archived", default: false + t.integer "province_id" + t.integer "department_id" t.datetime "created_at" t.datetime "updated_at" - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.inet "current_sign_in_ip" - t.inet "last_sign_in_ip" - t.integer "clients_count", default: 0 - t.integer "cases_count", default: 0 - t.integer "tasks_count", default: 0 - t.string "provider", default: "email", null: false - t.string "uid", default: "", null: false - t.json "tokens" - t.boolean "admin", default: false - t.integer "changelogs_count", default: 0 - t.integer "organization_id" - t.boolean "disable", default: false + t.inet "current_sign_in_ip" + t.inet "last_sign_in_ip" + t.integer "clients_count", default: 0 + t.integer "cases_count", default: 0 + t.integer "tasks_count", default: 0 + t.string "provider", default: "email", null: false + t.string "uid", default: "", null: false + t.json "tokens" + t.boolean "admin", default: false + t.integer "changelogs_count", default: 0 + t.integer "organization_id" + t.boolean "disable", default: false t.datetime "expires_at" - t.boolean "task_notify", default: true - t.integer "manager_id" - t.boolean "calendar_integration", default: false - t.integer "pin_number" - t.integer "manager_ids", default: [], array: true - t.boolean "program_warning", default: false - t.boolean "staff_performance_notification", default: true - t.string "pin_code", default: "" - t.boolean "domain_warning", default: false - t.boolean "referral_notification", default: false - t.string "gender", default: "" - t.boolean "enable_gov_log_in", default: false - t.boolean "enable_research_log_in", default: false + t.boolean "task_notify", default: true + t.integer "manager_id" + t.boolean "calendar_integration", default: false + t.integer "pin_number" + t.integer "manager_ids", default: [], array: true + t.boolean "program_warning", default: false + t.boolean "staff_performance_notification", default: true + t.string "pin_code", default: "" + t.boolean "domain_warning", default: false + t.boolean "referral_notification", default: false + t.string "gender", default: "" + t.boolean "enable_gov_log_in", default: false + t.boolean "enable_research_log_in", default: false + t.datetime "deleted_at" t.datetime "activated_at" t.datetime "deactivated_at" + t.string "preferred_language", default: "en" + t.string "organization_name" + t.string "profile" + t.index "lower((email)::text) text_pattern_ops", name: "users_email_lower", unique: true + t.index ["deleted_at"], name: "index_users_on_deleted_at" + t.index ["deleted_at"], name: "index_users_on_deleted_at" + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["organization_id"], name: "index_users_on_organization_id" + t.index ["organization_id"], name: "index_users_on_organization_id" + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + end + + create_table "users", id: :serial, force: :cascade do |t| + t.string "first_name", default: "" + t.string "last_name", default: "" + t.string "roles", default: "case worker" + t.date "start_date" + t.string "job_title", default: "" + t.string "mobile", default: "" + t.date "date_of_birth" + t.boolean "archived", default: false + t.integer "province_id" + t.integer "department_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", default: 0, null: false + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.inet "current_sign_in_ip" + t.inet "last_sign_in_ip" + t.integer "clients_count", default: 0 + t.integer "cases_count", default: 0 + t.integer "tasks_count", default: 0 + t.string "provider", default: "email", null: false + t.string "uid", default: "", null: false + t.json "tokens" + t.boolean "admin", default: false + t.integer "changelogs_count", default: 0 + t.integer "organization_id" + t.boolean "disable", default: false + t.datetime "expires_at" + t.boolean "task_notify", default: true + t.integer "manager_id" + t.boolean "calendar_integration", default: false + t.integer "pin_number" + t.integer "manager_ids", default: [], array: true + t.boolean "program_warning", default: false + t.boolean "staff_performance_notification", default: true + t.string "pin_code", default: "" + t.boolean "domain_warning", default: false + t.boolean "referral_notification", default: false + t.string "gender", default: "" + t.boolean "enable_gov_log_in", default: false + t.boolean "enable_research_log_in", default: false t.datetime "deleted_at" - t.string "preferred_language", default: "en" - t.string "organization_name" - t.string "profile" + t.datetime "activated_at" + t.datetime "deactivated_at" + t.string "preferred_language", default: "en" + t.string "organization_name" + t.string "profile" + t.index "lower((email)::text) text_pattern_ops", name: "users_email_lower", unique: true + t.index ["deleted_at"], name: "index_users_on_deleted_at" + t.index ["deleted_at"], name: "index_users_on_deleted_at" + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["organization_id"], name: "index_users_on_organization_id" + t.index ["organization_id"], name: "index_users_on_organization_id" + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + end + + create_table "version_associations", id: :serial, force: :cascade do |t| + t.integer "version_id" + t.string "foreign_key_name", null: false + t.integer "foreign_key_id" + t.string "foreign_type" + t.index ["foreign_key_name", "foreign_key_id", "foreign_type"], name: "index_version_associations_on_foreign_key" + t.index ["version_id"], name: "index_version_associations_on_version_id" + t.index ["version_id"], name: "index_version_associations_on_version_id" end - add_index "users", ["deleted_at"], name: "index_users_on_deleted_at", using: :btree - add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree - add_index "users", ["organization_id"], name: "index_users_on_organization_id", using: :btree - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree - - create_table "version_associations", force: :cascade do |t| + create_table "version_associations", id: :serial, force: :cascade do |t| t.integer "version_id" - t.string "foreign_key_name", null: false + t.string "foreign_key_name", null: false t.integer "foreign_key_id" + t.string "foreign_type" + t.index ["foreign_key_name", "foreign_key_id", "foreign_type"], name: "index_version_associations_on_foreign_key" + t.index ["version_id"], name: "index_version_associations_on_version_id" + t.index ["version_id"], name: "index_version_associations_on_version_id" + end + + create_table "versions", id: :serial, force: :cascade do |t| + t.string "item_type", null: false + t.integer "item_id", null: false + t.string "event", null: false + t.string "whodunnit" + t.text "object" + t.datetime "created_at" + t.text "object_changes" + t.integer "transaction_id" + t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" + t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" + t.index ["transaction_id"], name: "index_versions_on_transaction_id" + t.index ["transaction_id"], name: "index_versions_on_transaction_id" + end + + create_table "versions", id: :serial, force: :cascade do |t| + t.string "item_type", null: false + t.integer "item_id", null: false + t.string "event", null: false + t.string "whodunnit" + t.text "object" + t.datetime "created_at" + t.text "object_changes" + t.integer "transaction_id" + t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" + t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" + t.index ["transaction_id"], name: "index_versions_on_transaction_id" + t.index ["transaction_id"], name: "index_versions_on_transaction_id" + end + + create_table "villages", id: :serial, force: :cascade do |t| + t.string "code", default: "" + t.string "name_kh", default: "" + t.string "name_en", default: "" + t.integer "commune_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["commune_id"], name: "index_villages_on_commune_id" + t.index ["commune_id"], name: "index_villages_on_commune_id" end - add_index "version_associations", ["foreign_key_name", "foreign_key_id"], name: "index_version_associations_on_foreign_key", using: :btree - add_index "version_associations", ["version_id"], name: "index_version_associations_on_version_id", using: :btree - - create_table "versions", force: :cascade do |t| - t.string "item_type", null: false - t.integer "item_id", null: false - t.string "event", null: false - t.string "whodunnit" - t.text "object" + create_table "villages", id: :serial, force: :cascade do |t| + t.string "code", default: "" + t.string "name_kh", default: "" + t.string "name_en", default: "" + t.integer "commune_id" t.datetime "created_at" - t.text "object_changes" - t.integer "transaction_id" + t.datetime "updated_at" + t.index ["commune_id"], name: "index_villages_on_commune_id" + t.index ["commune_id"], name: "index_villages_on_commune_id" end - add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree - add_index "versions", ["transaction_id"], name: "index_versions_on_transaction_id", using: :btree - - create_table "villages", force: :cascade do |t| - t.string "code", default: "" - t.string "name_kh", default: "" - t.string "name_en", default: "" - t.integer "commune_id" + create_table "visit_clients", id: :serial, force: :cascade do |t| + t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" + t.time "deleted_at" + t.index ["user_id"], name: "index_visit_clients_on_user_id" + t.index ["user_id"], name: "index_visit_clients_on_user_id" end - add_index "villages", ["commune_id"], name: "index_villages_on_commune_id", using: :btree - - create_table "visit_clients", force: :cascade do |t| - t.integer "user_id" + create_table "visit_clients", id: :serial, force: :cascade do |t| + t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.time "deleted_at" + t.time "deleted_at" + t.index ["user_id"], name: "index_visit_clients_on_user_id" + t.index ["user_id"], name: "index_visit_clients_on_user_id" end - add_index "visit_clients", ["user_id"], name: "index_visit_clients_on_user_id", using: :btree - - create_table "visits", force: :cascade do |t| - t.integer "user_id" + create_table "visits", id: :serial, force: :cascade do |t| + t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.time "deleted_at" + t.time "deleted_at" + t.index ["user_id"], name: "index_visits_on_user_id" + t.index ["user_id"], name: "index_visits_on_user_id" end - add_index "visits", ["user_id"], name: "index_visits_on_user_id", using: :btree + create_table "visits", id: :serial, force: :cascade do |t| + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + t.time "deleted_at" + t.index ["user_id"], name: "index_visits_on_user_id" + t.index ["user_id"], name: "index_visits_on_user_id" + end + add_foreign_key "able_screening_questions", "public.question_groups", column: "question_group_id" + add_foreign_key "able_screening_questions", "public.stages", column: "stage_id" + add_foreign_key "able_screening_questions", "question_groups" + add_foreign_key "able_screening_questions", "stages" + add_foreign_key "able_screening_questions", "public.question_groups", column: "question_group_id" + add_foreign_key "able_screening_questions", "public.stages", column: "stage_id" add_foreign_key "able_screening_questions", "question_groups" add_foreign_key "able_screening_questions", "stages" add_foreign_key "action_results", "government_forms" + add_foreign_key "action_results", "public.government_forms", column: "government_form_id" + add_foreign_key "action_results", "government_forms" + add_foreign_key "action_results", "public.government_forms", column: "government_form_id" + add_foreign_key "advanced_searches", "public.users", column: "user_id" add_foreign_key "advanced_searches", "users" + add_foreign_key "advanced_searches", "public.users", column: "user_id" + add_foreign_key "advanced_searches", "users" + add_foreign_key "assessments", "clients" + add_foreign_key "assessments", "public.clients", column: "client_id" add_foreign_key "assessments", "clients" + add_foreign_key "assessments", "public.clients", column: "client_id" + add_foreign_key "attachments", "able_screening_questions" + add_foreign_key "attachments", "progress_notes" + add_foreign_key "attachments", "public.able_screening_questions", column: "able_screening_question_id" + add_foreign_key "attachments", "public.progress_notes", column: "progress_note_id" add_foreign_key "attachments", "able_screening_questions" add_foreign_key "attachments", "progress_notes" + add_foreign_key "attachments", "public.able_screening_questions", column: "able_screening_question_id" + add_foreign_key "attachments", "public.progress_notes", column: "progress_note_id" + add_foreign_key "calendars", "public.users", column: "user_id" add_foreign_key "calendars", "users" + add_foreign_key "calendars", "public.users", column: "user_id" + add_foreign_key "calendars", "users" + add_foreign_key "call_necessities", "calls" + add_foreign_key "call_necessities", "necessities" + add_foreign_key "call_necessities", "public.calls", column: "call_id" + add_foreign_key "call_necessities", "public.necessities", column: "necessity_id" add_foreign_key "call_necessities", "calls" add_foreign_key "call_necessities", "necessities" + add_foreign_key "call_necessities", "public.calls", column: "call_id" + add_foreign_key "call_necessities", "public.necessities", column: "necessity_id" + add_foreign_key "call_protection_concerns", "calls" + add_foreign_key "call_protection_concerns", "protection_concerns" + add_foreign_key "call_protection_concerns", "public.calls", column: "call_id" + add_foreign_key "call_protection_concerns", "public.protection_concerns", column: "protection_concern_id" add_foreign_key "call_protection_concerns", "calls" add_foreign_key "call_protection_concerns", "protection_concerns" + add_foreign_key "call_protection_concerns", "public.calls", column: "call_id" + add_foreign_key "call_protection_concerns", "public.protection_concerns", column: "protection_concern_id" + add_foreign_key "calls", "public.referees", column: "referee_id" + add_foreign_key "calls", "referees" + add_foreign_key "calls", "public.referees", column: "referee_id" add_foreign_key "calls", "referees" add_foreign_key "carers", "communes" add_foreign_key "carers", "districts" add_foreign_key "carers", "provinces" + add_foreign_key "carers", "public.communes", column: "commune_id" + add_foreign_key "carers", "public.districts", column: "district_id" + add_foreign_key "carers", "public.provinces", column: "province_id" + add_foreign_key "carers", "public.states", column: "state_id" + add_foreign_key "carers", "public.subdistricts", column: "subdistrict_id" + add_foreign_key "carers", "public.townships", column: "township_id" + add_foreign_key "carers", "public.villages", column: "village_id" + add_foreign_key "carers", "states" + add_foreign_key "carers", "subdistricts" + add_foreign_key "carers", "townships" + add_foreign_key "carers", "villages" + add_foreign_key "carers", "communes" + add_foreign_key "carers", "districts" + add_foreign_key "carers", "provinces" + add_foreign_key "carers", "public.communes", column: "commune_id" + add_foreign_key "carers", "public.districts", column: "district_id" + add_foreign_key "carers", "public.provinces", column: "province_id" + add_foreign_key "carers", "public.states", column: "state_id" + add_foreign_key "carers", "public.subdistricts", column: "subdistrict_id" + add_foreign_key "carers", "public.townships", column: "township_id" + add_foreign_key "carers", "public.villages", column: "village_id" add_foreign_key "carers", "states" add_foreign_key "carers", "subdistricts" add_foreign_key "carers", "townships" add_foreign_key "carers", "villages" add_foreign_key "case_contracts", "cases" + add_foreign_key "case_contracts", "public.cases", column: "case_id" + add_foreign_key "case_contracts", "cases" + add_foreign_key "case_contracts", "public.cases", column: "case_id" + add_foreign_key "case_notes", "clients" + add_foreign_key "case_notes", "custom_assessment_settings" + add_foreign_key "case_notes", "public.clients", column: "client_id" + add_foreign_key "case_notes", "public.custom_assessment_settings", column: "custom_assessment_setting_id" add_foreign_key "case_notes", "clients" add_foreign_key "case_notes", "custom_assessment_settings" + add_foreign_key "case_notes", "public.clients", column: "client_id" + add_foreign_key "case_notes", "public.custom_assessment_settings", column: "custom_assessment_setting_id" add_foreign_key "case_worker_clients", "clients" + add_foreign_key "case_worker_clients", "public.clients", column: "client_id" + add_foreign_key "case_worker_clients", "public.users", column: "user_id" add_foreign_key "case_worker_clients", "users" + add_foreign_key "case_worker_clients", "clients" + add_foreign_key "case_worker_clients", "public.clients", column: "client_id" + add_foreign_key "case_worker_clients", "public.users", column: "user_id" + add_foreign_key "case_worker_clients", "users" + add_foreign_key "case_worker_tasks", "public.tasks", column: "task_id" + add_foreign_key "case_worker_tasks", "public.users", column: "user_id" + add_foreign_key "case_worker_tasks", "tasks" + add_foreign_key "case_worker_tasks", "users" + add_foreign_key "case_worker_tasks", "public.tasks", column: "task_id" + add_foreign_key "case_worker_tasks", "public.users", column: "user_id" add_foreign_key "case_worker_tasks", "tasks" add_foreign_key "case_worker_tasks", "users" add_foreign_key "changelog_types", "changelogs" + add_foreign_key "changelog_types", "public.changelogs", column: "changelog_id" + add_foreign_key "changelog_types", "changelogs" + add_foreign_key "changelog_types", "public.changelogs", column: "changelog_id" + add_foreign_key "changelogs", "public.users", column: "user_id" + add_foreign_key "changelogs", "users" + add_foreign_key "changelogs", "public.users", column: "user_id" add_foreign_key "changelogs", "users" add_foreign_key "client_client_types", "client_types" add_foreign_key "client_client_types", "clients" + add_foreign_key "client_client_types", "public.client_types", column: "client_type_id" + add_foreign_key "client_client_types", "public.clients", column: "client_id" + add_foreign_key "client_client_types", "client_types" + add_foreign_key "client_client_types", "clients" + add_foreign_key "client_client_types", "public.client_types", column: "client_type_id" + add_foreign_key "client_client_types", "public.clients", column: "client_id" add_foreign_key "client_enrollment_trackings", "client_enrollments" + add_foreign_key "client_enrollment_trackings", "public.client_enrollments", column: "client_enrollment_id" + add_foreign_key "client_enrollment_trackings", "client_enrollments" + add_foreign_key "client_enrollment_trackings", "public.client_enrollments", column: "client_enrollment_id" + add_foreign_key "client_enrollments", "clients" + add_foreign_key "client_enrollments", "program_streams" + add_foreign_key "client_enrollments", "public.clients", column: "client_id" + add_foreign_key "client_enrollments", "public.program_streams", column: "program_stream_id" add_foreign_key "client_enrollments", "clients" add_foreign_key "client_enrollments", "program_streams" + add_foreign_key "client_enrollments", "public.clients", column: "client_id" + add_foreign_key "client_enrollments", "public.program_streams", column: "program_stream_id" + add_foreign_key "client_interviewees", "clients" + add_foreign_key "client_interviewees", "interviewees" + add_foreign_key "client_interviewees", "public.clients", column: "client_id" + add_foreign_key "client_interviewees", "public.interviewees", column: "interviewee_id" add_foreign_key "client_interviewees", "clients" add_foreign_key "client_interviewees", "interviewees" + add_foreign_key "client_interviewees", "public.clients", column: "client_id" + add_foreign_key "client_interviewees", "public.interviewees", column: "interviewee_id" + add_foreign_key "client_needs", "clients" + add_foreign_key "client_needs", "needs" + add_foreign_key "client_needs", "public.clients", column: "client_id" + add_foreign_key "client_needs", "public.needs", column: "need_id" add_foreign_key "client_needs", "clients" add_foreign_key "client_needs", "needs" + add_foreign_key "client_needs", "public.clients", column: "client_id" + add_foreign_key "client_needs", "public.needs", column: "need_id" + add_foreign_key "client_problems", "clients" + add_foreign_key "client_problems", "problems" + add_foreign_key "client_problems", "public.clients", column: "client_id" + add_foreign_key "client_problems", "public.problems", column: "problem_id" add_foreign_key "client_problems", "clients" add_foreign_key "client_problems", "problems" + add_foreign_key "client_problems", "public.clients", column: "client_id" + add_foreign_key "client_problems", "public.problems", column: "problem_id" + add_foreign_key "client_right_government_forms", "client_rights" + add_foreign_key "client_right_government_forms", "government_forms" + add_foreign_key "client_right_government_forms", "public.client_rights", column: "client_right_id" + add_foreign_key "client_right_government_forms", "public.government_forms", column: "government_form_id" add_foreign_key "client_right_government_forms", "client_rights" add_foreign_key "client_right_government_forms", "government_forms" + add_foreign_key "client_right_government_forms", "public.client_rights", column: "client_right_id" + add_foreign_key "client_right_government_forms", "public.government_forms", column: "government_form_id" + add_foreign_key "client_type_government_forms", "client_types" + add_foreign_key "client_type_government_forms", "government_forms" + add_foreign_key "client_type_government_forms", "public.client_types", column: "client_type_id" + add_foreign_key "client_type_government_forms", "public.government_forms", column: "government_form_id" add_foreign_key "client_type_government_forms", "client_types" add_foreign_key "client_type_government_forms", "government_forms" + add_foreign_key "client_type_government_forms", "public.client_types", column: "client_type_id" + add_foreign_key "client_type_government_forms", "public.government_forms", column: "government_form_id" + add_foreign_key "clients", "communes" + add_foreign_key "clients", "districts" + add_foreign_key "clients", "donors" + add_foreign_key "clients", "public.communes", column: "commune_id" + add_foreign_key "clients", "public.districts", column: "district_id" + add_foreign_key "clients", "public.donors", column: "donor_id" + add_foreign_key "clients", "public.states", column: "state_id" + add_foreign_key "clients", "public.subdistricts", column: "subdistrict_id" + add_foreign_key "clients", "public.townships", column: "township_id" + add_foreign_key "clients", "public.villages", column: "village_id" + add_foreign_key "clients", "states" + add_foreign_key "clients", "subdistricts" + add_foreign_key "clients", "townships" + add_foreign_key "clients", "villages" add_foreign_key "clients", "communes" add_foreign_key "clients", "districts" add_foreign_key "clients", "donors" + add_foreign_key "clients", "public.communes", column: "commune_id" + add_foreign_key "clients", "public.districts", column: "district_id" + add_foreign_key "clients", "public.donors", column: "donor_id" + add_foreign_key "clients", "public.states", column: "state_id" + add_foreign_key "clients", "public.subdistricts", column: "subdistrict_id" + add_foreign_key "clients", "public.townships", column: "township_id" + add_foreign_key "clients", "public.villages", column: "village_id" add_foreign_key "clients", "states" add_foreign_key "clients", "subdistricts" add_foreign_key "clients", "townships" add_foreign_key "clients", "villages" add_foreign_key "communes", "districts" + add_foreign_key "communes", "public.districts", column: "district_id" + add_foreign_key "communes", "districts" + add_foreign_key "communes", "public.districts", column: "district_id" + add_foreign_key "custom_field_permissions", "custom_fields" + add_foreign_key "custom_field_permissions", "public.custom_fields", column: "custom_field_id" + add_foreign_key "custom_field_permissions", "public.users", column: "user_id" + add_foreign_key "custom_field_permissions", "users" add_foreign_key "custom_field_permissions", "custom_fields" + add_foreign_key "custom_field_permissions", "public.custom_fields", column: "custom_field_id" + add_foreign_key "custom_field_permissions", "public.users", column: "user_id" add_foreign_key "custom_field_permissions", "users" add_foreign_key "custom_field_properties", "custom_fields" + add_foreign_key "custom_field_properties", "public.custom_fields", column: "custom_field_id" + add_foreign_key "custom_field_properties", "custom_fields" + add_foreign_key "custom_field_properties", "public.custom_fields", column: "custom_field_id" add_foreign_key "districts", "provinces" + add_foreign_key "districts", "public.provinces", column: "province_id" + add_foreign_key "districts", "provinces" + add_foreign_key "districts", "public.provinces", column: "province_id" + add_foreign_key "domains", "domain_groups" + add_foreign_key "domains", "public.domain_groups", column: "domain_group_id" add_foreign_key "domains", "domain_groups" + add_foreign_key "domains", "public.domain_groups", column: "domain_group_id" + add_foreign_key "donor_organizations", "donors" + add_foreign_key "donor_organizations", "organizations" + add_foreign_key "donor_organizations", "public.donors", column: "donor_id" + add_foreign_key "donor_organizations", "public.organizations", column: "organization_id" add_foreign_key "donor_organizations", "donors" add_foreign_key "donor_organizations", "organizations" + add_foreign_key "donor_organizations", "public.donors", column: "donor_id" + add_foreign_key "donor_organizations", "public.organizations", column: "organization_id" + add_foreign_key "enrollment_trackings", "enrollments" + add_foreign_key "enrollment_trackings", "public.enrollments", column: "enrollment_id" + add_foreign_key "enrollment_trackings", "public.trackings", column: "tracking_id" + add_foreign_key "enrollment_trackings", "trackings" + add_foreign_key "enrollment_trackings", "enrollments" + add_foreign_key "enrollment_trackings", "public.enrollments", column: "enrollment_id" + add_foreign_key "enrollment_trackings", "public.trackings", column: "tracking_id" + add_foreign_key "enrollment_trackings", "trackings" + add_foreign_key "enrollments", "program_streams" + add_foreign_key "enrollments", "public.program_streams", column: "program_stream_id" + add_foreign_key "enrollments", "program_streams" + add_foreign_key "enrollments", "public.program_streams", column: "program_stream_id" add_foreign_key "enter_ngo_users", "enter_ngos" + add_foreign_key "enter_ngo_users", "public.enter_ngos", column: "enter_ngo_id" + add_foreign_key "enter_ngo_users", "public.users", column: "user_id" + add_foreign_key "enter_ngo_users", "users" + add_foreign_key "enter_ngo_users", "enter_ngos" + add_foreign_key "enter_ngo_users", "public.enter_ngos", column: "enter_ngo_id" + add_foreign_key "enter_ngo_users", "public.users", column: "user_id" add_foreign_key "enter_ngo_users", "users" add_foreign_key "enter_ngos", "clients" + add_foreign_key "enter_ngos", "public.clients", column: "client_id" + add_foreign_key "enter_ngos", "clients" + add_foreign_key "enter_ngos", "public.clients", column: "client_id" + add_foreign_key "exit_ngos", "clients" + add_foreign_key "exit_ngos", "public.clients", column: "client_id" add_foreign_key "exit_ngos", "clients" + add_foreign_key "exit_ngos", "public.clients", column: "client_id" add_foreign_key "external_system_global_identities", "external_systems" + add_foreign_key "external_system_global_identities", "public.external_systems", column: "external_system_id" + add_foreign_key "external_system_global_identities", "public.global_identities", column: "global_id", primary_key: "ulid" + add_foreign_key "external_system_global_identities", "external_systems" + add_foreign_key "external_system_global_identities", "public.external_systems", column: "external_system_id" + add_foreign_key "external_system_global_identities", "public.global_identities", column: "global_id", primary_key: "ulid" + add_foreign_key "families", "communes" + add_foreign_key "families", "districts" + add_foreign_key "families", "public.communes", column: "commune_id" + add_foreign_key "families", "public.districts", column: "district_id" + add_foreign_key "families", "public.users", column: "user_id" + add_foreign_key "families", "public.villages", column: "village_id" + add_foreign_key "families", "users" + add_foreign_key "families", "villages" add_foreign_key "families", "communes" add_foreign_key "families", "districts" + add_foreign_key "families", "public.communes", column: "commune_id" + add_foreign_key "families", "public.districts", column: "district_id" + add_foreign_key "families", "public.users", column: "user_id" + add_foreign_key "families", "public.villages", column: "village_id" add_foreign_key "families", "users" add_foreign_key "families", "villages" add_foreign_key "family_members", "families" + add_foreign_key "family_members", "public.families", column: "family_id" + add_foreign_key "family_members", "families" + add_foreign_key "family_members", "public.families", column: "family_id" + add_foreign_key "family_referrals", "families" + add_foreign_key "family_referrals", "public.families", column: "family_id" + add_foreign_key "family_referrals", "families" + add_foreign_key "family_referrals", "public.families", column: "family_id" add_foreign_key "global_identity_organizations", "organizations" + add_foreign_key "global_identity_organizations", "public.organizations", column: "organization_id" + add_foreign_key "global_identity_organizations", "organizations" + add_foreign_key "global_identity_organizations", "public.organizations", column: "organization_id" + add_foreign_key "government_form_children_plans", "children_plans" + add_foreign_key "government_form_children_plans", "government_forms" + add_foreign_key "government_form_children_plans", "public.children_plans", column: "children_plan_id" + add_foreign_key "government_form_children_plans", "public.government_forms", column: "government_form_id" add_foreign_key "government_form_children_plans", "children_plans" add_foreign_key "government_form_children_plans", "government_forms" + add_foreign_key "government_form_children_plans", "public.children_plans", column: "children_plan_id" + add_foreign_key "government_form_children_plans", "public.government_forms", column: "government_form_id" + add_foreign_key "government_form_family_plans", "family_plans" + add_foreign_key "government_form_family_plans", "government_forms" + add_foreign_key "government_form_family_plans", "public.family_plans", column: "family_plan_id" + add_foreign_key "government_form_family_plans", "public.government_forms", column: "government_form_id" add_foreign_key "government_form_family_plans", "family_plans" add_foreign_key "government_form_family_plans", "government_forms" + add_foreign_key "government_form_family_plans", "public.family_plans", column: "family_plan_id" + add_foreign_key "government_form_family_plans", "public.government_forms", column: "government_form_id" + add_foreign_key "government_form_interviewees", "government_forms" + add_foreign_key "government_form_interviewees", "interviewees" + add_foreign_key "government_form_interviewees", "public.government_forms", column: "government_form_id" + add_foreign_key "government_form_interviewees", "public.interviewees", column: "interviewee_id" add_foreign_key "government_form_interviewees", "government_forms" add_foreign_key "government_form_interviewees", "interviewees" + add_foreign_key "government_form_interviewees", "public.government_forms", column: "government_form_id" + add_foreign_key "government_form_interviewees", "public.interviewees", column: "interviewee_id" + add_foreign_key "government_form_needs", "government_forms" + add_foreign_key "government_form_needs", "needs" + add_foreign_key "government_form_needs", "public.government_forms", column: "government_form_id" + add_foreign_key "government_form_needs", "public.needs", column: "need_id" add_foreign_key "government_form_needs", "government_forms" add_foreign_key "government_form_needs", "needs" + add_foreign_key "government_form_needs", "public.government_forms", column: "government_form_id" + add_foreign_key "government_form_needs", "public.needs", column: "need_id" + add_foreign_key "government_form_problems", "government_forms" + add_foreign_key "government_form_problems", "problems" + add_foreign_key "government_form_problems", "public.government_forms", column: "government_form_id" + add_foreign_key "government_form_problems", "public.problems", column: "problem_id" add_foreign_key "government_form_problems", "government_forms" add_foreign_key "government_form_problems", "problems" + add_foreign_key "government_form_problems", "public.government_forms", column: "government_form_id" + add_foreign_key "government_form_problems", "public.problems", column: "problem_id" + add_foreign_key "government_form_service_types", "government_forms" + add_foreign_key "government_form_service_types", "public.government_forms", column: "government_form_id" + add_foreign_key "government_form_service_types", "public.service_types", column: "service_type_id" + add_foreign_key "government_form_service_types", "service_types" add_foreign_key "government_form_service_types", "government_forms" + add_foreign_key "government_form_service_types", "public.government_forms", column: "government_form_id" + add_foreign_key "government_form_service_types", "public.service_types", column: "service_type_id" add_foreign_key "government_form_service_types", "service_types" add_foreign_key "government_forms", "clients" add_foreign_key "government_forms", "communes" add_foreign_key "government_forms", "districts" add_foreign_key "government_forms", "provinces" + add_foreign_key "government_forms", "public.clients", column: "client_id" + add_foreign_key "government_forms", "public.communes", column: "commune_id" + add_foreign_key "government_forms", "public.districts", column: "district_id" + add_foreign_key "government_forms", "public.provinces", column: "province_id" + add_foreign_key "government_forms", "public.villages", column: "village_id" + add_foreign_key "government_forms", "villages" + add_foreign_key "government_forms", "clients" + add_foreign_key "government_forms", "communes" + add_foreign_key "government_forms", "districts" + add_foreign_key "government_forms", "provinces" + add_foreign_key "government_forms", "public.clients", column: "client_id" + add_foreign_key "government_forms", "public.communes", column: "commune_id" + add_foreign_key "government_forms", "public.districts", column: "district_id" + add_foreign_key "government_forms", "public.provinces", column: "province_id" + add_foreign_key "government_forms", "public.villages", column: "village_id" add_foreign_key "government_forms", "villages" add_foreign_key "hotlines", "calls" add_foreign_key "hotlines", "clients" + add_foreign_key "hotlines", "public.calls", column: "call_id" + add_foreign_key "hotlines", "public.clients", column: "client_id" + add_foreign_key "hotlines", "calls" + add_foreign_key "hotlines", "clients" + add_foreign_key "hotlines", "public.calls", column: "call_id" + add_foreign_key "hotlines", "public.clients", column: "client_id" add_foreign_key "leave_programs", "client_enrollments" + add_foreign_key "leave_programs", "enrollments" + add_foreign_key "leave_programs", "public.client_enrollments", column: "client_enrollment_id" + add_foreign_key "leave_programs", "public.enrollments", column: "enrollment_id" + add_foreign_key "leave_programs", "client_enrollments" + add_foreign_key "leave_programs", "enrollments" + add_foreign_key "leave_programs", "public.client_enrollments", column: "client_enrollment_id" + add_foreign_key "leave_programs", "public.enrollments", column: "enrollment_id" + add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id" + add_foreign_key "oauth_access_grants", "public.oauth_applications", column: "application_id" add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id" + add_foreign_key "oauth_access_grants", "public.oauth_applications", column: "application_id" add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id" + add_foreign_key "oauth_access_tokens", "public.oauth_applications", column: "application_id" + add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id" + add_foreign_key "oauth_access_tokens", "public.oauth_applications", column: "application_id" + add_foreign_key "partners", "organization_types" + add_foreign_key "partners", "public.organization_types", column: "organization_type_id" add_foreign_key "partners", "organization_types" + add_foreign_key "partners", "public.organization_types", column: "organization_type_id" + add_foreign_key "program_stream_permissions", "program_streams" + add_foreign_key "program_stream_permissions", "public.program_streams", column: "program_stream_id" + add_foreign_key "program_stream_permissions", "public.users", column: "user_id" + add_foreign_key "program_stream_permissions", "users" add_foreign_key "program_stream_permissions", "program_streams" + add_foreign_key "program_stream_permissions", "public.program_streams", column: "program_stream_id" + add_foreign_key "program_stream_permissions", "public.users", column: "user_id" add_foreign_key "program_stream_permissions", "users" add_foreign_key "program_stream_services", "program_streams" + add_foreign_key "program_stream_services", "public.program_streams", column: "program_stream_id" + add_foreign_key "program_stream_services", "public.services", column: "service_id" add_foreign_key "program_stream_services", "services" + add_foreign_key "program_stream_services", "program_streams" + add_foreign_key "program_stream_services", "public.program_streams", column: "program_stream_id" + add_foreign_key "program_stream_services", "public.services", column: "service_id" + add_foreign_key "program_stream_services", "services" + add_foreign_key "progress_notes", "clients" + add_foreign_key "progress_notes", "locations" + add_foreign_key "progress_notes", "materials" + add_foreign_key "progress_notes", "progress_note_types" + add_foreign_key "progress_notes", "public.clients", column: "client_id" + add_foreign_key "progress_notes", "public.locations", column: "location_id" + add_foreign_key "progress_notes", "public.materials", column: "material_id" + add_foreign_key "progress_notes", "public.progress_note_types", column: "progress_note_type_id" + add_foreign_key "progress_notes", "public.users", column: "user_id" + add_foreign_key "progress_notes", "users" add_foreign_key "progress_notes", "clients" add_foreign_key "progress_notes", "locations" add_foreign_key "progress_notes", "materials" add_foreign_key "progress_notes", "progress_note_types" + add_foreign_key "progress_notes", "public.clients", column: "client_id" + add_foreign_key "progress_notes", "public.locations", column: "location_id" + add_foreign_key "progress_notes", "public.materials", column: "material_id" + add_foreign_key "progress_notes", "public.progress_note_types", column: "progress_note_type_id" + add_foreign_key "progress_notes", "public.users", column: "user_id" add_foreign_key "progress_notes", "users" + add_foreign_key "quantitative_type_permissions", "public.quantitative_types", column: "quantitative_type_id" + add_foreign_key "quantitative_type_permissions", "public.users", column: "user_id" + add_foreign_key "quantitative_type_permissions", "quantitative_types" + add_foreign_key "quantitative_type_permissions", "users" + add_foreign_key "quantitative_type_permissions", "public.quantitative_types", column: "quantitative_type_id" + add_foreign_key "quantitative_type_permissions", "public.users", column: "user_id" add_foreign_key "quantitative_type_permissions", "quantitative_types" add_foreign_key "quantitative_type_permissions", "users" add_foreign_key "quarterly_reports", "cases" + add_foreign_key "quarterly_reports", "public.cases", column: "case_id" + add_foreign_key "quarterly_reports", "cases" + add_foreign_key "quarterly_reports", "public.cases", column: "case_id" + add_foreign_key "referees", "communes" + add_foreign_key "referees", "districts" + add_foreign_key "referees", "provinces" + add_foreign_key "referees", "public.communes", column: "commune_id" + add_foreign_key "referees", "public.districts", column: "district_id" + add_foreign_key "referees", "public.provinces", column: "province_id" + add_foreign_key "referees", "public.states", column: "state_id" + add_foreign_key "referees", "public.subdistricts", column: "subdistrict_id" + add_foreign_key "referees", "public.townships", column: "township_id" + add_foreign_key "referees", "public.villages", column: "village_id" + add_foreign_key "referees", "states" + add_foreign_key "referees", "subdistricts" + add_foreign_key "referees", "townships" + add_foreign_key "referees", "villages" add_foreign_key "referees", "communes" add_foreign_key "referees", "districts" add_foreign_key "referees", "provinces" + add_foreign_key "referees", "public.communes", column: "commune_id" + add_foreign_key "referees", "public.districts", column: "district_id" + add_foreign_key "referees", "public.provinces", column: "province_id" + add_foreign_key "referees", "public.states", column: "state_id" + add_foreign_key "referees", "public.subdistricts", column: "subdistrict_id" + add_foreign_key "referees", "public.townships", column: "township_id" + add_foreign_key "referees", "public.villages", column: "village_id" add_foreign_key "referees", "states" add_foreign_key "referees", "subdistricts" add_foreign_key "referees", "townships" add_foreign_key "referees", "villages" add_foreign_key "referrals", "clients" - add_foreign_key "services", "global_services", column: "uuid", primary_key: "uuid" + add_foreign_key "referrals", "public.clients", column: "client_id" + add_foreign_key "referrals", "clients" + add_foreign_key "referrals", "public.clients", column: "client_id" + add_foreign_key "services", "public.global_services", column: "uuid", primary_key: "uuid" + add_foreign_key "services", "public.global_services", column: "uuid", primary_key: "uuid" + add_foreign_key "services", "public.global_services", column: "uuid", primary_key: "uuid" + add_foreign_key "services", "public.global_services", column: "uuid", primary_key: "uuid" + add_foreign_key "settings", "communes" + add_foreign_key "settings", "districts" + add_foreign_key "settings", "provinces" + add_foreign_key "settings", "public.communes", column: "commune_id" + add_foreign_key "settings", "public.districts", column: "district_id" + add_foreign_key "settings", "public.provinces", column: "province_id" add_foreign_key "settings", "communes" add_foreign_key "settings", "districts" add_foreign_key "settings", "provinces" + add_foreign_key "settings", "public.communes", column: "commune_id" + add_foreign_key "settings", "public.districts", column: "district_id" + add_foreign_key "settings", "public.provinces", column: "province_id" + add_foreign_key "sponsors", "clients" + add_foreign_key "sponsors", "donors" + add_foreign_key "sponsors", "public.clients", column: "client_id" + add_foreign_key "sponsors", "public.donors", column: "donor_id" add_foreign_key "sponsors", "clients" add_foreign_key "sponsors", "donors" + add_foreign_key "sponsors", "public.clients", column: "client_id" + add_foreign_key "sponsors", "public.donors", column: "donor_id" + add_foreign_key "subdistricts", "districts" + add_foreign_key "subdistricts", "public.districts", column: "district_id" add_foreign_key "subdistricts", "districts" + add_foreign_key "subdistricts", "public.districts", column: "district_id" add_foreign_key "surveys", "clients" + add_foreign_key "surveys", "public.clients", column: "client_id" + add_foreign_key "surveys", "clients" + add_foreign_key "surveys", "public.clients", column: "client_id" + add_foreign_key "tasks", "clients", on_delete: :nullify + add_foreign_key "tasks", "public.clients", column: "client_id", on_delete: :nullify add_foreign_key "tasks", "clients", on_delete: :nullify + add_foreign_key "tasks", "public.clients", column: "client_id", on_delete: :nullify + add_foreign_key "townships", "public.states", column: "state_id" add_foreign_key "townships", "states" + add_foreign_key "townships", "public.states", column: "state_id" + add_foreign_key "townships", "states" + add_foreign_key "trackings", "program_streams" + add_foreign_key "trackings", "public.program_streams", column: "program_stream_id" add_foreign_key "trackings", "program_streams" + add_foreign_key "trackings", "public.program_streams", column: "program_stream_id" add_foreign_key "users", "organizations" + add_foreign_key "users", "public.organizations", column: "organization_id" + add_foreign_key "users", "organizations" + add_foreign_key "users", "public.organizations", column: "organization_id" + add_foreign_key "villages", "communes" + add_foreign_key "villages", "public.communes", column: "commune_id" add_foreign_key "villages", "communes" + add_foreign_key "villages", "public.communes", column: "commune_id" + add_foreign_key "visit_clients", "public.users", column: "user_id" add_foreign_key "visit_clients", "users" + add_foreign_key "visit_clients", "public.users", column: "user_id" + add_foreign_key "visit_clients", "users" + add_foreign_key "visits", "public.users", column: "user_id" + add_foreign_key "visits", "users" + add_foreign_key "visits", "public.users", column: "user_id" add_foreign_key "visits", "users" end From c96ec78e2d8dcc9f9316b108ef4fa00203d890eb Mon Sep 17 00:00:00 2001 From: kirykr Date: Mon, 14 Dec 2020 17:10:53 +0700 Subject: [PATCH 06/27] working on improving select2 after updating the select2 gem --- app/assets/javascripts/clients/index.coffee | 1 - app/assets/javascripts/common.coffee | 1 + app/classes/application_datatable.rb | 4 ++-- app/classes/custom_field_datatable.rb | 8 ++++---- app/controllers/api/custom_fields_controller.rb | 5 +++-- app/controllers/api/program_streams_controller.rb | 4 ++-- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/clients/index.coffee b/app/assets/javascripts/clients/index.coffee index ea6424a904..6859c2777f 100644 --- a/app/assets/javascripts/clients/index.coffee +++ b/app/assets/javascripts/clients/index.coffee @@ -534,7 +534,6 @@ CIF.ClientsIndex = do -> allowClear: true dropdownAutoWidth : true, width: 'auto' - theme: "bootstrap" _formatReportxAxis = -> Highcharts.setOptions global: useUTC: false diff --git a/app/assets/javascripts/common.coffee b/app/assets/javascripts/common.coffee index 26dff57ccb..b154e14563 100644 --- a/app/assets/javascripts/common.coffee +++ b/app/assets/javascripts/common.coffee @@ -10,6 +10,7 @@ CIF.Common = @checkValidationErrorExistOnSaving() @preventEditOnDatePicker() @confirmOnCancelBotton() + $.fn.select2.defaults.set( "theme", "bootstrap" ) preventEditOnDatePicker: -> $('.date-picker').datepicker diff --git a/app/classes/application_datatable.rb b/app/classes/application_datatable.rb index db0f7e3694..8adf077ff5 100644 --- a/app/classes/application_datatable.rb +++ b/app/classes/application_datatable.rb @@ -1,13 +1,13 @@ class ApplicationDatatable - delegate :params, :class, :link_to, :content_tag, :fa_icon, to: :@view include Rails.application.routes.url_helpers + delegate :params, :class, :link_to, :content_tag, :fa_icon, to: :@view def page params[:start].to_i / per_page + 1 end def per_page - params[:length].to_i > 0 ? params[:length].to_i : 10 + params[:length].to_i.positive? ? params[:length].to_i : 10 end def sort_direction diff --git a/app/classes/custom_field_datatable.rb b/app/classes/custom_field_datatable.rb index fde287455a..3b234b9561 100644 --- a/app/classes/custom_field_datatable.rb +++ b/app/classes/custom_field_datatable.rb @@ -2,10 +2,10 @@ class CustomFieldDatatable < ApplicationDatatable def initialize(view, type) @view = view @type = type - @fetch_custom_fields = fetch_custom_fields + @fetch_custom_fields = fetch_custom_fields end - def as_json(options = {}) + def as_json(_options = {}) { recordsFiltered: total_entries, data: column_custom_fields @@ -19,7 +19,7 @@ def sort_column end def fetch_custom_fields - eval("CustomField.#{@type}").order("lower(#{sort_column}) #{sort_direction}").page(page).per(per_page) + CustomField.public_send(@type).order("lower(#{sort_column}) #{sort_direction}").page(page).per(per_page) if @type end def columns @@ -27,7 +27,7 @@ def columns end def column_custom_fields - @fetch_custom_fields.map{ |c| [c.form_title, link_custom_field(c)] } + @fetch_custom_fields.map { |c| [c.form_title, link_custom_field(c)] } end def link_custom_field(custom_field) diff --git a/app/controllers/api/custom_fields_controller.rb b/app/controllers/api/custom_fields_controller.rb index a72fa008d9..6a2ef98a54 100644 --- a/app/controllers/api/custom_fields_controller.rb +++ b/app/controllers/api/custom_fields_controller.rb @@ -17,13 +17,14 @@ def fields end def ngo_custom_fields - render json: CustomFormTrackingDatatable.new(view_context, params[:ngo_custom_field]), root: :data + render json: CustomFormTrackingDatatable.new(view_context, params[:ngo_custom_field]).to_json, root: :data, serializer: nil end def list_custom_fields form_type = params[:type] @custom_field_data ||= CustomFieldDatatable.new(view_context, form_type) - render json: @custom_field_data, root: :data + + render json: @custom_field_data.to_json, root: :data, serializer: nil end private diff --git a/app/controllers/api/program_streams_controller.rb b/app/controllers/api/program_streams_controller.rb index 5326dba8f2..cdc028a613 100644 --- a/app/controllers/api/program_streams_controller.rb +++ b/app/controllers/api/program_streams_controller.rb @@ -50,11 +50,11 @@ def update end def list_program_streams - render json: TrackingDatatable.new(view_context), root: :data + render json: TrackingDatatable.new(view_context).to_json, root: :data, serializer: nil end def list_program_enrollments - render json: EnrollmentDatatable.new(view_context), root: :data + render json: EnrollmentDatatable.new(view_context).to_json, root: :data, serializer: nil end private From 914a05c1af22f8e5e436451e9eca492044c2ac69 Mon Sep 17 00:00:00 2001 From: kirykr Date: Tue, 15 Dec 2020 17:19:38 +0700 Subject: [PATCH 07/27] finished refactoring select2 find client in dashboard --- app/assets/javascripts/application.js | 4 +- app/assets/javascripts/clients/index.coffee | 2 +- .../javascripts/dashboards/index.coffee | 94 +++++++++++++------ app/assets/stylesheets/dashboards/index.scss | 67 ++++++++----- app/assets/stylesheets/form.scss | 6 +- app/controllers/api/clients_controller.rb | 7 +- app/controllers/clients_controller.rb | 6 +- app/controllers/dashboards_controller.rb | 4 +- app/helpers/clients_helper.rb | 2 +- app/models/client.rb | 36 +++---- app/models/leave_program.rb | 2 +- app/views/clients/show.haml | 2 +- app/views/dashboards/_client_search.haml | 28 +++--- 13 files changed, 160 insertions(+), 100 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 4bb0d1d769..9cc4c387f1 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,7 +13,9 @@ //= require dataTables/dataTables.buttons.min //= require dataTables/jszip.min //= require thredded -//= require select2 +//= require select2-full +//= require select2_locale_km +//= require select2_locale_en //= require editable/bootstrap-editable //= require editable/rails diff --git a/app/assets/javascripts/clients/index.coffee b/app/assets/javascripts/clients/index.coffee index 6859c2777f..95f95f648a 100644 --- a/app/assets/javascripts/clients/index.coffee +++ b/app/assets/javascripts/clients/index.coffee @@ -532,7 +532,7 @@ CIF.ClientsIndex = do -> $('#clients-index select').select2 minimumInputLength: 0 allowClear: true - dropdownAutoWidth : true, + dropdownAutoWidth : true width: 'auto' _formatReportxAxis = -> diff --git a/app/assets/javascripts/dashboards/index.coffee b/app/assets/javascripts/dashboards/index.coffee index e990ce64e8..213d6e48d5 100644 --- a/app/assets/javascripts/dashboards/index.coffee +++ b/app/assets/javascripts/dashboards/index.coffee @@ -168,7 +168,8 @@ CIF.DashboardsIndex = do -> _handleProgramStreamServiceSelect2 = -> $('.type-of-service select').select2 - width: '100%' + dropdownAutoWidth : true + width: 'auto' createHeaderElement = (options, indexes)-> html = "" @@ -263,36 +264,73 @@ CIF.DashboardsIndex = do -> searchingClient = $("#searching_format-input").val() notFoundClient = $("#not_found_format-input").val() enterCharacters = $("#please_enter_more_char_format-input").val() - $('#search-client-select2').select2( - placeholder: searchForClient - minimumInputLength: 1 - formatSearching: searchingClient - formatNoMatches: notFoundClient - formatInputTooShort: enterCharacters + + formatClient = (client) -> + if client.loading + return client.text + en_full_name = "#{client.given_name} #{client.family_name}" + local_full_name = "#{client.local_given_name} #{client.local_family_name}" + markup = "#{en_full_name} | #{local_full_name} (#{client.id})" + # + $container = $('
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
') + $container.find('.select2-result-client__full_name').append markup + $container.find('.select2-result-client__slug').text client.slug + $container.find('.select2-result-client_status').append "Status: #{client.status}" + $container + + formatClientSelection = (client) -> + if !client.slug + return client.text + + win = window.open("clients/#{client.slug}", '_blank') + $('#search-client-select2').trigger("change") + + $('#search-client-select2').select2 + language: "km" ajax: - url: '/api/clients/search_client' - dataType: 'json' - quietMillis: 250 - data: (term, page) -> - { q: term } - results: (data, page) -> + url: "/api/clients/search_client" + dataType: "json" + delay: 250 + data: (params) -> + { q: params.term } + processResults: (data, params) -> { results: data } cache: true - initSelection: (element, callback) -> - id = $(element).select2('data', null).trigger("change") - return - formatResult: (client) -> - en_full_name = "#{client.given_name} #{client.family_name}" - local_full_name = "#{client.local_given_name} #{client.local_family_name}" - markup = "#{en_full_name} | #{local_full_name} (#{client.id})" - - return markup - formatSelection: (client) -> - win = window.open("clients/#{client.slug}", '_blank') - $('#search-client-select2').trigger("change") - ).on 'select2-blur select2-focus', -> - $(@).trigger("change") - return + placeholder: searchForClient + minimumInputLength: 1 + templateResult: formatClient + templateSelection: formatClientSelection + + # $('#search-client-select2').select2( + # placeholder: searchForClient + # minimumInputLength: 1 + # formatSearching: searchingClient + # formatNoMatches: notFoundClient + # formatInputTooShort: enterCharacters + # ajax: + # url: '/api/clients/search_client' + # dataType: 'json' + # quietMillis: 250 + # data: (term, page) -> + # { q: term } + # results: (data, page) -> + # { results: data } + # cache: true + # initSelection: (element, callback) -> + # id = $(element).select2('data', null).trigger("change") + # return + # formatResult: (client) -> + # en_full_name = "#{client.given_name} #{client.family_name}" + # local_full_name = "#{client.local_given_name} #{client.local_family_name}" + # markup = "#{en_full_name} | #{local_full_name} (#{client.id})" + + # return markup + # formatSelection: (client) -> + # win = window.open("clients/#{client.slug}", '_blank') + # $('#search-client-select2').trigger("change") + # ).on 'select2-blur select2-focus', -> + # $(@).trigger("change") + # return $(window).focus(-> $('#search-client-select2').trigger("change") diff --git a/app/assets/stylesheets/dashboards/index.scss b/app/assets/stylesheets/dashboards/index.scss index 13096d93a9..bc1c63b8ef 100644 --- a/app/assets/stylesheets/dashboards/index.scss +++ b/app/assets/stylesheets/dashboards/index.scss @@ -1,4 +1,4 @@ -body[id='dashboards-index'] { +body[id="dashboards-index"] { #width-modal { li.active { margin-bottom: -1px; @@ -7,21 +7,29 @@ body[id='dashboards-index'] { border-bottom: 2px solid #fff; } - th.name, td.name { + th.name, + td.name { width: 60% !important; } - th.program-stream-name, td.program-stream-name, th.tracking-name, td.tracking-name { + th.program-stream-name, + td.program-stream-name, + th.tracking-name, + td.tracking-name { width: 40% !important; } - th.link, td.link { + th.link, + td.link { width: 20% !important; } - table.custom-field-table, .dataTables_scrollHeadInner, .dataTables_scrollHead, .dataTables_scrollBody { + table.custom-field-table, + .dataTables_scrollHeadInner, + .dataTables_scrollHead, + .dataTables_scrollBody { width: 100% !important; } - .dataTables_scrollHeadInner{ + .dataTables_scrollHeadInner { padding-right: 0 !important; } @@ -67,7 +75,7 @@ body[id='dashboards-index'] { } } - #program-stream-service{ + #program-stream-service { .modal-dialog { width: 70%; padding: 0; @@ -80,13 +88,14 @@ body[id='dashboards-index'] { // } .simple_form.program-stream { - input[type='submit'] { + input[type="submit"] { margin-top: 25px; } } .disabled.program_stream_name { - label, input { + label, + input { color: #333333 !important; } } @@ -110,11 +119,11 @@ body[id='dashboards-index'] { } } - .referral-source-category-dialog{ + .referral-source-category-dialog { overflow-y: initial !important; } - .referral-body{ + .referral-body { height: 400px; overflow-y: auto; } @@ -128,27 +137,27 @@ body[id='dashboards-index'] { margin-left: 30px; } - .modal-header{ + .modal-header { background-color: #1ab394; color: white; } - #search-client{ + #search-client { .heading-label { background-color: #186e6d; color: #fff; } } - #multiple-form-modal{ + #multiple-form-modal { .modal-dialog { - width: 80%; - margin: 20px auto; - padding: 0 0 50px 0; - display: flex; - align-items: center; - justify-content: center; - } + width: 80%; + margin: 20px auto; + padding: 0 0 50px 0; + display: flex; + align-items: center; + justify-content: center; + } .modal-content { height: 80%; @@ -156,7 +165,7 @@ body[id='dashboards-index'] { max-height: 90%; min-width: 90%; border-radius: 0; - overflow:auto; + overflow: auto; .modal-body .tab-content { height: 70vh; } @@ -164,7 +173,7 @@ body[id='dashboards-index'] { } #case-note { .resize-margin { - margin-top:20px; + margin-top: 20px; } } @@ -172,4 +181,16 @@ body[id='dashboards-index'] { cursor: not-allowed; color: #333333 !important; } + + #client-search { + } + .select2-container.select2-container--bootstrap.select2-container--open { + z-index: 9999 !important; + } + + .select2-container--bootstrap .select2-results__option--highlighted { + a { + color: white; + } + } } diff --git a/app/assets/stylesheets/form.scss b/app/assets/stylesheets/form.scss index ad81189512..006ff43f58 100644 --- a/app/assets/stylesheets/form.scss +++ b/app/assets/stylesheets/form.scss @@ -44,8 +44,8 @@ display: flex; flex-direction: column; } +} - select + .select2-container { - width: 100% !important; - } +select + .select2-container { + width: 100% !important; } diff --git a/app/controllers/api/clients_controller.rb b/app/controllers/api/clients_controller.rb index ef5a0d791d..fe63a2d7eb 100644 --- a/app/controllers/api/clients_controller.rb +++ b/app/controllers/api/clients_controller.rb @@ -1,9 +1,8 @@ module Api class ClientsController < Api::ApplicationController - def search_client - clients = Client.all.where("given_name ILIKE ? OR family_name ILIKE ? OR local_given_name ILIKE ? OR local_family_name ILIKE ? OR slug ILIKE ?", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%").select(:id, :slug, :given_name, :family_name, :local_given_name, :local_family_name) - render json: clients, serializer: false + clients = Client.where('given_name ILIKE ? OR family_name ILIKE ? OR local_given_name ILIKE ? OR local_family_name ILIKE ? OR slug ILIKE ?', "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%").select(:id, :slug, :given_name, :family_name, :local_given_name, :local_family_name, :status, :profile) + render json: clients.to_json, serializer: nil end def compare @@ -177,7 +176,7 @@ def client_params field_settings.each do |field_setting| next if field_setting.group != 'client' || field_setting.required? || field_setting.visible? - client_params.except!(field_setting.name.to_sym) + client_params.to_h.except!(field_setting.name.to_sym) end Client::LEGAL_DOC_FIELDS.each do |attachment_field| diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb index 2ec97423ce..d035e72f4f 100644 --- a/app/controllers/clients_controller.rb +++ b/app/controllers/clients_controller.rb @@ -4,9 +4,9 @@ class ClientsController < AdminController include ClientAdvancedSearchesConcern include ClientGridOptions - # self.page_cache_directory = DomainCacheDirectory - # before_action :assign_active_client_prams, only: :index + self.page_cache_directory = DomainCacheDirectory + before_action :assign_active_client_prams, only: :index before_action :format_search_params, only: [:index] before_action :get_quantitative_fields, :get_hotline_fields, :hotline_call_column, only: [:index] before_action :find_params_advanced_search, :get_custom_form, :get_program_streams, only: [:index] @@ -22,7 +22,7 @@ class ClientsController < AdminController before_action :quantitative_type_editable, only: [:edit, :update, :new, :create] before_action :quantitative_type_readable before_action :validate_referral, only: [:new, :edit] - caches_action :index + caches_page :index def index @client_default_columns = Setting.first.try(:client_default_columns) diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index 0d8123692c..159d69c13d 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -1,7 +1,7 @@ class DashboardsController < AdminController before_action :task_of_user, :find_overhaul_task_params, :find_tasks, only: [:index] - # self.page_cache_directory = DomainCacheDirectory - # caches_page :index + self.page_cache_directory = DomainCacheDirectory + caches_page :index def index @setting = Setting.first diff --git a/app/helpers/clients_helper.rb b/app/helpers/clients_helper.rb index 269ef1419b..851548d584 100644 --- a/app/helpers/clients_helper.rb +++ b/app/helpers/clients_helper.rb @@ -25,7 +25,7 @@ def link_to_client_show(client) end def order_case_worker(client) - client.users.distinct.sort + client.users.uniq.sort end def partner(partner) diff --git a/app/models/client.rb b/app/models/client.rb index e1788ea7b5..9ae6234bd3 100644 --- a/app/models/client.rb +++ b/app/models/client.rb @@ -37,24 +37,24 @@ class Client < ApplicationRecord delegate :name_en, to: :village, prefix: true, allow_nil: true belongs_to :referral_source, counter_cache: true - belongs_to :province, counter_cache: true - belongs_to :district - belongs_to :subdistrict - belongs_to :township - belongs_to :state - belongs_to :received_by, class_name: 'User', foreign_key: 'received_by_id', counter_cache: true - belongs_to :followed_up_by, class_name: 'User', foreign_key: 'followed_up_by_id', counter_cache: true - belongs_to :birth_province, class_name: 'Province', foreign_key: 'birth_province_id', counter_cache: true - belongs_to :commune - belongs_to :village - belongs_to :referee - belongs_to :carer - belongs_to :call - - belongs_to :concern_province, class_name: 'Province', foreign_key: 'concern_province_id' - belongs_to :concern_district, class_name: 'District', foreign_key: 'concern_district_id' - belongs_to :concern_commune, class_name: 'Commune', foreign_key: 'concern_commune_id' - belongs_to :concern_village, class_name: 'Village', foreign_key: 'concern_village_id' + belongs_to :province, counter_cache: true, optional: true + belongs_to :district, optional: true + belongs_to :subdistrict, optional: true + belongs_to :township, optional: true + belongs_to :state, optional: true + belongs_to :received_by, class_name: 'User', foreign_key: 'received_by_id', counter_cache: true, optional: true + belongs_to :followed_up_by, class_name: 'User', foreign_key: 'followed_up_by_id', counter_cache: true, optional: true + belongs_to :birth_province, class_name: 'Province', foreign_key: 'birth_province_id', counter_cache: true, optional: true + belongs_to :commune, optional: true + belongs_to :village, optional: true + belongs_to :referee, optional: true + belongs_to :carer, optional: true + belongs_to :call, optional: true + + belongs_to :concern_province, class_name: 'Province', foreign_key: 'concern_province_id', optional: true + belongs_to :concern_district, class_name: 'District', foreign_key: 'concern_district_id', optional: true + belongs_to :concern_commune, class_name: 'Commune', foreign_key: 'concern_commune_id', optional: true + belongs_to :concern_village, class_name: 'Village', foreign_key: 'concern_village_id', optional: true belongs_to :global_identity, class_name: 'GlobalIdentity', foreign_key: 'global_id', primary_key: :ulid has_many :hotlines, dependent: :destroy diff --git a/app/models/leave_program.rb b/app/models/leave_program.rb index 5704b624a4..f741b151ad 100644 --- a/app/models/leave_program.rb +++ b/app/models/leave_program.rb @@ -10,7 +10,7 @@ class LeaveProgram < ApplicationRecord alias_attribute :new_date, :exit_date validates :exit_date, presence: true - validate :exit_date_value, if: 'exit_date.present?' + validate :exit_date_value, if: -> { exit_date.present? } after_save :create_leave_program_history after_create :update_enrollment_status, :set_client_status diff --git a/app/views/clients/show.haml b/app/views/clients/show.haml index 638a365f81..4f57d554fc 100644 --- a/app/views/clients/show.haml +++ b/app/views/clients/show.haml @@ -12,7 +12,7 @@ %tr %td{rowspan: '4'} - if @client.profile? - = image_tag @client.profile.photo, alt: @client.profile.file.filename, id: 'client_photo' + = image_tag @client.profile.photo.url, alt: @client.profile.file.filename, id: 'client_photo' %td = "#{t('.name')} :" = editable @client, :given_name, value: @client.given_name, url: api_client_path(@client.id), pk: @client.id diff --git a/app/views/dashboards/_client_search.haml b/app/views/dashboards/_client_search.haml index b2fc8c0c11..5a3b5d6c41 100644 --- a/app/views/dashboards/_client_search.haml +++ b/app/views/dashboards/_client_search.haml @@ -1,15 +1,15 @@ #client-search.modal.fade{ role: 'dialog' } - .modal-dialog.modal-lg - .modal-content - .modal-body - .panel.panel-default#search-client - .panel-heading.heading-label.text-font - %h3.text-center= t('.search_client') - .panel-body - .row - .col-xs-12 - = hidden_field :search_for_client, 'format-input', value: t('.search_for_client') - = hidden_field :searching, 'format-input', value: t('.searching') - = hidden_field :not_found, 'format-input', value: t('.not_found') - = hidden_field :please_enter_more_char, 'format-input', value: t('.please_enter_more') - = text_field_tag 'client-search', nil, class: 'form-control select2-search-client', id: 'search-client-select2' + .modal-dialog.modal-lg + .modal-content + .modal-body + .panel.panel-default#search-client + .panel-heading.heading-label.text-font + %h3.text-center= t('.search_client') + .panel-body + .row + .col-xs-12 + = hidden_field :search_for_client, 'format-input', value: t('.search_for_client') + = hidden_field :searching, 'format-input', value: t('.searching') + = hidden_field :not_found, 'format-input', value: t('.not_found') + = hidden_field :please_enter_more_char, 'format-input', value: t('.please_enter_more') + = select_tag 'client-search', nil, prompt: t('.search_for_client'), class: 'form-control select2-search-client', id: 'search-client-select2' From fb0d6731140598b605f496f2b616882e175f9fcb Mon Sep 17 00:00:00 2001 From: kirykr Date: Tue, 15 Dec 2020 18:12:45 +0700 Subject: [PATCH 08/27] update select dropdown template --- app/assets/javascripts/dashboards/index.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/dashboards/index.coffee b/app/assets/javascripts/dashboards/index.coffee index 213d6e48d5..bd8a2a95cf 100644 --- a/app/assets/javascripts/dashboards/index.coffee +++ b/app/assets/javascripts/dashboards/index.coffee @@ -271,8 +271,8 @@ CIF.DashboardsIndex = do -> en_full_name = "#{client.given_name} #{client.family_name}" local_full_name = "#{client.local_given_name} #{client.local_family_name}" markup = "#{en_full_name} | #{local_full_name} (#{client.id})" - # - $container = $('
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
') + + $container = $("
") $container.find('.select2-result-client__full_name').append markup $container.find('.select2-result-client__slug').text client.slug $container.find('.select2-result-client_status').append "Status: #{client.status}" From 792c78a906e0285b51c4ded3d2632ab1aeb9a933 Mon Sep 17 00:00:00 2001 From: kirykr Date: Tue, 15 Dec 2020 18:27:01 +0700 Subject: [PATCH 09/27] update config/webpacker.yml resolve_path --- config/webpacker.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/config/webpacker.yml b/config/webpacker.yml index ba93758338..0c445efd2c 100644 --- a/config/webpacker.yml +++ b/config/webpacker.yml @@ -11,7 +11,7 @@ default: &default # Additional paths webpack should lookup modules # ['app/assets', 'engine/foo/app/assets'] - resolved_paths: [] + additional_paths: [] # Reload manifest.json on all requests so we reload latest compiled packs cache_manifest: false @@ -71,10 +71,9 @@ development: use_local_ip: false quiet: false headers: - 'Access-Control-Allow-Origin': '*' + "Access-Control-Allow-Origin": "*" watch_options: - ignored: '**/node_modules/**' - + ignored: "**/node_modules/**" test: <<: *default From ab1377d8309d2bda8944afefc52286835ea05402 Mon Sep 17 00:00:00 2001 From: kirykr Date: Wed, 16 Dec 2020 14:52:36 +0700 Subject: [PATCH 10/27] fixed service type select --- app/assets/javascripts/application.js | 1 + .../javascripts/dashboards/index.coffee | 135 ++---------------- .../javascripts/program_streams/form.coffee | 82 +---------- app/assets/javascripts/service_types.coffee | 97 +++++++++++++ app/assets/stylesheets/dashboards/index.scss | 2 +- .../stylesheets/program_streams/form.scss | 49 ++++--- app/serializers/program_stream_serializer.rb | 2 +- .../_referral_source_category_reminder.haml | 2 +- 8 files changed, 149 insertions(+), 221 deletions(-) create mode 100644 app/assets/javascripts/service_types.coffee diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 9cc4c387f1..c8120f51ab 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -136,3 +136,4 @@ //= require referees/index //= require field_settings/index //= require donors/index +//= require service_types diff --git a/app/assets/javascripts/dashboards/index.coffee b/app/assets/javascripts/dashboards/index.coffee index bd8a2a95cf..8603a4bd4a 100644 --- a/app/assets/javascripts/dashboards/index.coffee +++ b/app/assets/javascripts/dashboards/index.coffee @@ -1,12 +1,4 @@ CIF.DashboardsIndex = do -> - @window.getService = (td, select_id)-> - data = {id: td.children[0].value, text: td.children[0].text } - - newOption = new Option(data.text, data.id, true, true) - - # Append it to the select - $(".type-of-service select##{select_id.id}").append(newOption).trigger 'change' - _init = -> # _clientGenderChart() # _clientStatusChart() @@ -21,7 +13,8 @@ CIF.DashboardsIndex = do -> _initTrackingDatatable() _handleMultiForm() _handleProgramStreamServiceShow() - _handleProgramStreamServiceSelect2() + service_types = new CIF.ServiceTypes({ element: '.type-of-service', isFromDashboard: true }) + service_types.selectServiceTypeTableResult() _updateProgramStream() _enableSaveReferralSource() _clickSaveReferral() @@ -36,13 +29,13 @@ CIF.DashboardsIndex = do -> localStorage.setItem('from login', false) _enableSaveReferralSource = -> - $('.referral_source_ancestry .select').on 'select2-selected', (e) -> - classNames = this.className.split(' ') - saveBtnClass = ".save-" + classNames[2] + $('.referral_source_ancestry .select').on 'select2:select', (e) -> + referralId = this.id.match(/\d+/)[0] + saveBtnClass = ".save-" + referralId $(saveBtnClass).removeAttr 'disabled' - $('.referral_source_ancestry .select').on 'select2-removed', (e) -> - classNames = this.className.split(' ') - saveBtnClass = ".save-" + classNames[2] + $('.referral_source_ancestry .select').on 'select2:unselect', (e) -> + referralId = this.id.match(/\d+/)[0] + saveBtnClass = ".save-" + referralId $(saveBtnClass).attr('disabled', 'disabled') _clickSaveReferral = -> @@ -75,6 +68,7 @@ CIF.DashboardsIndex = do -> _initSelect2 = -> $('select').select2 + placeholder: "---Please select an option---", minimumInputLength: 0 allowClear: true @@ -165,77 +159,6 @@ CIF.DashboardsIndex = do -> $('.modal.in').removeClass('modal-popup') return - - _handleProgramStreamServiceSelect2 = -> - $('.type-of-service select').select2 - dropdownAutoWidth : true - width: 'auto' - - createHeaderElement = (options, indexes)-> - html = "" - indexes.forEach (entry) -> - html += "#{options[entry][0]}" - html - - createRowElement = (options, indexes, select_id) -> - html = "" - indexes.forEach (entries) -> - td = "" - entries.forEach (index) -> - td += "" - - html += "#{td}" - html - - $('.type-of-service select').on 'select2-open', (e) -> - $('#select2-drop').addClass('drop') - arr = [] - i = 0 - while i < $('.type-of-service').data('custom').length - arr.push i - i++ - - options = $('.type-of-service').data('custom') - results = [] - chunk_size = 13 - while arr.length > 0 - results.push arr.splice(0, chunk_size) - - indexes = results.shift() - th = createHeaderElement(options, indexes) - row = createRowElement(options, results, @id) - - html = '' + th + '' + row + '
' - $('#select2-drop .select2-results').html $(html) - # $('.select2-results').prepend "#{html}" - return - - removeError = (element) -> - element.removeClass('has-error') - element.find('.help-block').remove() - - $('.type-of-service select').on 'select2-close', (e)-> - uniqueArray = _.compact(_.uniq($(this).val())) - if uniqueArray.length > 0 - removeError($(this.parentElement)) - arrId = this.id.split('_') - $("#edit_program_stream_#{arrId[arrId.length - 1]} input[type='submit']").removeAttr('disabled') - - if uniqueArray.length > 3 - $(this.parentElement).append "

#{$('input#confirm-question').val()}

" if $(this.parentElement).find('.help-block').length == 0 - $(this.parentElement).addClass('has-error') - - return - - $('.type-of-service select').on 'select2-removed', -> - uniqueArray = _.compact(_.uniq($(this).val())) - if uniqueArray.length <= 3 - removeError($(this.parentElement)) - - if uniqueArray.length == 0 - arrId = this.id.split('_') - $("#edit_program_stream_#{arrId[arrId.length - 1]} input[type='submit']").attr('disabled', 'disabled') - _updateProgramStream = -> $('form.simple_form.program-stream').on 'submit', (e)-> e.preventDefault @@ -247,8 +170,8 @@ CIF.DashboardsIndex = do -> data: $(this).serialize() dataType: 'JSON' success: (json) -> - successImg = $("#edit_program_stream_#{json.program_stream.id} .save-success-#{json.program_stream.id}").removeClass('hide') - $("#edit_program_stream_#{json.program_stream.id} input[type='submit']").replaceWith(successImg) + successImg = $("#edit_program_stream_#{json.id || json.program_stream.id} .save-success-#{json.id || json.program_stream.id}").removeClass('hide') + $("#edit_program_stream_#{json.id || json.program_stream.id} input[type='submit']").replaceWith(successImg) return error: (response, status, msg) -> $("form[action='#{@url}'] .program_stream_services").append "

Failed to update program stream.

" if $(this.parentElement).find('.help-block').length == 0 @@ -285,7 +208,7 @@ CIF.DashboardsIndex = do -> win = window.open("clients/#{client.slug}", '_blank') $('#search-client-select2').trigger("change") - $('#search-client-select2').select2 + $('#search-client-select2').select2( language: "km" ajax: url: "/api/clients/search_client" @@ -300,37 +223,9 @@ CIF.DashboardsIndex = do -> minimumInputLength: 1 templateResult: formatClient templateSelection: formatClientSelection - - # $('#search-client-select2').select2( - # placeholder: searchForClient - # minimumInputLength: 1 - # formatSearching: searchingClient - # formatNoMatches: notFoundClient - # formatInputTooShort: enterCharacters - # ajax: - # url: '/api/clients/search_client' - # dataType: 'json' - # quietMillis: 250 - # data: (term, page) -> - # { q: term } - # results: (data, page) -> - # { results: data } - # cache: true - # initSelection: (element, callback) -> - # id = $(element).select2('data', null).trigger("change") - # return - # formatResult: (client) -> - # en_full_name = "#{client.given_name} #{client.family_name}" - # local_full_name = "#{client.local_given_name} #{client.local_family_name}" - # markup = "#{en_full_name} | #{local_full_name} (#{client.id})" - - # return markup - # formatSelection: (client) -> - # win = window.open("clients/#{client.slug}", '_blank') - # $('#search-client-select2').trigger("change") - # ).on 'select2-blur select2-focus', -> - # $(@).trigger("change") - # return + ).on 'select2:closing select2:opening', -> + $(@).trigger("change") + return $(window).focus(-> $('#search-client-select2').trigger("change") diff --git a/app/assets/javascripts/program_streams/form.coffee b/app/assets/javascripts/program_streams/form.coffee index 5889c57113..cae4129c48 100644 --- a/app/assets/javascripts/program_streams/form.coffee +++ b/app/assets/javascripts/program_streams/form.coffee @@ -6,12 +6,6 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C TRACKING = '' DATA_TABLE_ID = '' @formBuilder = [] - @window.getServiceData = (td)-> - data = {id: td.children[0].value, text: td.children[0].text } - - newOption = new Option(data.text, data.id, true, true) - # Append it to the select - $('#type-of-service select').append(newOption).trigger 'change' _init = -> @filterTranslation = '' @@ -38,7 +32,8 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C _custom_field_list() _initDataTable() _filterSelecting() - _selectServiceTypeTableResult() + service_types = new CIF.ServiceTypes({ element: '#type-of-service', isFromDashboard: false }) + service_types.selectServiceTypeTableResult() _initDataTable = -> $('.custom-field-table').each -> @@ -805,78 +800,5 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C $(select).find('select').val('1').trigger('change') , 100) - _selectServiceTypeTableResult = () -> - if $('li').hasClass('first current') - # $('#type-of-service select').select2() - - format = (state) -> - if !state.id - return state.text - - serviceFormatSelection = (service) -> - service.text - - $('#type-of-service select').select2 - width: '100%' - formatSelection: serviceFormatSelection - escapeMarkup: (m) -> - m - - createHeaderElement = (options, indexes)-> - html = "" - indexes.forEach (entry) -> - html += "#{options[entry][0]}" - html - - createRowElement = (options, indexes) -> - html = "" - indexes.forEach (entries) -> - td = "" - entries.forEach (index) -> - td += "" - - html += "#{td}" - html - - $('#type-of-service select').on 'select2-open', (e) -> - arr = [] - i = 0 - while i < $('#type-of-service').data('custom').length - arr.push i - i++ - - options = $('#type-of-service').data('custom') - results = [] - chunk_size = 13 - while arr.length > 0 - results.push arr.splice(0, chunk_size) - - indexes = results.shift() - th = createHeaderElement(options, indexes) - row = createRowElement(options, results) - - html = '' + th + '' + row + '
' - $('#select2-drop .select2-results').html $(html) - # $('.select2-results').prepend "#{html}" - return - - removeError = (element) -> - element.removeClass('has-error') - element.find('.help-block').remove() - - $('#type-of-service select').on 'select2-close', (e)-> - uniqueArray = _.compact(_.uniq($(this).val())) - - if uniqueArray.length > 3 - $(this.parentElement).append "

#{$('input#confirm-question').val()}

" if $(this.parentElement).find('.help-block').length == 0 - $(this.parentElement).addClass('has-error') - - return - - $('#type-of-service select').on 'select2-removed', -> - uniqueArray = _.compact(_.uniq($(this).val())) - if uniqueArray.length <= 3 - removeError($(this.parentElement)) - { init: _init } diff --git a/app/assets/javascripts/service_types.coffee b/app/assets/javascripts/service_types.coffee new file mode 100644 index 0000000000..bc6b4967ce --- /dev/null +++ b/app/assets/javascripts/service_types.coffee @@ -0,0 +1,97 @@ +class CIF.ServiceTypes + constructor: (args)-> + @isFromDashboard = args['isFromDashboard'] + @element = args['element'] + window.getServiceData = (td = undefined, select_id = null) -> + if td == undefined + return + + data = { id: td.children[0].value, text: td.children[0].text } + newOption = new Option(data.text, data.id, true, true) + # Append it to the select + typeOfServiceSelect = if select_id == null then $('#type-of-service select') else $(".type-of-service select##{select_id && select_id.id}") + typeOfServiceSelect.append(newOption).trigger 'change' + + selectServiceTypeTableResult: -> + isFromDashboard = @isFromDashboard + element = @element + if $('li').hasClass('first current') or $('#program-stream-service').length > 0 + # $('#type-of-service select').select2() + + format = (state) -> + if !state.id + return state.text + + serviceFormatSelection = (service) -> + service.text + + $("#{element} select").select2 + width: '100%' + templateSelection: serviceFormatSelection + escapeMarkup: (m) -> + m + + createHeaderElement = (options, indexes)-> + html = "" + indexes.forEach (entry) -> + html += "#{options[entry][0]}" + html + + createRowElement = (options, indexes, select_id=null) -> + html = "" + indexes.forEach (entries) -> + td = "" + entries.forEach (index) -> + td += "" + + html += "#{td}" + html + + $("#{element} select").on 'select2:open', (e) -> + arr = [] + i = 0 + while i < $(element).data('custom').length + arr.push i + i++ + + options = $(element).data('custom') + results = [] + chunk_size = 13 + while arr.length > 0 + results.push arr.splice(0, chunk_size) + + indexes = results.shift() + th = createHeaderElement(options, indexes) + elementId = if isFromDashboard then @id else null + row = createRowElement(options, results, elementId) + + html = '' + th + '' + row + '
' + $('.select2-dropdown .select2-results').html $(html) + # $('.select2-results').prepend "#{html}" + return + + removeError = (element) -> + element.removeClass('has-error') + element.find('.help-block').remove() + + $("#{element} select").on 'select2:close', (e)-> + uniqueArray = _.compact(_.uniq($(this).val())) + if uniqueArray.length > 3 + $(this.parentElement).append "

#{$('input#confirm-question').val()}

" if $(this.parentElement).find('.help-block').length == 0 + $(this.parentElement).addClass('has-error') + + if uniqueArray.length > 0 + removeError($(this.parentElement)) + arrId = this.id.split('_') + $("#edit_program_stream_#{arrId[arrId.length - 1]} input[type='submit']").removeAttr('disabled') + + return + + $("#{element} select").on 'select2:unselect', -> + uniqueArray = _.compact(_.uniq($(this).val())) + if uniqueArray.length <= 3 + removeError($(this.parentElement)) + + if uniqueArray.length == 0 + arrId = this.id.split('_') + $("#edit_program_stream_#{arrId[arrId.length - 1]} input[type='submit']").attr('disabled', 'disabled') diff --git a/app/assets/stylesheets/dashboards/index.scss b/app/assets/stylesheets/dashboards/index.scss index bc1c63b8ef..ef1252c14e 100644 --- a/app/assets/stylesheets/dashboards/index.scss +++ b/app/assets/stylesheets/dashboards/index.scss @@ -106,7 +106,7 @@ body[id="dashboards-index"] { } } - #select2-drop.drop { + .select2-dropdown { height: 349px; .select2-results { max-height: 340px; diff --git a/app/assets/stylesheets/program_streams/form.scss b/app/assets/stylesheets/program_streams/form.scss index cce4825f3f..dd787d4e0a 100644 --- a/app/assets/stylesheets/program_streams/form.scss +++ b/app/assets/stylesheets/program_streams/form.scss @@ -1,16 +1,21 @@ -body[id='program_streams-new'], body[id='program_streams-edit'], -body[id='program_streams-update'], body[id='program_streams-create'] { - +body[id="program_streams-new"], +body[id="program_streams-edit"], +body[id="program_streams-update"], +body[id="program_streams-create"] { .wizard > .content > .body { - #enrollment, #trackings, #exit-program { + #enrollment, + #trackings, + #exit-program { position: relative; - input[type='radio'] { + input[type="radio"] { display: inline-block; } } } - .wizard > .actions a[href="#finish"], .wizard > .actions a[href="#finish"]:hover, .wizard > .actions a[href="#finish"]:active { - background: #1ab394; + .wizard > .actions a[href="#finish"], + .wizard > .actions a[href="#finish"]:hover, + .wizard > .actions a[href="#finish"]:active { + background: #1ab394; } .wizard > .steps > ul > li { @@ -31,10 +36,10 @@ body[id='program_streams-update'], body[id='program_streams-create'] { } .btn-group.group-actions { - button[data-add='rule'] { + button[data-add="rule"] { background-color: #1ab394; border-color: #1ab394; - color: #FFFFFF; + color: #ffffff; } button { margin-right: 5px; @@ -55,7 +60,8 @@ body[id='program_streams-update'], body[id='program_streams-create'] { .rule-value-container { border-left: none; - select, input { + select, + input { width: 180px; } input.form-control { @@ -93,7 +99,7 @@ body[id='program_streams-update'], body[id='program_streams-create'] { .cb-wrap:before, .cb-wrap:after { - content: ''; + content: ""; display: table; } @@ -126,27 +132,34 @@ body[id='program_streams-update'], body[id='program_streams-create'] { #width-modal { width: 80%; - th.form-title, td.form-title { + th.form-title, + td.form-title { width: 40% !important; } - th.organization, td.organization { + th.organization, + td.organization { width: 25% !important; } - th.entity-type, td.entity-type { + th.entity-type, + td.entity-type { width: 20% !important; } - th.copy, td.copy { + th.copy, + td.copy { width: 15% !important; } - table.custom-field-table, .dataTables_scrollHeadInner, .dataTables_scrollHead, .dataTables_scrollBody { + table.custom-field-table, + .dataTables_scrollHeadInner, + .dataTables_scrollHead, + .dataTables_scrollBody { width: 100% !important; } - .dataTables_scrollHeadInner{ + .dataTables_scrollHeadInner { padding-right: 0 !important; } @@ -176,7 +189,7 @@ body[id='program_streams-update'], body[id='program_streams-create'] { } } - #select2-drop { + .select2-dropdown { height: 349px; .select2-results { max-height: 340px; diff --git a/app/serializers/program_stream_serializer.rb b/app/serializers/program_stream_serializer.rb index a80719fd0c..0d832e4e96 100644 --- a/app/serializers/program_stream_serializer.rb +++ b/app/serializers/program_stream_serializer.rb @@ -3,6 +3,6 @@ class ProgramStreamSerializer < ActiveModel::Serializer has_many :trackings def enrollable_client_ids - AdvancedSearches::ClientAdvancedSearch.new(object.rules, Client.all).filter.ids if object.rules.present? + (AdvancedSearches::ClientAdvancedSearch.new(object.rules, Client.all).filter&.ids || []) if object.rules && object.rules['rules'].present? end end diff --git a/app/views/dashboards/_referral_source_category_reminder.haml b/app/views/dashboards/_referral_source_category_reminder.haml index 22081ba172..0f55a87876 100644 --- a/app/views/dashboards/_referral_source_category_reminder.haml +++ b/app/views/dashboards/_referral_source_category_reminder.haml @@ -17,7 +17,7 @@ %label %abbr{ title: 'required' } * = t('.ancestry') - = f.input :ancestry, collection: referral_source_name(ReferralSource.parent_categories), label: false, input_html: { class: "#{referral_source.id}" } + = f.input :ancestry, collection: referral_source_name(ReferralSource.parent_categories), label: false, input_html: { class: "referral_source_ancestry select #{referral_source.id}", id: "referral_source_ancestry-#{referral_source.id}" } .col-xs-2 = f.submit t('save'), class: "btn btn-primary form-btn save-#{referral_source.id} save-referral-btn", disabled: :disabled, data: { disable_with: "#{t('save')}..." } = image_tag 'success.png', class: "save-success hide save-success#{referral_source.id}" From 17f8ea5321fc59cb148380ad71430511e6d3cbee Mon Sep 17 00:00:00 2001 From: kirykr Date: Fri, 18 Dec 2020 15:58:26 +0700 Subject: [PATCH 11/27] fixed duplicated table in the schema --- config/initializers/i18n/backend/custom.rb | 9 +- db/schema.rb | 6461 ++++++-------------- 2 files changed, 1827 insertions(+), 4643 deletions(-) diff --git a/config/initializers/i18n/backend/custom.rb b/config/initializers/i18n/backend/custom.rb index c8a68992e1..92253ff6f6 100644 --- a/config/initializers/i18n/backend/custom.rb +++ b/config/initializers/i18n/backend/custom.rb @@ -25,11 +25,14 @@ module I18n::Backend::Custom def load_translations(*filenames) filenames = I18n.load_path if filenames.empty? filenames.flatten.each { |filename| load_file(filename) } + load_custom_labels = nil - if ActiveRecord::Base.connection.table_exists? 'settings' - nepal_commune_mapping if Setting.first&.country_name == 'nepal' + def database_exists? + nepal_commune_mapping if ActiveRecord::Base.connection.table_exists?('settings') && Setting.first&.country_name == 'nepal' + load_custom_labels if ActiveRecord::Base.connection.table_exists? 'field_settings' + rescue ActiveRecord::NoDatabaseError + false end - load_custom_labels if ActiveRecord::Base.connection.table_exists? 'field_settings' end def load_custom_labels diff --git a/db/schema.rb b/db/schema.rb index db8976893b..ab9169e7ee 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,5116 +10,2297 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_12_14_014711) do +ActiveRecord::Schema.define(version: 20201203072103) do # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" enable_extension "hstore" enable_extension "pgcrypto" - enable_extension "plpgsql" enable_extension "uuid-ossp" - create_table "able_screening_questions", id: :serial, force: :cascade do |t| - t.string "question" - t.string "mode" - t.integer "stage_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "alert_manager" - t.integer "question_group_id" - t.index ["question_group_id"], name: "index_able_screening_questions_on_question_group_id" - t.index ["question_group_id"], name: "index_able_screening_questions_on_question_group_id" - t.index ["stage_id"], name: "index_able_screening_questions_on_stage_id" - t.index ["stage_id"], name: "index_able_screening_questions_on_stage_id" - end - - create_table "able_screening_questions", id: :serial, force: :cascade do |t| - t.string "question" - t.string "mode" - t.integer "stage_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "alert_manager" - t.integer "question_group_id" - t.index ["question_group_id"], name: "index_able_screening_questions_on_question_group_id" - t.index ["question_group_id"], name: "index_able_screening_questions_on_question_group_id" - t.index ["stage_id"], name: "index_able_screening_questions_on_stage_id" - t.index ["stage_id"], name: "index_able_screening_questions_on_stage_id" - end - - create_table "action_results", id: :serial, force: :cascade do |t| - t.text "action", default: "" - t.text "result", default: "" - t.integer "government_form_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["government_form_id"], name: "index_action_results_on_government_form_id" - t.index ["government_form_id"], name: "index_action_results_on_government_form_id" + create_table "able_screening_questions", force: :cascade do |t| + t.string "question" + t.string "mode" + t.integer "stage_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "alert_manager" + t.integer "question_group_id" end - create_table "action_results", id: :serial, force: :cascade do |t| - t.text "action", default: "" - t.text "result", default: "" - t.integer "government_form_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["government_form_id"], name: "index_action_results_on_government_form_id" - t.index ["government_form_id"], name: "index_action_results_on_government_form_id" + add_index "able_screening_questions", ["question_group_id"], name: "index_able_screening_questions_on_question_group_id", using: :btree + add_index "able_screening_questions", ["stage_id"], name: "index_able_screening_questions_on_stage_id", using: :btree + + create_table "action_results", force: :cascade do |t| + t.text "action", default: "" + t.text "result", default: "" + t.integer "government_form_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "admin_users", id: :integer, default: nil, force: :cascade do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "token" - t.string "first_name" - t.string "last_name" - t.string "provider", default: "email", null: false - t.string "uid", default: "", null: false - t.json "tokens" - t.index ["email"], name: "index_admin_users_on_email", unique: true - t.index ["email"], name: "index_admin_users_on_email", unique: true - t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true - t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true - t.index ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true - t.index ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true - end - - create_table "admin_users", id: :integer, default: nil, force: :cascade do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + add_index "action_results", ["government_form_id"], name: "index_action_results_on_government_form_id", using: :btree + + create_table "admin_users", force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "token" - t.string "first_name" - t.string "last_name" - t.string "provider", default: "email", null: false - t.string "uid", default: "", null: false - t.json "tokens" - t.index ["email"], name: "index_admin_users_on_email", unique: true - t.index ["email"], name: "index_admin_users_on_email", unique: true - t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true - t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true - t.index ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true - t.index ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true - end - - create_table "advanced_searches", id: :serial, force: :cascade do |t| - t.string "name" - t.text "description" - t.jsonb "queries" - t.jsonb "field_visible" - t.string "custom_forms" - t.string "program_streams" - t.string "enrollment_check", default: "" - t.string "tracking_check", default: "" - t.string "exit_form_check", default: "" - t.string "quantitative_check", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "user_id" - t.string "hotline_check", default: "" - t.index ["user_id"], name: "index_advanced_searches_on_user_id" - t.index ["user_id"], name: "index_advanced_searches_on_user_id" - end - - create_table "advanced_searches", id: :serial, force: :cascade do |t| - t.string "name" - t.text "description" - t.jsonb "queries" - t.jsonb "field_visible" - t.string "custom_forms" - t.string "program_streams" - t.string "enrollment_check", default: "" - t.string "tracking_check", default: "" - t.string "exit_form_check", default: "" - t.string "quantitative_check", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "user_id" - t.string "hotline_check", default: "" - t.index ["user_id"], name: "index_advanced_searches_on_user_id" - t.index ["user_id"], name: "index_advanced_searches_on_user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "token" + t.string "first_name" + t.string "last_name" + t.string "provider", default: "email", null: false + t.string "uid", default: "", null: false + t.json "tokens" end - create_table "agencies", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "agencies_clients_count", default: 0 - end + add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true, using: :btree + add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree + add_index "admin_users", ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true, using: :btree - create_table "agencies", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "agencies_clients_count", default: 0 + create_table "advanced_searches", force: :cascade do |t| + t.string "name" + t.text "description" + t.jsonb "queries" + t.jsonb "field_visible" + t.string "custom_forms" + t.string "program_streams" + t.string "enrollment_check", default: "" + t.string "tracking_check", default: "" + t.string "exit_form_check", default: "" + t.string "quantitative_check", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "user_id" + t.string "hotline_check", default: "" end - create_table "agencies_clients", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "agency_id" - t.datetime "created_at" - t.datetime "updated_at" - end + add_index "advanced_searches", ["user_id"], name: "index_advanced_searches_on_user_id", using: :btree - create_table "agencies_clients", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "agency_id" + create_table "agencies", force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" t.datetime "created_at" t.datetime "updated_at" + t.integer "agencies_clients_count", default: 0 end - create_table "agency_clients", id: :serial, force: :cascade do |t| - t.integer "agency_id" - t.integer "client_id" + create_table "agencies_clients", force: :cascade do |t| + t.integer "client_id" + t.integer "agency_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "agency_clients", id: :serial, force: :cascade do |t| - t.integer "agency_id" - t.integer "client_id" + create_table "agency_clients", force: :cascade do |t| + t.integer "agency_id" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "assessment_domains", id: :serial, force: :cascade do |t| - t.text "note", default: "" - t.integer "previous_score" - t.integer "score" - t.text "reason", default: "" - t.integer "assessment_id" - t.integer "domain_id" - t.datetime "created_at" - t.datetime "updated_at" - t.text "goal", default: "" - t.string "attachments", default: [], array: true - t.boolean "goal_required", default: true - t.boolean "required_task_last", default: false - t.index ["score"], name: "index_assessment_domains_on_score" - t.index ["score"], name: "index_assessment_domains_on_score" - end - - create_table "assessment_domains", id: :serial, force: :cascade do |t| - t.text "note", default: "" - t.integer "previous_score" - t.integer "score" - t.text "reason", default: "" - t.integer "assessment_id" - t.integer "domain_id" - t.datetime "created_at" - t.datetime "updated_at" - t.text "goal", default: "" - t.string "attachments", default: [], array: true - t.boolean "goal_required", default: true - t.boolean "required_task_last", default: false - t.index ["score"], name: "index_assessment_domains_on_score" - t.index ["score"], name: "index_assessment_domains_on_score" + create_table "ar_internal_metadata", primary_key: "key", force: :cascade do |t| + t.string "value" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false end - create_table "assessments", id: :serial, force: :cascade do |t| + create_table "assessment_domains", force: :cascade do |t| + t.text "note", default: "" + t.integer "previous_score" + t.integer "score" + t.text "reason", default: "" + t.integer "assessment_id" + t.integer "domain_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "client_id" - t.boolean "completed", default: false - t.boolean "default", default: true - t.index ["client_id"], name: "index_assessments_on_client_id" - t.index ["client_id"], name: "index_assessments_on_client_id" + t.text "goal", default: "" + t.string "attachments", default: [], array: true + t.boolean "goal_required", default: true + t.boolean "required_task_last", default: false end - create_table "assessments", id: :serial, force: :cascade do |t| + add_index "assessment_domains", ["score"], name: "index_assessment_domains_on_score", using: :btree + + create_table "assessments", force: :cascade do |t| t.datetime "created_at" t.datetime "updated_at" - t.integer "client_id" - t.boolean "completed", default: false - t.boolean "default", default: true - t.index ["client_id"], name: "index_assessments_on_client_id" - t.index ["client_id"], name: "index_assessments_on_client_id" + t.integer "client_id" + t.boolean "completed", default: false + t.boolean "default", default: true end - create_table "attachments", id: :serial, force: :cascade do |t| - t.string "image" - t.integer "able_screening_question_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "file", default: "" - t.integer "progress_note_id" - t.index ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id" - t.index ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id" - t.index ["progress_note_id"], name: "index_attachments_on_progress_note_id" - t.index ["progress_note_id"], name: "index_attachments_on_progress_note_id" - end + add_index "assessments", ["client_id"], name: "index_assessments_on_client_id", using: :btree - create_table "attachments", id: :serial, force: :cascade do |t| - t.string "image" - t.integer "able_screening_question_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "file", default: "" - t.integer "progress_note_id" - t.index ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id" - t.index ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id" - t.index ["progress_note_id"], name: "index_attachments_on_progress_note_id" - t.index ["progress_note_id"], name: "index_attachments_on_progress_note_id" + create_table "attachments", force: :cascade do |t| + t.string "image" + t.integer "able_screening_question_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "file", default: "" + t.integer "progress_note_id" end - create_table "calendars", id: :serial, force: :cascade do |t| - t.string "title" - t.datetime "start_date" - t.datetime "end_date" - t.boolean "sync_status", default: false - t.integer "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["user_id"], name: "index_calendars_on_user_id" - t.index ["user_id"], name: "index_calendars_on_user_id" - end + add_index "attachments", ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id", using: :btree + add_index "attachments", ["progress_note_id"], name: "index_attachments_on_progress_note_id", using: :btree - create_table "calendars", id: :serial, force: :cascade do |t| - t.string "title" + create_table "calendars", force: :cascade do |t| + t.string "title" t.datetime "start_date" t.datetime "end_date" - t.boolean "sync_status", default: false - t.integer "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["user_id"], name: "index_calendars_on_user_id" - t.index ["user_id"], name: "index_calendars_on_user_id" + t.boolean "sync_status", default: false + t.integer "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "call_necessities", id: :serial, force: :cascade do |t| - t.integer "call_id" - t.integer "necessity_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["call_id"], name: "index_call_necessities_on_call_id" - t.index ["call_id"], name: "index_call_necessities_on_call_id" - t.index ["necessity_id"], name: "index_call_necessities_on_necessity_id" - t.index ["necessity_id"], name: "index_call_necessities_on_necessity_id" - end + add_index "calendars", ["user_id"], name: "index_calendars_on_user_id", using: :btree - create_table "call_necessities", id: :serial, force: :cascade do |t| - t.integer "call_id" - t.integer "necessity_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["call_id"], name: "index_call_necessities_on_call_id" - t.index ["call_id"], name: "index_call_necessities_on_call_id" - t.index ["necessity_id"], name: "index_call_necessities_on_necessity_id" - t.index ["necessity_id"], name: "index_call_necessities_on_necessity_id" + create_table "call_necessities", force: :cascade do |t| + t.integer "call_id" + t.integer "necessity_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "call_protection_concerns", id: :serial, force: :cascade do |t| - t.integer "call_id" - t.integer "protection_concern_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["call_id"], name: "index_call_protection_concerns_on_call_id" - t.index ["call_id"], name: "index_call_protection_concerns_on_call_id" - t.index ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id" - t.index ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id" - end + add_index "call_necessities", ["call_id"], name: "index_call_necessities_on_call_id", using: :btree + add_index "call_necessities", ["necessity_id"], name: "index_call_necessities_on_necessity_id", using: :btree - create_table "call_protection_concerns", id: :serial, force: :cascade do |t| - t.integer "call_id" - t.integer "protection_concern_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["call_id"], name: "index_call_protection_concerns_on_call_id" - t.index ["call_id"], name: "index_call_protection_concerns_on_call_id" - t.index ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id" - t.index ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id" + create_table "call_protection_concerns", force: :cascade do |t| + t.integer "call_id" + t.integer "protection_concern_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "calls", id: :serial, force: :cascade do |t| - t.integer "referee_id" - t.string "phone_call_id", default: "" - t.integer "receiving_staff_id" - t.datetime "start_datetime" - t.string "call_type", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "information_provided", default: "" - t.date "date_of_call" - t.boolean "answered_call" - t.boolean "called_before" - t.boolean "requested_update", default: false - t.boolean "not_a_phone_call", default: false - t.boolean "childsafe_agent" - t.string "other_more_information", default: "" - t.string "brief_note_summary", default: "" - t.index ["referee_id"], name: "index_calls_on_referee_id" - t.index ["referee_id"], name: "index_calls_on_referee_id" - end - - create_table "calls", id: :serial, force: :cascade do |t| - t.integer "referee_id" - t.string "phone_call_id", default: "" - t.integer "receiving_staff_id" + add_index "call_protection_concerns", ["call_id"], name: "index_call_protection_concerns_on_call_id", using: :btree + add_index "call_protection_concerns", ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id", using: :btree + + create_table "calls", force: :cascade do |t| + t.integer "referee_id" + t.string "phone_call_id", default: "" + t.integer "receiving_staff_id" t.datetime "start_datetime" - t.string "call_type", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "information_provided", default: "" - t.date "date_of_call" - t.boolean "answered_call" - t.boolean "called_before" - t.boolean "requested_update", default: false - t.boolean "not_a_phone_call", default: false - t.boolean "childsafe_agent" - t.string "other_more_information", default: "" - t.string "brief_note_summary", default: "" - t.index ["referee_id"], name: "index_calls_on_referee_id" - t.index ["referee_id"], name: "index_calls_on_referee_id" - end - - create_table "carers", id: :serial, force: :cascade do |t| - t.string "address_type", default: "" - t.string "current_address", default: "" - t.string "email", default: "" - t.string "gender", default: "" - t.string "house_number", default: "" - t.string "outside_address", default: "" - t.string "street_number", default: "" - t.string "client_relationship", default: "" - t.boolean "outside", default: false - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name", default: "" - t.string "phone", default: "" - t.boolean "same_as_client", default: false - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "state_id" - t.integer "township_id" - t.integer "subdistrict_id" - t.string "locality" - t.index ["commune_id"], name: "index_carers_on_commune_id" - t.index ["commune_id"], name: "index_carers_on_commune_id" - t.index ["district_id"], name: "index_carers_on_district_id" - t.index ["district_id"], name: "index_carers_on_district_id" - t.index ["province_id"], name: "index_carers_on_province_id" - t.index ["province_id"], name: "index_carers_on_province_id" - t.index ["state_id"], name: "index_carers_on_state_id" - t.index ["state_id"], name: "index_carers_on_state_id" - t.index ["subdistrict_id"], name: "index_carers_on_subdistrict_id" - t.index ["subdistrict_id"], name: "index_carers_on_subdistrict_id" - t.index ["township_id"], name: "index_carers_on_township_id" - t.index ["township_id"], name: "index_carers_on_township_id" - t.index ["village_id"], name: "index_carers_on_village_id" - t.index ["village_id"], name: "index_carers_on_village_id" - end - - create_table "carers", id: :serial, force: :cascade do |t| - t.string "address_type", default: "" - t.string "current_address", default: "" - t.string "email", default: "" - t.string "gender", default: "" - t.string "house_number", default: "" - t.string "outside_address", default: "" - t.string "street_number", default: "" - t.string "client_relationship", default: "" - t.boolean "outside", default: false - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name", default: "" - t.string "phone", default: "" - t.boolean "same_as_client", default: false - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "state_id" - t.integer "township_id" - t.integer "subdistrict_id" - t.string "locality" - t.index ["commune_id"], name: "index_carers_on_commune_id" - t.index ["commune_id"], name: "index_carers_on_commune_id" - t.index ["district_id"], name: "index_carers_on_district_id" - t.index ["district_id"], name: "index_carers_on_district_id" - t.index ["province_id"], name: "index_carers_on_province_id" - t.index ["province_id"], name: "index_carers_on_province_id" - t.index ["state_id"], name: "index_carers_on_state_id" - t.index ["state_id"], name: "index_carers_on_state_id" - t.index ["subdistrict_id"], name: "index_carers_on_subdistrict_id" - t.index ["subdistrict_id"], name: "index_carers_on_subdistrict_id" - t.index ["township_id"], name: "index_carers_on_township_id" - t.index ["township_id"], name: "index_carers_on_township_id" - t.index ["village_id"], name: "index_carers_on_village_id" - t.index ["village_id"], name: "index_carers_on_village_id" - end - - create_table "case_closures", id: :serial, force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "call_type", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "information_provided", default: "" + t.date "date_of_call" + t.boolean "answered_call" + t.boolean "called_before" + t.boolean "requested_update", default: false + t.boolean "not_a_phone_call", default: false + t.boolean "childsafe_agent" + t.string "other_more_information", default: "" + t.string "brief_note_summary", default: "" + end + + add_index "calls", ["referee_id"], name: "index_calls_on_referee_id", using: :btree + + create_table "carers", force: :cascade do |t| + t.string "address_type", default: "" + t.string "current_address", default: "" + t.string "email", default: "" + t.string "gender", default: "" + t.string "house_number", default: "" + t.string "outside_address", default: "" + t.string "street_number", default: "" + t.string "client_relationship", default: "" + t.boolean "outside", default: false + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name", default: "" + t.string "phone", default: "" + t.boolean "same_as_client", default: false + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "state_id" + t.integer "township_id" + t.integer "subdistrict_id" + t.string "locality" + end + + add_index "carers", ["commune_id"], name: "index_carers_on_commune_id", using: :btree + add_index "carers", ["district_id"], name: "index_carers_on_district_id", using: :btree + add_index "carers", ["province_id"], name: "index_carers_on_province_id", using: :btree + add_index "carers", ["state_id"], name: "index_carers_on_state_id", using: :btree + add_index "carers", ["subdistrict_id"], name: "index_carers_on_subdistrict_id", using: :btree + add_index "carers", ["township_id"], name: "index_carers_on_township_id", using: :btree + add_index "carers", ["village_id"], name: "index_carers_on_village_id", using: :btree + + create_table "case_closures", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "case_contracts", force: :cascade do |t| + t.date "signed_on" + t.integer "case_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "case_contracts", ["case_id"], name: "index_case_contracts_on_case_id", using: :btree + + create_table "case_note_domain_groups", force: :cascade do |t| + t.text "note", default: "" + t.integer "case_note_id" + t.integer "domain_group_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "attachments", default: [], array: true + end + + create_table "case_notes", force: :cascade do |t| + t.string "attendee", default: "" + t.datetime "meeting_date" + t.integer "assessment_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "client_id" + t.string "interaction_type", default: "" + t.boolean "custom", default: false + t.text "note", default: "" + t.integer "custom_assessment_setting_id" + t.string "selected_domain_group_ids", default: [], array: true end - create_table "case_closures", id: :serial, force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end + add_index "case_notes", ["client_id"], name: "index_case_notes_on_client_id", using: :btree + add_index "case_notes", ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id", using: :btree - create_table "case_contracts", id: :serial, force: :cascade do |t| - t.date "signed_on" - t.integer "case_id" + create_table "case_worker_clients", force: :cascade do |t| + t.integer "user_id" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["case_id"], name: "index_case_contracts_on_case_id" - t.index ["case_id"], name: "index_case_contracts_on_case_id" end - create_table "case_contracts", id: :serial, force: :cascade do |t| - t.date "signed_on" - t.integer "case_id" + add_index "case_worker_clients", ["client_id"], name: "index_case_worker_clients_on_client_id", using: :btree + add_index "case_worker_clients", ["user_id"], name: "index_case_worker_clients_on_user_id", using: :btree + + create_table "case_worker_tasks", force: :cascade do |t| + t.integer "user_id" + t.integer "task_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["case_id"], name: "index_case_contracts_on_case_id" - t.index ["case_id"], name: "index_case_contracts_on_case_id" end - create_table "case_note_domain_groups", id: :serial, force: :cascade do |t| - t.text "note", default: "" - t.integer "case_note_id" - t.integer "domain_group_id" + add_index "case_worker_tasks", ["task_id"], name: "index_case_worker_tasks_on_task_id", using: :btree + add_index "case_worker_tasks", ["user_id"], name: "index_case_worker_tasks_on_user_id", using: :btree + + create_table "cases", force: :cascade do |t| + t.date "start_date" + t.string "carer_names", default: "" + t.string "carer_address", default: "" + t.string "carer_phone_number", default: "" + t.float "support_amount", default: 0.0 + t.text "support_note", default: "" + t.text "case_type", default: "EC" + t.boolean "exited", default: false + t.date "exit_date" + t.text "exit_note", default: "" + t.integer "user_id" + t.integer "client_id" + t.integer "family_id" + t.integer "partner_id" + t.integer "province_id" t.datetime "created_at" t.datetime "updated_at" - t.string "attachments", default: [], array: true + t.boolean "family_preservation", default: false + t.string "status", default: "" + t.date "placement_date" + t.date "initial_assessment_date" + t.float "case_length" + t.date "case_conference_date" + t.float "time_in_care" + t.boolean "exited_from_cif", default: false + t.boolean "current", default: true + t.datetime "deleted_at" end - create_table "case_note_domain_groups", id: :serial, force: :cascade do |t| - t.text "note", default: "" - t.integer "case_note_id" - t.integer "domain_group_id" + add_index "cases", ["deleted_at"], name: "index_cases_on_deleted_at", using: :btree + + create_table "changelog_types", force: :cascade do |t| + t.integer "changelog_id" + t.string "change_type", default: "" + t.string "description", default: "" t.datetime "created_at" t.datetime "updated_at" - t.string "attachments", default: [], array: true end - create_table "case_notes", id: :serial, force: :cascade do |t| - t.string "attendee", default: "" - t.datetime "meeting_date" - t.integer "assessment_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "client_id" - t.string "interaction_type", default: "" - t.boolean "custom", default: false - t.text "note", default: "" - t.integer "custom_assessment_setting_id" - t.string "selected_domain_group_ids", default: [], array: true - t.index ["client_id"], name: "index_case_notes_on_client_id" - t.index ["client_id"], name: "index_case_notes_on_client_id" - t.index ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id" - t.index ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id" - end - - create_table "case_notes", id: :serial, force: :cascade do |t| - t.string "attendee", default: "" - t.datetime "meeting_date" - t.integer "assessment_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "client_id" - t.string "interaction_type", default: "" - t.boolean "custom", default: false - t.text "note", default: "" - t.integer "custom_assessment_setting_id" - t.string "selected_domain_group_ids", default: [], array: true - t.index ["client_id"], name: "index_case_notes_on_client_id" - t.index ["client_id"], name: "index_case_notes_on_client_id" - t.index ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id" - t.index ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id" - end - - create_table "case_worker_clients", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "client_id" + add_index "changelog_types", ["changelog_id"], name: "index_changelog_types_on_changelog_id", using: :btree + + create_table "changelogs", force: :cascade do |t| + t.string "change_version", default: "" + t.string "description", default: "" + t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["client_id"], name: "index_case_worker_clients_on_client_id" - t.index ["client_id"], name: "index_case_worker_clients_on_client_id" - t.index ["user_id"], name: "index_case_worker_clients_on_user_id" - t.index ["user_id"], name: "index_case_worker_clients_on_user_id" end - create_table "case_worker_clients", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "client_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["client_id"], name: "index_case_worker_clients_on_client_id" - t.index ["client_id"], name: "index_case_worker_clients_on_client_id" - t.index ["user_id"], name: "index_case_worker_clients_on_user_id" - t.index ["user_id"], name: "index_case_worker_clients_on_user_id" + add_index "changelogs", ["user_id"], name: "index_changelogs_on_user_id", using: :btree + + create_table "children_plans", force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "case_worker_tasks", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "task_id" + create_table "client_client_types", force: :cascade do |t| + t.integer "client_id" + t.integer "client_type_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["task_id"], name: "index_case_worker_tasks_on_task_id" - t.index ["task_id"], name: "index_case_worker_tasks_on_task_id" - t.index ["user_id"], name: "index_case_worker_tasks_on_user_id" - t.index ["user_id"], name: "index_case_worker_tasks_on_user_id" end - create_table "case_worker_tasks", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "task_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["task_id"], name: "index_case_worker_tasks_on_task_id" - t.index ["task_id"], name: "index_case_worker_tasks_on_task_id" - t.index ["user_id"], name: "index_case_worker_tasks_on_user_id" - t.index ["user_id"], name: "index_case_worker_tasks_on_user_id" - end - - create_table "cases", id: :serial, force: :cascade do |t| - t.date "start_date" - t.string "carer_names", default: "" - t.string "carer_address", default: "" - t.string "carer_phone_number", default: "" - t.float "support_amount", default: 0.0 - t.text "support_note", default: "" - t.text "case_type", default: "EC" - t.boolean "exited", default: false - t.date "exit_date" - t.text "exit_note", default: "" - t.integer "user_id" - t.integer "client_id" - t.integer "family_id" - t.integer "partner_id" - t.integer "province_id" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "family_preservation", default: false - t.string "status", default: "" - t.date "placement_date" - t.date "initial_assessment_date" - t.float "case_length" - t.date "case_conference_date" - t.float "time_in_care" - t.boolean "exited_from_cif", default: false - t.boolean "current", default: true - t.datetime "deleted_at" - t.index ["deleted_at"], name: "index_cases_on_deleted_at" - t.index ["deleted_at"], name: "index_cases_on_deleted_at" - end - - create_table "cases", id: :serial, force: :cascade do |t| - t.date "start_date" - t.string "carer_names", default: "" - t.string "carer_address", default: "" - t.string "carer_phone_number", default: "" - t.float "support_amount", default: 0.0 - t.text "support_note", default: "" - t.text "case_type", default: "EC" - t.boolean "exited", default: false - t.date "exit_date" - t.text "exit_note", default: "" - t.integer "user_id" - t.integer "client_id" - t.integer "family_id" - t.integer "partner_id" - t.integer "province_id" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "family_preservation", default: false - t.string "status", default: "" - t.date "placement_date" - t.date "initial_assessment_date" - t.float "case_length" - t.date "case_conference_date" - t.float "time_in_care" - t.boolean "exited_from_cif", default: false - t.boolean "current", default: true + add_index "client_client_types", ["client_id"], name: "index_client_client_types_on_client_id", using: :btree + add_index "client_client_types", ["client_type_id"], name: "index_client_client_types_on_client_type_id", using: :btree + + create_table "client_enrollment_trackings", force: :cascade do |t| + t.jsonb "properties", default: {} + t.integer "client_enrollment_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "tracking_id" + end + + add_index "client_enrollment_trackings", ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id", using: :btree + + create_table "client_enrollments", force: :cascade do |t| + t.jsonb "properties", default: {} + t.string "status", default: "Active" + t.integer "client_id" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.date "enrollment_date" t.datetime "deleted_at" - t.index ["deleted_at"], name: "index_cases_on_deleted_at" - t.index ["deleted_at"], name: "index_cases_on_deleted_at" end - create_table "changelog_types", id: :serial, force: :cascade do |t| - t.integer "changelog_id" - t.string "change_type", default: "" - t.string "description", default: "" + add_index "client_enrollments", ["client_id"], name: "index_client_enrollments_on_client_id", using: :btree + add_index "client_enrollments", ["deleted_at"], name: "index_client_enrollments_on_deleted_at", using: :btree + add_index "client_enrollments", ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id", using: :btree + + create_table "client_interviewees", force: :cascade do |t| + t.integer "client_id" + t.integer "interviewee_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["changelog_id"], name: "index_changelog_types_on_changelog_id" - t.index ["changelog_id"], name: "index_changelog_types_on_changelog_id" end - create_table "changelog_types", id: :serial, force: :cascade do |t| - t.integer "changelog_id" - t.string "change_type", default: "" - t.string "description", default: "" + add_index "client_interviewees", ["client_id"], name: "index_client_interviewees_on_client_id", using: :btree + add_index "client_interviewees", ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id", using: :btree + + create_table "client_needs", force: :cascade do |t| + t.integer "rank" + t.integer "client_id" + t.integer "need_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["changelog_id"], name: "index_changelog_types_on_changelog_id" - t.index ["changelog_id"], name: "index_changelog_types_on_changelog_id" end - create_table "changelogs", id: :serial, force: :cascade do |t| - t.string "change_version", default: "" - t.string "description", default: "" - t.integer "user_id" + add_index "client_needs", ["client_id"], name: "index_client_needs_on_client_id", using: :btree + add_index "client_needs", ["need_id"], name: "index_client_needs_on_need_id", using: :btree + + create_table "client_problems", force: :cascade do |t| + t.integer "rank" + t.integer "client_id" + t.integer "problem_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["user_id"], name: "index_changelogs_on_user_id" - t.index ["user_id"], name: "index_changelogs_on_user_id" end - create_table "changelogs", id: :serial, force: :cascade do |t| - t.string "change_version", default: "" - t.string "description", default: "" - t.integer "user_id" + add_index "client_problems", ["client_id"], name: "index_client_problems_on_client_id", using: :btree + add_index "client_problems", ["problem_id"], name: "index_client_problems_on_problem_id", using: :btree + + create_table "client_quantitative_cases", force: :cascade do |t| + t.integer "quantitative_case_id" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["user_id"], name: "index_changelogs_on_user_id" - t.index ["user_id"], name: "index_changelogs_on_user_id" end - create_table "children_plans", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "client_right_government_forms", force: :cascade do |t| + t.integer "government_form_id" + t.integer "client_right_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "children_plans", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + add_index "client_right_government_forms", ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id", using: :btree + add_index "client_right_government_forms", ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id", using: :btree + + create_table "client_rights", force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "client_type_government_forms", force: :cascade do |t| + t.integer "client_type_id" + t.integer "government_form_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "client_type_government_forms", ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id", using: :btree + add_index "client_type_government_forms", ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id", using: :btree + + create_table "client_types", force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "clients", force: :cascade do |t| + t.string "code", default: "" + t.string "given_name", default: "" + t.string "family_name", default: "" + t.string "gender", default: "" + t.date "date_of_birth" + t.string "status", default: "Referred" + t.date "initial_referral_date" + t.string "referral_phone", default: "" + t.integer "birth_province_id" + t.integer "received_by_id" + t.integer "followed_up_by_id" + t.date "follow_up_date" + t.string "current_address", default: "" + t.string "school_name", default: "" + t.string "school_grade", default: "" + t.boolean "has_been_in_orphanage" + t.boolean "able", default: false + t.boolean "has_been_in_government_care" + t.text "relevant_referral_information", default: "" + t.string "archive_state", default: "" + t.text "rejected_note", default: "" + t.integer "province_id" + t.integer "referral_source_id" + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "completed", default: false + t.text "reason_for_referral", default: "" + t.boolean "is_receiving_additional_benefits", default: false + t.text "background", default: "" + t.integer "grade" + t.string "slug" + t.string "able_state", default: "" + t.integer "donor_id" + t.string "local_given_name", default: "" + t.string "local_family_name", default: "" + t.string "kid_id", default: "" + t.string "house_number", default: "" + t.string "street_number", default: "" + t.string "old_village", default: "" + t.string "old_commune", default: "" + t.string "archive_district", default: "" + t.string "live_with", default: "" + t.integer "id_poor" + t.integer "rice_support", default: 0 + t.text "exit_note", default: "" + t.date "exit_date" + t.date "accepted_date" + t.string "gov_city", default: "" + t.string "gov_commune", default: "" + t.string "gov_district", default: "" + t.date "gov_date" + t.string "gov_village_code", default: "" + t.string "gov_client_code", default: "" + t.string "gov_interview_village", default: "" + t.string "gov_interview_commune", default: "" + t.string "gov_interview_district", default: "" + t.string "gov_interview_city", default: "" + t.string "gov_caseworker_name", default: "" + t.string "gov_caseworker_phone", default: "" + t.string "gov_carer_name", default: "" + t.string "gov_carer_relationship", default: "" + t.string "gov_carer_home", default: "" + t.string "gov_carer_street", default: "" + t.string "gov_carer_village", default: "" + t.string "gov_carer_commune", default: "" + t.string "gov_carer_district", default: "" + t.string "gov_carer_city", default: "" + t.string "gov_carer_phone", default: "" + t.string "gov_information_source", default: "" + t.text "gov_referral_reason", default: "" + t.text "gov_guardian_comment", default: "" + t.text "gov_caseworker_comment", default: "" + t.integer "district_id" + t.string "telephone_number", default: "" + t.string "name_of_referee", default: "" + t.string "main_school_contact", default: "" + t.string "rated_for_id_poor", default: "" + t.string "what3words", default: "" + t.string "exit_reasons", default: [], array: true + t.string "exit_circumstance", default: "" + t.string "other_info_of_exit", default: "" + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "subdistrict_id" + t.integer "township_id" + t.integer "state_id" + t.string "country_origin", default: "" + t.integer "commune_id" + t.integer "village_id" + t.string "profile" + t.integer "referral_source_category_id" + t.string "archived_slug" + t.integer "assessments_count", default: 0, null: false + t.integer "current_family_id" + t.boolean "outside", default: false + t.string "outside_address", default: "" + t.string "address_type", default: "" + t.string "client_phone", default: "" + t.string "phone_owner", default: "" + t.string "client_email", default: "" + t.string "referee_relationship", default: "" + t.integer "referee_id" + t.integer "carer_id" + t.string "nickname", default: "" + t.string "relation_to_referee", default: "" + t.boolean "concern_is_outside", default: false + t.string "concern_outside_address", default: "" + t.integer "concern_province_id" + t.integer "concern_district_id" + t.integer "concern_commune_id" + t.integer "concern_village_id" + t.string "concern_street", default: "" + t.string "concern_house", default: "" + t.string "concern_address", default: "" + t.string "concern_address_type", default: "" + t.string "concern_phone", default: "" + t.string "concern_phone_owner", default: "" + t.string "concern_email", default: "" + t.string "concern_email_owner", default: "" + t.string "concern_location", default: "" + t.boolean "concern_same_as_client", default: false + t.string "location_description", default: "" + t.string "phone_counselling_summary", default: "" + t.string "presented_id" + t.string "id_number" + t.string "other_phone_number" + t.string "brsc_branch" + t.string "current_island" + t.string "current_street" + t.string "current_po_box" + t.string "current_city" + t.string "current_settlement" + t.string "current_resident_own_or_rent" + t.string "current_household_type" + t.string "island2" + t.string "street2" + t.string "po_box2" + t.string "city2" + t.string "settlement2" + t.string "resident_own_or_rent2" + t.string "household_type2" + t.string "legacy_brcs_id" + t.boolean "whatsapp", default: false + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + t.boolean "other_phone_whatsapp", default: false + t.string "preferred_language", default: "English" + t.boolean "national_id", default: false, null: false + t.boolean "birth_cert", default: false, null: false + t.boolean "family_book", default: false, null: false + t.boolean "passport", default: false, null: false + t.boolean "travel_doc", default: false, null: false + t.boolean "referral_doc", default: false, null: false + t.boolean "local_consent", default: false, null: false + t.boolean "police_interview", default: false, null: false + t.boolean "other_legal_doc", default: false, null: false + t.string "national_id_files", default: [], array: true + t.string "birth_cert_files", default: [], array: true + t.string "family_book_files", default: [], array: true + t.string "passport_files", default: [], array: true + t.string "travel_doc_files", default: [], array: true + t.string "referral_doc_files", default: [], array: true + t.string "local_consent_files", default: [], array: true + t.string "police_interview_files", default: [], array: true + t.string "other_legal_doc_files", default: [], array: true + t.string "global_id" + t.boolean "referred_external", default: false + t.string "marital_status" + t.string "nationality" + t.string "ethnicity" + t.string "location_of_concern" + t.string "type_of_trafficking" + t.text "education_background" + t.string "department" + t.string "neighbor_name" + t.string "neighbor_phone" + t.string "dosavy_name" + t.string "dosavy_phone" + t.string "chief_commune_name" + t.string "chief_commune_phone" + t.string "chief_village_name" + t.string "chief_village_phone" + t.string "ccwc_name" + t.string "ccwc_phone" + t.string "legal_team_name" + t.string "legal_representative_name" + t.string "legal_team_phone" + t.string "other_agency_name" + t.string "other_representative_name" + t.string "other_agency_phone" + t.string "locality" + t.string "national_id_number" + t.string "passport_number" + end + + add_index "clients", ["commune_id"], name: "index_clients_on_commune_id", using: :btree + add_index "clients", ["current_family_id"], name: "index_clients_on_current_family_id", using: :btree + add_index "clients", ["district_id"], name: "index_clients_on_district_id", using: :btree + add_index "clients", ["donor_id"], name: "index_clients_on_donor_id", using: :btree + add_index "clients", ["external_id"], name: "index_clients_on_external_id", using: :btree + add_index "clients", ["global_id"], name: "index_clients_on_global_id", using: :btree + add_index "clients", ["mosvy_number"], name: "index_clients_on_mosvy_number", using: :btree + add_index "clients", ["slug"], name: "index_clients_on_slug", unique: true, using: :btree + add_index "clients", ["state_id"], name: "index_clients_on_state_id", using: :btree + add_index "clients", ["subdistrict_id"], name: "index_clients_on_subdistrict_id", using: :btree + add_index "clients", ["township_id"], name: "index_clients_on_township_id", using: :btree + add_index "clients", ["village_id"], name: "index_clients_on_village_id", using: :btree + + create_table "clients_quantitative_cases", force: :cascade do |t| + t.integer "client_id" + t.integer "quantitative_case_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "communes", force: :cascade do |t| + t.string "code", default: "" + t.string "name_kh", default: "" + t.string "name_en", default: "" + t.integer "district_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "district_type" + end + + add_index "communes", ["district_id"], name: "index_communes_on_district_id", using: :btree + + create_table "custom_assessment_settings", force: :cascade do |t| + t.string "custom_assessment_name", default: "Custom Assessment" + t.integer "max_custom_assessment", default: 6 + t.string "custom_assessment_frequency", default: "month" + t.integer "custom_age", default: 18 + t.integer "setting_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "enable_custom_assessment", default: false + end + + create_table "custom_field_permissions", force: :cascade do |t| + t.integer "user_id" + t.integer "custom_field_id" + t.boolean "readable", default: true + t.boolean "editable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "custom_field_permissions", ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id", using: :btree + add_index "custom_field_permissions", ["user_id"], name: "index_custom_field_permissions_on_user_id", using: :btree + + create_table "custom_field_properties", force: :cascade do |t| + t.jsonb "properties", default: {} + t.string "custom_formable_type" + t.integer "custom_formable_id" + t.integer "custom_field_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "attachments" + t.integer "user_id" + end + + add_index "custom_field_properties", ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id", using: :btree + + create_table "custom_fields", force: :cascade do |t| + t.string "entity_type", default: "" + t.text "properties", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "form_title", default: "" + t.string "frequency", default: "" + t.integer "time_of_frequency", default: 0 + t.string "ngo_name", default: "" + t.jsonb "fields" end - create_table "client_client_types", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "client_type_id" + create_table "departments", force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" t.datetime "created_at" t.datetime "updated_at" - t.index ["client_id"], name: "index_client_client_types_on_client_id" - t.index ["client_id"], name: "index_client_client_types_on_client_id" - t.index ["client_type_id"], name: "index_client_client_types_on_client_type_id" - t.index ["client_type_id"], name: "index_client_client_types_on_client_type_id" + t.integer "users_count", default: 0 end - create_table "client_client_types", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "client_type_id" + create_table "districts", force: :cascade do |t| + t.string "name" + t.integer "province_id" + t.string "code", default: "" t.datetime "created_at" t.datetime "updated_at" - t.index ["client_id"], name: "index_client_client_types_on_client_id" - t.index ["client_id"], name: "index_client_client_types_on_client_id" - t.index ["client_type_id"], name: "index_client_client_types_on_client_type_id" - t.index ["client_type_id"], name: "index_client_client_types_on_client_type_id" end - create_table "client_enrollment_trackings", id: :serial, force: :cascade do |t| - t.jsonb "properties", default: {} - t.integer "client_enrollment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "tracking_id" - t.index ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id" - t.index ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id" - end + add_index "districts", ["province_id"], name: "index_districts_on_province_id", using: :btree - create_table "client_enrollment_trackings", id: :serial, force: :cascade do |t| - t.jsonb "properties", default: {} - t.integer "client_enrollment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "tracking_id" - t.index ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id" - t.index ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id" + create_table "domain_groups", force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "domains_count", default: 0 end - create_table "client_enrollments", id: :serial, force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "status", default: "Active" - t.integer "client_id" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.date "enrollment_date" + create_table "domain_program_streams", force: :cascade do |t| + t.integer "program_stream_id" + t.integer "domain_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.datetime "deleted_at" - t.index ["client_id"], name: "index_client_enrollments_on_client_id" - t.index ["client_id"], name: "index_client_enrollments_on_client_id" - t.index ["deleted_at"], name: "index_client_enrollments_on_deleted_at" - t.index ["deleted_at"], name: "index_client_enrollments_on_deleted_at" - t.index ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id" - t.index ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id" end - create_table "client_enrollments", id: :serial, force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "status", default: "Active" - t.integer "client_id" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.date "enrollment_date" - t.datetime "deleted_at" - t.index ["client_id"], name: "index_client_enrollments_on_client_id" - t.index ["client_id"], name: "index_client_enrollments_on_client_id" - t.index ["deleted_at"], name: "index_client_enrollments_on_deleted_at" - t.index ["deleted_at"], name: "index_client_enrollments_on_deleted_at" - t.index ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id" - t.index ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id" - end + add_index "domain_program_streams", ["deleted_at"], name: "index_domain_program_streams_on_deleted_at", using: :btree - create_table "client_interviewees", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "interviewee_id" + create_table "domains", force: :cascade do |t| + t.string "name", default: "" + t.string "identity", default: "" + t.text "description", default: "" + t.integer "domain_group_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["client_id"], name: "index_client_interviewees_on_client_id" - t.index ["client_id"], name: "index_client_interviewees_on_client_id" - t.index ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id" - t.index ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id" + t.integer "tasks_count", default: 0 + t.string "score_1_color", default: "danger" + t.string "score_2_color", default: "warning" + t.string "score_3_color", default: "info" + t.string "score_4_color", default: "primary" + t.text "score_1_definition", default: "" + t.text "score_2_definition", default: "" + t.text "score_3_definition", default: "" + t.text "score_4_definition", default: "" + t.boolean "custom_domain", default: false + t.text "local_description", default: "" + t.text "score_1_local_definition", default: "" + t.text "score_2_local_definition", default: "" + t.text "score_3_local_definition", default: "" + t.text "score_4_local_definition", default: "" + t.integer "custom_assessment_setting_id" end - create_table "client_interviewees", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "interviewee_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["client_id"], name: "index_client_interviewees_on_client_id" - t.index ["client_id"], name: "index_client_interviewees_on_client_id" - t.index ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id" - t.index ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id" + add_index "domains", ["domain_group_id"], name: "index_domains_on_domain_group_id", using: :btree + + create_table "donor_organizations", force: :cascade do |t| + t.integer "donor_id" + t.integer "organization_id" end - create_table "client_needs", id: :serial, force: :cascade do |t| - t.integer "rank" - t.integer "client_id" - t.integer "need_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["client_id"], name: "index_client_needs_on_client_id" - t.index ["client_id"], name: "index_client_needs_on_client_id" - t.index ["need_id"], name: "index_client_needs_on_need_id" - t.index ["need_id"], name: "index_client_needs_on_need_id" + add_index "donor_organizations", ["donor_id"], name: "index_donor_organizations_on_donor_id", using: :btree + add_index "donor_organizations", ["organization_id"], name: "index_donor_organizations_on_organization_id", using: :btree + + create_table "donors", force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "code", default: "" + t.string "global_id", limit: 32, default: "", null: false end - create_table "client_needs", id: :serial, force: :cascade do |t| - t.integer "rank" - t.integer "client_id" - t.integer "need_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["client_id"], name: "index_client_needs_on_client_id" - t.index ["client_id"], name: "index_client_needs_on_client_id" - t.index ["need_id"], name: "index_client_needs_on_need_id" - t.index ["need_id"], name: "index_client_needs_on_need_id" + add_index "donors", ["global_id"], name: "index_donors_on_global_id", using: :btree + + create_table "enrollment_trackings", force: :cascade do |t| + t.integer "enrollment_id" + t.integer "tracking_id" + t.jsonb "properties", default: {} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "client_problems", id: :serial, force: :cascade do |t| - t.integer "rank" - t.integer "client_id" - t.integer "problem_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["client_id"], name: "index_client_problems_on_client_id" - t.index ["client_id"], name: "index_client_problems_on_client_id" - t.index ["problem_id"], name: "index_client_problems_on_problem_id" - t.index ["problem_id"], name: "index_client_problems_on_problem_id" + add_index "enrollment_trackings", ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id", using: :btree + add_index "enrollment_trackings", ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id", using: :btree + + create_table "enrollments", force: :cascade do |t| + t.jsonb "properties", default: {} + t.string "status", default: "Active" + t.date "enrollment_date" + t.datetime "deleted_at" + t.string "programmable_type" + t.integer "programmable_id" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "client_problems", id: :serial, force: :cascade do |t| - t.integer "rank" - t.integer "client_id" - t.integer "problem_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["client_id"], name: "index_client_problems_on_client_id" - t.index ["client_id"], name: "index_client_problems_on_client_id" - t.index ["problem_id"], name: "index_client_problems_on_problem_id" - t.index ["problem_id"], name: "index_client_problems_on_problem_id" + add_index "enrollments", ["deleted_at"], name: "index_enrollments_on_deleted_at", using: :btree + add_index "enrollments", ["program_stream_id"], name: "index_enrollments_on_program_stream_id", using: :btree + + create_table "enter_ngo_users", force: :cascade do |t| + t.integer "user_id" + t.integer "enter_ngo_id" end - create_table "client_quantitative_cases", id: :serial, force: :cascade do |t| - t.integer "quantitative_case_id" - t.integer "client_id" + add_index "enter_ngo_users", ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id", using: :btree + add_index "enter_ngo_users", ["user_id"], name: "index_enter_ngo_users_on_user_id", using: :btree + + create_table "enter_ngos", force: :cascade do |t| + t.date "accepted_date" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" + t.datetime "deleted_at" end - create_table "client_quantitative_cases", id: :serial, force: :cascade do |t| - t.integer "quantitative_case_id" - t.integer "client_id" + add_index "enter_ngos", ["client_id"], name: "index_enter_ngos_on_client_id", using: :btree + add_index "enter_ngos", ["deleted_at"], name: "index_enter_ngos_on_deleted_at", using: :btree + + create_table "exit_ngos", force: :cascade do |t| + t.integer "client_id" + t.string "exit_circumstance", default: "" + t.string "other_info_of_exit", default: "" + t.string "exit_reasons", default: [], array: true + t.text "exit_note", default: "" + t.date "exit_date" t.datetime "created_at" t.datetime "updated_at" + t.datetime "deleted_at" end - create_table "client_right_government_forms", id: :serial, force: :cascade do |t| - t.integer "government_form_id" - t.integer "client_right_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id" - t.index ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id" - t.index ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id" - t.index ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id" - end + add_index "exit_ngos", ["client_id"], name: "index_exit_ngos_on_client_id", using: :btree + add_index "exit_ngos", ["deleted_at"], name: "index_exit_ngos_on_deleted_at", using: :btree - create_table "client_right_government_forms", id: :serial, force: :cascade do |t| - t.integer "government_form_id" - t.integer "client_right_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id" - t.index ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id" - t.index ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id" - t.index ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id" + create_table "external_system_global_identities", force: :cascade do |t| + t.integer "external_system_id" + t.string "global_id" + t.string "external_id" + t.string "client_slug" + t.string "organization_name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "client_rights", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end + add_index "external_system_global_identities", ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id", using: :btree + add_index "external_system_global_identities", ["global_id"], name: "index_external_system_global_identities_on_global_id", using: :btree - create_table "client_rights", id: :serial, force: :cascade do |t| - t.string "name", default: "" + create_table "external_systems", force: :cascade do |t| + t.string "name" + t.string "url" + t.string "token" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "client_type_government_forms", id: :serial, force: :cascade do |t| - t.integer "client_type_id" - t.integer "government_form_id" + create_table "families", force: :cascade do |t| + t.string "code" + t.string "name", default: "" + t.string "address", default: "" + t.text "caregiver_information", default: "" + t.integer "significant_family_member_count", default: 1 + t.float "household_income", default: 0.0 + t.boolean "dependable_income", default: false + t.integer "female_children_count", default: 0 + t.integer "male_children_count", default: 0 + t.integer "female_adult_count", default: 0 + t.integer "male_adult_count", default: 0 + t.string "family_type", default: "kinship" + t.date "contract_date" + t.integer "province_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id" - t.index ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id" - t.index ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id" - t.index ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id" + t.integer "cases_count", default: 0 + t.string "case_history", default: "" + t.datetime "deleted_at" + t.integer "children", default: [], array: true + t.string "status", default: "" + t.integer "district_id" + t.string "old_commune", default: "" + t.string "old_village", default: "" + t.string "house", default: "" + t.string "street", default: "" + t.integer "commune_id" + t.integer "village_id" + t.integer "user_id" + end + + add_index "families", ["commune_id"], name: "index_families_on_commune_id", using: :btree + add_index "families", ["deleted_at"], name: "index_families_on_deleted_at", using: :btree + add_index "families", ["district_id"], name: "index_families_on_district_id", using: :btree + add_index "families", ["user_id"], name: "index_families_on_user_id", using: :btree + add_index "families", ["village_id"], name: "index_families_on_village_id", using: :btree + + create_table "family_members", force: :cascade do |t| + t.string "adult_name", default: "" + t.date "date_of_birth" + t.string "occupation", default: "" + t.string "relation", default: "" + t.integer "family_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "guardian", default: false + t.string "gender" + t.text "note" + end + + add_index "family_members", ["family_id"], name: "index_family_members_on_family_id", using: :btree + + create_table "family_plans", force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "priority" + end + + create_table "field_setting_translations", force: :cascade do |t| + t.integer "field_setting_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "label" + end + + add_index "field_setting_translations", ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id", using: :btree + add_index "field_setting_translations", ["locale"], name: "index_field_setting_translations_on_locale", using: :btree + + create_table "field_settings", force: :cascade do |t| + t.string "name", null: false + t.string "group", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "type", default: "field", null: false + t.boolean "visible", default: true, null: false + t.string "current_label" + t.boolean "required", default: false + t.string "klass_name" + t.string "for_instances" + t.boolean "label_only", default: false + end + + create_table "form_builder_attachments", force: :cascade do |t| + t.string "name", default: "" + t.jsonb "file", default: [] + t.string "form_buildable_type" + t.integer "form_buildable_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "friendly_id_slugs", force: :cascade do |t| + t.string "slug", null: false + t.integer "sluggable_id", null: false + t.string "sluggable_type", limit: 50 + t.string "scope" + t.datetime "created_at" + end + + add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree + add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree + add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree + add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree + + create_table "global_identities", id: false, force: :cascade do |t| + t.string "ulid" end - create_table "client_type_government_forms", id: :serial, force: :cascade do |t| - t.integer "client_type_id" - t.integer "government_form_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id" - t.index ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id" - t.index ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id" - t.index ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id" + add_index "global_identities", ["ulid"], name: "index_global_identities_on_ulid", unique: true, using: :btree + + create_table "global_identity_organizations", force: :cascade do |t| + t.string "global_id" + t.integer "organization_id" + t.integer "client_id" end - create_table "client_types", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" + add_index "global_identity_organizations", ["client_id"], name: "index_global_identity_organizations_on_client_id", using: :btree + add_index "global_identity_organizations", ["global_id"], name: "index_global_identity_organizations_on_global_id", using: :btree + add_index "global_identity_organizations", ["organization_id"], name: "index_global_identity_organizations_on_organization_id", using: :btree + + create_table "global_identity_tmp", force: :cascade do |t| + t.binary "ulid" + t.string "ngo_name" + t.integer "client_id" end - create_table "client_types", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" + create_table "global_services", id: false, force: :cascade do |t| + t.uuid "uuid" end - create_table "clients", id: :serial, force: :cascade do |t| - t.string "code", default: "" - t.string "given_name", default: "" - t.string "family_name", default: "" - t.string "gender", default: "" - t.date "date_of_birth" - t.string "status", default: "Referred" - t.date "initial_referral_date" - t.string "referral_phone", default: "" - t.integer "birth_province_id" - t.integer "received_by_id" - t.integer "followed_up_by_id" - t.date "follow_up_date" - t.string "current_address", default: "" - t.string "school_name", default: "" - t.string "school_grade", default: "" - t.boolean "has_been_in_orphanage" - t.boolean "able", default: false - t.boolean "has_been_in_government_care" - t.text "relevant_referral_information", default: "" - t.string "archive_state", default: "" - t.text "rejected_note", default: "" - t.integer "province_id" - t.integer "referral_source_id" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "completed", default: false - t.text "reason_for_referral", default: "" - t.boolean "is_receiving_additional_benefits", default: false - t.text "background", default: "" - t.integer "grade" - t.string "slug" - t.string "able_state", default: "" - t.integer "donor_id" - t.string "local_given_name", default: "" - t.string "local_family_name", default: "" - t.string "kid_id", default: "" - t.string "house_number", default: "" - t.string "street_number", default: "" - t.string "old_village", default: "" - t.string "old_commune", default: "" - t.string "archive_district", default: "" - t.string "live_with", default: "" - t.integer "id_poor" - t.integer "rice_support", default: 0 - t.text "exit_note", default: "" - t.date "exit_date" - t.date "accepted_date" - t.string "gov_city", default: "" - t.string "gov_commune", default: "" - t.string "gov_district", default: "" - t.date "gov_date" - t.string "gov_village_code", default: "" - t.string "gov_client_code", default: "" - t.string "gov_interview_village", default: "" - t.string "gov_interview_commune", default: "" - t.string "gov_interview_district", default: "" - t.string "gov_interview_city", default: "" - t.string "gov_caseworker_name", default: "" - t.string "gov_caseworker_phone", default: "" - t.string "gov_carer_name", default: "" - t.string "gov_carer_relationship", default: "" - t.string "gov_carer_home", default: "" - t.string "gov_carer_street", default: "" - t.string "gov_carer_village", default: "" - t.string "gov_carer_commune", default: "" - t.string "gov_carer_district", default: "" - t.string "gov_carer_city", default: "" - t.string "gov_carer_phone", default: "" - t.string "gov_information_source", default: "" - t.text "gov_referral_reason", default: "" - t.text "gov_guardian_comment", default: "" - t.text "gov_caseworker_comment", default: "" - t.integer "district_id" - t.string "telephone_number", default: "" - t.string "name_of_referee", default: "" - t.string "main_school_contact", default: "" - t.string "rated_for_id_poor", default: "" - t.string "what3words", default: "" - t.string "exit_reasons", default: [], array: true - t.string "exit_circumstance", default: "" - t.string "other_info_of_exit", default: "" - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "subdistrict_id" - t.integer "township_id" - t.integer "state_id" - t.string "country_origin", default: "" - t.integer "commune_id" - t.integer "village_id" - t.string "profile" - t.integer "referral_source_category_id" - t.string "archived_slug" - t.integer "assessments_count", default: 0, null: false - t.integer "current_family_id" - t.boolean "outside", default: false - t.string "outside_address", default: "" - t.string "address_type", default: "" - t.string "client_phone", default: "" - t.string "phone_owner", default: "" - t.string "client_email", default: "" - t.string "referee_relationship", default: "" - t.integer "referee_id" - t.integer "carer_id" - t.string "nickname", default: "" - t.string "relation_to_referee", default: "" - t.boolean "concern_is_outside", default: false - t.string "concern_outside_address", default: "" - t.integer "concern_province_id" - t.integer "concern_district_id" - t.integer "concern_commune_id" - t.integer "concern_village_id" - t.string "concern_street", default: "" - t.string "concern_house", default: "" - t.string "concern_address", default: "" - t.string "concern_address_type", default: "" - t.string "concern_phone", default: "" - t.string "concern_phone_owner", default: "" - t.string "concern_email", default: "" - t.string "concern_email_owner", default: "" - t.string "concern_location", default: "" - t.boolean "concern_same_as_client", default: false - t.string "location_description", default: "" - t.string "phone_counselling_summary", default: "" - t.string "presented_id" - t.string "id_number" - t.string "other_phone_number" - t.string "brsc_branch" - t.string "current_island" - t.string "current_street" - t.string "current_po_box" - t.string "current_city" - t.string "current_settlement" - t.string "current_resident_own_or_rent" - t.string "current_household_type" - t.string "island2" - t.string "street2" - t.string "po_box2" - t.string "city2" - t.string "settlement2" - t.string "resident_own_or_rent2" - t.string "household_type2" - t.string "legacy_brcs_id" - t.boolean "whatsapp", default: false - t.string "global_id" - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - t.boolean "other_phone_whatsapp", default: false - t.string "preferred_language", default: "English" - t.boolean "national_id", default: false, null: false - t.boolean "birth_cert", default: false, null: false - t.boolean "family_book", default: false, null: false - t.boolean "passport", default: false, null: false - t.boolean "travel_doc", default: false, null: false - t.boolean "referral_doc", default: false, null: false - t.boolean "local_consent", default: false, null: false - t.boolean "police_interview", default: false, null: false - t.boolean "other_legal_doc", default: false, null: false - t.string "national_id_files", default: [], array: true - t.string "birth_cert_files", default: [], array: true - t.string "family_book_files", default: [], array: true - t.string "passport_files", default: [], array: true - t.string "travel_doc_files", default: [], array: true - t.string "referral_doc_files", default: [], array: true - t.string "local_consent_files", default: [], array: true - t.string "police_interview_files", default: [], array: true - t.string "other_legal_doc_files", default: [], array: true - t.boolean "referred_external", default: false - t.string "marital_status" - t.string "nationality" - t.string "ethnicity" - t.string "location_of_concern" - t.string "type_of_trafficking" - t.text "education_background" - t.string "department" - t.string "neighbor_name" - t.string "neighbor_phone" - t.string "dosavy_name" - t.string "dosavy_phone" - t.string "chief_commune_name" - t.string "chief_commune_phone" - t.string "chief_village_name" - t.string "chief_village_phone" - t.string "ccwc_name" - t.string "ccwc_phone" - t.string "legal_team_name" - t.string "legal_representative_name" - t.string "legal_team_phone" - t.string "other_agency_name" - t.string "other_representative_name" - t.string "other_agency_phone" - t.string "locality" - t.string "national_id_number" - t.string "passport_number" - t.index ["commune_id"], name: "index_clients_on_commune_id" - t.index ["commune_id"], name: "index_clients_on_commune_id" - t.index ["current_family_id"], name: "index_clients_on_current_family_id" - t.index ["current_family_id"], name: "index_clients_on_current_family_id" - t.index ["district_id"], name: "index_clients_on_district_id" - t.index ["district_id"], name: "index_clients_on_district_id" - t.index ["donor_id"], name: "index_clients_on_donor_id" - t.index ["donor_id"], name: "index_clients_on_donor_id" - t.index ["external_id"], name: "index_clients_on_external_id" - t.index ["external_id"], name: "index_clients_on_external_id" - t.index ["global_id"], name: "index_clients_on_global_id" - t.index ["global_id"], name: "index_clients_on_global_id" - t.index ["mosvy_number"], name: "index_clients_on_mosvy_number" - t.index ["mosvy_number"], name: "index_clients_on_mosvy_number" - t.index ["slug"], name: "index_clients_on_slug", unique: true - t.index ["slug"], name: "index_clients_on_slug", unique: true - t.index ["state_id"], name: "index_clients_on_state_id" - t.index ["state_id"], name: "index_clients_on_state_id" - t.index ["subdistrict_id"], name: "index_clients_on_subdistrict_id" - t.index ["subdistrict_id"], name: "index_clients_on_subdistrict_id" - t.index ["township_id"], name: "index_clients_on_township_id" - t.index ["township_id"], name: "index_clients_on_township_id" - t.index ["village_id"], name: "index_clients_on_village_id" - t.index ["village_id"], name: "index_clients_on_village_id" - end - - create_table "clients", id: :serial, force: :cascade do |t| - t.string "code", default: "" - t.string "given_name", default: "" - t.string "family_name", default: "" - t.string "gender", default: "" - t.date "date_of_birth" - t.string "status", default: "Referred" - t.date "initial_referral_date" - t.string "referral_phone", default: "" - t.integer "birth_province_id" - t.integer "received_by_id" - t.integer "followed_up_by_id" - t.date "follow_up_date" - t.string "current_address", default: "" - t.string "school_name", default: "" - t.string "school_grade", default: "" - t.boolean "has_been_in_orphanage" - t.boolean "able", default: false - t.boolean "has_been_in_government_care" - t.text "relevant_referral_information", default: "" - t.string "archive_state", default: "" - t.text "rejected_note", default: "" - t.integer "province_id" - t.integer "referral_source_id" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "completed", default: false - t.text "reason_for_referral", default: "" - t.boolean "is_receiving_additional_benefits", default: false - t.text "background", default: "" - t.integer "grade" - t.string "slug" - t.string "able_state", default: "" - t.integer "donor_id" - t.string "local_given_name", default: "" - t.string "local_family_name", default: "" - t.string "kid_id", default: "" - t.string "house_number", default: "" - t.string "street_number", default: "" - t.string "old_village", default: "" - t.string "old_commune", default: "" - t.string "archive_district", default: "" - t.string "live_with", default: "" - t.integer "id_poor" - t.integer "rice_support", default: 0 - t.text "exit_note", default: "" - t.date "exit_date" - t.date "accepted_date" - t.string "gov_city", default: "" - t.string "gov_commune", default: "" - t.string "gov_district", default: "" - t.date "gov_date" - t.string "gov_village_code", default: "" - t.string "gov_client_code", default: "" - t.string "gov_interview_village", default: "" - t.string "gov_interview_commune", default: "" - t.string "gov_interview_district", default: "" - t.string "gov_interview_city", default: "" - t.string "gov_caseworker_name", default: "" - t.string "gov_caseworker_phone", default: "" - t.string "gov_carer_name", default: "" - t.string "gov_carer_relationship", default: "" - t.string "gov_carer_home", default: "" - t.string "gov_carer_street", default: "" - t.string "gov_carer_village", default: "" - t.string "gov_carer_commune", default: "" - t.string "gov_carer_district", default: "" - t.string "gov_carer_city", default: "" - t.string "gov_carer_phone", default: "" - t.string "gov_information_source", default: "" - t.text "gov_referral_reason", default: "" - t.text "gov_guardian_comment", default: "" - t.text "gov_caseworker_comment", default: "" - t.integer "district_id" - t.string "telephone_number", default: "" - t.string "name_of_referee", default: "" - t.string "main_school_contact", default: "" - t.string "rated_for_id_poor", default: "" - t.string "what3words", default: "" - t.string "exit_reasons", default: [], array: true - t.string "exit_circumstance", default: "" - t.string "other_info_of_exit", default: "" - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "subdistrict_id" - t.integer "township_id" - t.integer "state_id" - t.string "country_origin", default: "" - t.integer "commune_id" - t.integer "village_id" - t.string "profile" - t.integer "referral_source_category_id" - t.string "archived_slug" - t.integer "assessments_count", default: 0, null: false - t.integer "current_family_id" - t.boolean "outside", default: false - t.string "outside_address", default: "" - t.string "address_type", default: "" - t.string "client_phone", default: "" - t.string "phone_owner", default: "" - t.string "client_email", default: "" - t.string "referee_relationship", default: "" - t.integer "referee_id" - t.integer "carer_id" - t.string "nickname", default: "" - t.string "relation_to_referee", default: "" - t.boolean "concern_is_outside", default: false - t.string "concern_outside_address", default: "" - t.integer "concern_province_id" - t.integer "concern_district_id" - t.integer "concern_commune_id" - t.integer "concern_village_id" - t.string "concern_street", default: "" - t.string "concern_house", default: "" - t.string "concern_address", default: "" - t.string "concern_address_type", default: "" - t.string "concern_phone", default: "" - t.string "concern_phone_owner", default: "" - t.string "concern_email", default: "" - t.string "concern_email_owner", default: "" - t.string "concern_location", default: "" - t.boolean "concern_same_as_client", default: false - t.string "location_description", default: "" - t.string "phone_counselling_summary", default: "" - t.string "presented_id" - t.string "id_number" - t.string "other_phone_number" - t.string "brsc_branch" - t.string "current_island" - t.string "current_street" - t.string "current_po_box" - t.string "current_city" - t.string "current_settlement" - t.string "current_resident_own_or_rent" - t.string "current_household_type" - t.string "island2" - t.string "street2" - t.string "po_box2" - t.string "city2" - t.string "settlement2" - t.string "resident_own_or_rent2" - t.string "household_type2" - t.string "legacy_brcs_id" - t.boolean "whatsapp", default: false - t.string "global_id" - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - t.boolean "other_phone_whatsapp", default: false - t.string "preferred_language", default: "English" - t.boolean "national_id", default: false, null: false - t.boolean "birth_cert", default: false, null: false - t.boolean "family_book", default: false, null: false - t.boolean "passport", default: false, null: false - t.boolean "travel_doc", default: false, null: false - t.boolean "referral_doc", default: false, null: false - t.boolean "local_consent", default: false, null: false - t.boolean "police_interview", default: false, null: false - t.boolean "other_legal_doc", default: false, null: false - t.string "national_id_files", default: [], array: true - t.string "birth_cert_files", default: [], array: true - t.string "family_book_files", default: [], array: true - t.string "passport_files", default: [], array: true - t.string "travel_doc_files", default: [], array: true - t.string "referral_doc_files", default: [], array: true - t.string "local_consent_files", default: [], array: true - t.string "police_interview_files", default: [], array: true - t.string "other_legal_doc_files", default: [], array: true - t.boolean "referred_external", default: false - t.string "marital_status" - t.string "nationality" - t.string "ethnicity" - t.string "location_of_concern" - t.string "type_of_trafficking" - t.text "education_background" - t.string "department" - t.string "neighbor_name" - t.string "neighbor_phone" - t.string "dosavy_name" - t.string "dosavy_phone" - t.string "chief_commune_name" - t.string "chief_commune_phone" - t.string "chief_village_name" - t.string "chief_village_phone" - t.string "ccwc_name" - t.string "ccwc_phone" - t.string "legal_team_name" - t.string "legal_representative_name" - t.string "legal_team_phone" - t.string "other_agency_name" - t.string "other_representative_name" - t.string "other_agency_phone" - t.string "locality" - t.string "national_id_number" - t.string "passport_number" - t.index ["commune_id"], name: "index_clients_on_commune_id" - t.index ["commune_id"], name: "index_clients_on_commune_id" - t.index ["current_family_id"], name: "index_clients_on_current_family_id" - t.index ["current_family_id"], name: "index_clients_on_current_family_id" - t.index ["district_id"], name: "index_clients_on_district_id" - t.index ["district_id"], name: "index_clients_on_district_id" - t.index ["donor_id"], name: "index_clients_on_donor_id" - t.index ["donor_id"], name: "index_clients_on_donor_id" - t.index ["external_id"], name: "index_clients_on_external_id" - t.index ["external_id"], name: "index_clients_on_external_id" - t.index ["global_id"], name: "index_clients_on_global_id" - t.index ["global_id"], name: "index_clients_on_global_id" - t.index ["mosvy_number"], name: "index_clients_on_mosvy_number" - t.index ["mosvy_number"], name: "index_clients_on_mosvy_number" - t.index ["slug"], name: "index_clients_on_slug", unique: true - t.index ["slug"], name: "index_clients_on_slug", unique: true - t.index ["state_id"], name: "index_clients_on_state_id" - t.index ["state_id"], name: "index_clients_on_state_id" - t.index ["subdistrict_id"], name: "index_clients_on_subdistrict_id" - t.index ["subdistrict_id"], name: "index_clients_on_subdistrict_id" - t.index ["township_id"], name: "index_clients_on_township_id" - t.index ["township_id"], name: "index_clients_on_township_id" - t.index ["village_id"], name: "index_clients_on_village_id" - t.index ["village_id"], name: "index_clients_on_village_id" - end - - create_table "clients_quantitative_cases", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "quantitative_case_id" - t.datetime "created_at" - t.datetime "updated_at" + add_index "global_services", ["uuid"], name: "index_global_services_on_uuid", unique: true, using: :btree + + create_table "government_form_children_plans", force: :cascade do |t| + t.text "goal", default: "" + t.text "action", default: "" + t.text "who", default: "" + t.integer "government_form_id" + t.integer "children_plan_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "score" + t.text "comment", default: "" + t.date "completion_date" end - create_table "clients_quantitative_cases", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "quantitative_case_id" - t.datetime "created_at" - t.datetime "updated_at" + add_index "government_form_children_plans", ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id", using: :btree + add_index "government_form_children_plans", ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id", using: :btree + + create_table "government_form_family_plans", force: :cascade do |t| + t.text "goal", default: "" + t.text "action", default: "" + t.text "result", default: "" + t.integer "government_form_id" + t.integer "family_plan_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "score" + t.text "comment", default: "" + end + + add_index "government_form_family_plans", ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id", using: :btree + add_index "government_form_family_plans", ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id", using: :btree + + create_table "government_form_interviewees", force: :cascade do |t| + t.integer "government_form_id" + t.integer "interviewee_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "government_form_interviewees", ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id", using: :btree + add_index "government_form_interviewees", ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id", using: :btree + + create_table "government_form_needs", force: :cascade do |t| + t.integer "rank" + t.integer "need_id" + t.integer "government_form_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "government_form_needs", ["government_form_id"], name: "index_government_form_needs_on_government_form_id", using: :btree + add_index "government_form_needs", ["need_id"], name: "index_government_form_needs_on_need_id", using: :btree + + create_table "government_form_problems", force: :cascade do |t| + t.integer "rank" + t.integer "problem_id" + t.integer "government_form_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "government_form_problems", ["government_form_id"], name: "index_government_form_problems_on_government_form_id", using: :btree + add_index "government_form_problems", ["problem_id"], name: "index_government_form_problems_on_problem_id", using: :btree + + create_table "government_form_service_types", force: :cascade do |t| + t.integer "government_form_id" + t.integer "service_type_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "government_form_service_types", ["government_form_id"], name: "index_government_form_service_types_on_government_form_id", using: :btree + add_index "government_form_service_types", ["service_type_id"], name: "index_government_form_service_types_on_service_type_id", using: :btree + + create_table "government_forms", force: :cascade do |t| + t.string "name", default: "" + t.date "date" + t.string "client_code", default: "" + t.integer "interview_district_id" + t.integer "interview_province_id" + t.integer "case_worker_id" + t.string "case_worker_phone", default: "" + t.integer "client_id" + t.string "primary_carer_relationship", default: "" + t.string "primary_carer_house", default: "" + t.string "primary_carer_street", default: "" + t.integer "primary_carer_district_id" + t.integer "primary_carer_province_id" + t.text "source_info", default: "" + t.text "summary_info_of_referral", default: "" + t.text "guardian_comment", default: "" + t.text "case_worker_comment", default: "" + t.string "other_interviewee", default: "" + t.string "other_client_type", default: "" + t.string "other_need", default: "" + t.string "other_problem", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.string "caseworker_assumption", default: "" + t.text "assumption_description", default: "" + t.date "assumption_date" + t.string "contact_type", default: "" + t.string "client_decision", default: "" + t.string "other_service_type", default: "" + t.date "gov_placement_date" + t.string "care_type", default: "" + t.string "primary_carer", default: "" + t.string "secondary_carer", default: "" + t.string "carer_contact_info", default: "" + t.integer "assessment_province_id" + t.integer "assessment_district_id" + t.string "new_carer", default: "" + t.string "new_carer_gender", default: "" + t.date "new_carer_date_of_birth" + t.string "new_carer_relationship", default: "" + t.integer "interview_commune_id" + t.integer "interview_village_id" + t.integer "assessment_commune_id" + t.integer "primary_carer_commune_id" + t.integer "primary_carer_village_id" + t.text "recent_issues_and_progress", default: "" + t.string "other_case_closure" + t.text "brief_case_history" + t.integer "case_closure_id" + end + + add_index "government_forms", ["client_id"], name: "index_government_forms_on_client_id", using: :btree + add_index "government_forms", ["commune_id"], name: "index_government_forms_on_commune_id", using: :btree + add_index "government_forms", ["district_id"], name: "index_government_forms_on_district_id", using: :btree + add_index "government_forms", ["province_id"], name: "index_government_forms_on_province_id", using: :btree + add_index "government_forms", ["village_id"], name: "index_government_forms_on_village_id", using: :btree + + create_table "government_reports", force: :cascade do |t| + t.string "code", default: "" + t.string "initial_capital", default: "" + t.string "initial_city", default: "" + t.string "initial_commune", default: "" + t.date "initial_date" + t.string "client_code", default: "" + t.string "commune", default: "" + t.string "city", default: "" + t.string "capital", default: "" + t.string "organisation_name", default: "" + t.string "organisation_phone_number", default: "" + t.string "client_name", default: "" + t.date "client_date_of_birth" + t.string "client_gender", default: "" + t.string "found_client_at", default: "" + t.string "found_client_village", default: "" + t.string "education", default: "" + t.string "carer_name", default: "" + t.string "client_contact", default: "" + t.string "carer_house_number", default: "" + t.string "carer_street_number", default: "" + t.string "carer_village", default: "" + t.string "carer_commune", default: "" + t.string "carer_city", default: "" + t.string "carer_capital", default: "" + t.string "carer_phone_number", default: "" + t.date "case_information_date" + t.string "referral_name", default: "" + t.string "referral_position", default: "" + t.boolean "anonymous", default: false + t.text "anonymous_description", default: "" + t.boolean "client_living_with_guardian", default: false + t.text "present_physical_health", default: "" + t.text "physical_health_need", default: "" + t.text "physical_health_plan", default: "" + t.text "present_supplies", default: "" + t.text "supplies_need", default: "" + t.text "supplies_plan", default: "" + t.text "present_education", default: "" + t.text "education_need", default: "" + t.text "education_plan", default: "" + t.text "present_family_communication", default: "" + t.text "family_communication_need", default: "" + t.text "family_communication_plan", default: "" + t.text "present_society_communication", default: "" + t.text "society_communication_need", default: "" + t.text "society_communication_plan", default: "" + t.text "present_emotional_health", default: "" + t.text "emotional_health_need", default: "" + t.text "emotional_health_plan", default: "" + t.boolean "mission_obtainable", default: false + t.boolean "first_mission", default: false + t.boolean "second_mission", default: false + t.boolean "third_mission", default: false + t.boolean "fourth_mission", default: false + t.date "done_date" + t.date "agreed_date" + t.integer "client_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "hotlines", force: :cascade do |t| + t.integer "client_id" + t.integer "call_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "hotlines", ["call_id"], name: "index_hotlines_on_call_id", using: :btree + add_index "hotlines", ["client_id"], name: "index_hotlines_on_client_id", using: :btree + + create_table "interventions", force: :cascade do |t| + t.string "action", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "interviewees", force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "leave_programs", force: :cascade do |t| + t.jsonb "properties", default: {} + t.integer "client_enrollment_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "program_stream_id" + t.date "exit_date" + t.datetime "deleted_at" + t.integer "enrollment_id" end - create_table "communes", id: :serial, force: :cascade do |t| - t.string "code", default: "" - t.string "name_kh", default: "" - t.string "name_en", default: "" - t.integer "district_id" + add_index "leave_programs", ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id", using: :btree + add_index "leave_programs", ["deleted_at"], name: "index_leave_programs_on_deleted_at", using: :btree + add_index "leave_programs", ["enrollment_id"], name: "index_leave_programs_on_enrollment_id", using: :btree + + create_table "locations", force: :cascade do |t| + t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" - t.string "district_type" - t.index ["district_id"], name: "index_communes_on_district_id" - t.index ["district_id"], name: "index_communes_on_district_id" + t.integer "order_option", default: 0 end - create_table "communes", id: :serial, force: :cascade do |t| - t.string "code", default: "" - t.string "name_kh", default: "" - t.string "name_en", default: "" - t.integer "district_id" + create_table "materials", force: :cascade do |t| + t.string "status", default: "" t.datetime "created_at" t.datetime "updated_at" - t.string "district_type" - t.index ["district_id"], name: "index_communes_on_district_id" - t.index ["district_id"], name: "index_communes_on_district_id" end - create_table "custom_assessment_settings", id: :serial, force: :cascade do |t| - t.string "custom_assessment_name", default: "Custom Assessment" - t.integer "max_custom_assessment", default: 6 - t.string "custom_assessment_frequency", default: "month" - t.integer "custom_age", default: 18 - t.integer "setting_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "enable_custom_assessment", default: false + create_table "meta_fields", force: :cascade do |t| + t.string "field_name" + t.string "field_type" + t.boolean "hidden", default: true + t.boolean "required", default: false + t.string "label" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "custom_assessment_settings", id: :serial, force: :cascade do |t| - t.string "custom_assessment_name", default: "Custom Assessment" - t.integer "max_custom_assessment", default: 6 - t.string "custom_assessment_frequency", default: "month" - t.integer "custom_age", default: 18 - t.integer "setting_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "enable_custom_assessment", default: false + create_table "necessities", force: :cascade do |t| + t.string "content", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "custom_field_permissions", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "custom_field_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id" - t.index ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id" - t.index ["user_id"], name: "index_custom_field_permissions_on_user_id" - t.index ["user_id"], name: "index_custom_field_permissions_on_user_id" + create_table "needs", force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at" + t.datetime "updated_at" end - create_table "custom_field_permissions", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "custom_field_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id" - t.index ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id" - t.index ["user_id"], name: "index_custom_field_permissions_on_user_id" - t.index ["user_id"], name: "index_custom_field_permissions_on_user_id" + create_table "oauth_access_grants", force: :cascade do |t| + t.integer "resource_owner_id", null: false + t.integer "application_id", null: false + t.string "token", null: false + t.integer "expires_in", null: false + t.text "redirect_uri", null: false + t.datetime "created_at", null: false + t.datetime "revoked_at" + t.string "scopes" end - create_table "custom_field_properties", id: :serial, force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "custom_formable_type" - t.integer "custom_formable_id" - t.integer "custom_field_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.jsonb "attachments" - t.integer "user_id" - t.index ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id" - t.index ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id" + add_index "oauth_access_grants", ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree + + create_table "oauth_access_tokens", force: :cascade do |t| + t.integer "resource_owner_id" + t.integer "application_id" + t.string "token", null: false + t.string "refresh_token" + t.integer "expires_in" + t.datetime "revoked_at" + t.datetime "created_at", null: false + t.string "scopes" + t.string "previous_refresh_token", default: "", null: false end - create_table "custom_field_properties", id: :serial, force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "custom_formable_type" - t.integer "custom_formable_id" - t.integer "custom_field_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.jsonb "attachments" - t.integer "user_id" - t.index ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id" - t.index ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id" + add_index "oauth_access_tokens", ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree + add_index "oauth_access_tokens", ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree + add_index "oauth_access_tokens", ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree + + create_table "oauth_applications", force: :cascade do |t| + t.string "name", null: false + t.string "uid", null: false + t.string "secret", null: false + t.text "redirect_uri", null: false + t.string "scopes", default: "", null: false + t.boolean "confidential", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "custom_fields", id: :serial, force: :cascade do |t| - t.string "entity_type", default: "" - t.text "properties", default: "" + add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree + + create_table "organization_types", force: :cascade do |t| + t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.string "form_title", default: "" - t.string "frequency", default: "" - t.integer "time_of_frequency", default: 0 - t.string "ngo_name", default: "" - t.jsonb "fields" end - create_table "custom_fields", id: :serial, force: :cascade do |t| - t.string "entity_type", default: "" - t.text "properties", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "form_title", default: "" - t.string "frequency", default: "" - t.integer "time_of_frequency", default: 0 - t.string "ngo_name", default: "" - t.jsonb "fields" + create_table "organizations", force: :cascade do |t| + t.string "full_name" + t.string "short_name" + t.string "logo" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "fcf_ngo", default: false + t.string "country", default: "" + t.boolean "aht", default: false + t.boolean "integrated", default: false + t.string "supported_languages", default: ["km", "en", "my"], array: true + t.integer "clients_count", default: 0 + t.integer "active_client", default: 0 + t.integer "accepted_client", default: 0 + t.boolean "demo", default: false + t.string "referral_source_category_name" end - create_table "departments", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" + create_table "partners", force: :cascade do |t| + t.string "name", default: "" + t.string "address", default: "" + t.date "start_date" + t.string "contact_person_name", default: "" + t.string "contact_person_email", default: "" + t.string "contact_person_mobile", default: "" + t.string "archive_organization_type", default: "" + t.string "affiliation", default: "" + t.string "engagement", default: "" + t.text "background", default: "" + t.integer "province_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "users_count", default: 0 + t.integer "cases_count", default: 0 + t.integer "organization_type_id" end - create_table "departments", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "users_count", default: 0 + add_index "partners", ["organization_type_id"], name: "index_partners_on_organization_type_id", using: :btree + + create_table "permissions", force: :cascade do |t| + t.integer "user_id" + t.boolean "case_notes_readable", default: true + t.boolean "case_notes_editable", default: true + t.boolean "assessments_editable", default: true + t.boolean "assessments_readable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "districts", id: :serial, force: :cascade do |t| - t.string "name" - t.integer "province_id" - t.string "code", default: "" + add_index "permissions", ["user_id"], name: "index_permissions_on_user_id", using: :btree + + create_table "problems", force: :cascade do |t| + t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" - t.index ["province_id"], name: "index_districts_on_province_id" - t.index ["province_id"], name: "index_districts_on_province_id" end - create_table "districts", id: :serial, force: :cascade do |t| - t.string "name" - t.integer "province_id" - t.string "code", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["province_id"], name: "index_districts_on_province_id" - t.index ["province_id"], name: "index_districts_on_province_id" + create_table "program_stream_permissions", force: :cascade do |t| + t.integer "user_id" + t.integer "program_stream_id" + t.boolean "readable", default: true + t.boolean "editable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.datetime "deleted_at" end - create_table "domain_groups", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "domains_count", default: 0 - end - - create_table "domain_groups", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "domains_count", default: 0 - end - - create_table "domain_program_streams", id: :serial, force: :cascade do |t| - t.integer "program_stream_id" - t.integer "domain_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "deleted_at" - t.index ["deleted_at"], name: "index_domain_program_streams_on_deleted_at" - t.index ["deleted_at"], name: "index_domain_program_streams_on_deleted_at" - end - - create_table "domain_program_streams", id: :serial, force: :cascade do |t| - t.integer "program_stream_id" - t.integer "domain_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "deleted_at" - t.index ["deleted_at"], name: "index_domain_program_streams_on_deleted_at" - t.index ["deleted_at"], name: "index_domain_program_streams_on_deleted_at" - end - - create_table "domains", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.string "identity", default: "" - t.text "description", default: "" - t.integer "domain_group_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "tasks_count", default: 0 - t.string "score_1_color", default: "danger" - t.string "score_2_color", default: "warning" - t.string "score_3_color", default: "info" - t.string "score_4_color", default: "primary" - t.text "score_1_definition", default: "" - t.text "score_2_definition", default: "" - t.text "score_3_definition", default: "" - t.text "score_4_definition", default: "" - t.boolean "custom_domain", default: false - t.text "local_description", default: "" - t.text "score_1_local_definition", default: "" - t.text "score_2_local_definition", default: "" - t.text "score_3_local_definition", default: "" - t.text "score_4_local_definition", default: "" - t.integer "custom_assessment_setting_id" - t.index ["domain_group_id"], name: "index_domains_on_domain_group_id" - t.index ["domain_group_id"], name: "index_domains_on_domain_group_id" - end - - create_table "domains", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.string "identity", default: "" - t.text "description", default: "" - t.integer "domain_group_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "tasks_count", default: 0 - t.string "score_1_color", default: "danger" - t.string "score_2_color", default: "warning" - t.string "score_3_color", default: "info" - t.string "score_4_color", default: "primary" - t.text "score_1_definition", default: "" - t.text "score_2_definition", default: "" - t.text "score_3_definition", default: "" - t.text "score_4_definition", default: "" - t.boolean "custom_domain", default: false - t.text "local_description", default: "" - t.text "score_1_local_definition", default: "" - t.text "score_2_local_definition", default: "" - t.text "score_3_local_definition", default: "" - t.text "score_4_local_definition", default: "" - t.integer "custom_assessment_setting_id" - t.index ["domain_group_id"], name: "index_domains_on_domain_group_id" - t.index ["domain_group_id"], name: "index_domains_on_domain_group_id" - end - - create_table "donor_organizations", id: :integer, default: nil, force: :cascade do |t| - t.integer "donor_id" - t.integer "organization_id" - t.index ["donor_id"], name: "index_donor_organizations_on_donor_id" - t.index ["donor_id"], name: "index_donor_organizations_on_donor_id" - t.index ["organization_id"], name: "index_donor_organizations_on_organization_id" - t.index ["organization_id"], name: "index_donor_organizations_on_organization_id" - end - - create_table "donor_organizations", id: :integer, default: nil, force: :cascade do |t| - t.integer "donor_id" - t.integer "organization_id" - t.index ["donor_id"], name: "index_donor_organizations_on_donor_id" - t.index ["donor_id"], name: "index_donor_organizations_on_donor_id" - t.index ["organization_id"], name: "index_donor_organizations_on_organization_id" - t.index ["organization_id"], name: "index_donor_organizations_on_organization_id" - end - - create_table "donors", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "code", default: "" - t.string "global_id", limit: 32, default: "" - t.index ["global_id"], name: "index_donors_on_global_id" - t.index ["global_id"], name: "index_donors_on_global_id" - end - - create_table "donors", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "code", default: "" - t.string "global_id", limit: 32, default: "" - t.index ["global_id"], name: "index_donors_on_global_id" - t.index ["global_id"], name: "index_donors_on_global_id" - end - - create_table "enrollment_trackings", id: :serial, force: :cascade do |t| - t.integer "enrollment_id" - t.integer "tracking_id" - t.jsonb "properties", default: {} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id" - t.index ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id" - t.index ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id" - t.index ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id" - end - - create_table "enrollment_trackings", id: :serial, force: :cascade do |t| - t.integer "enrollment_id" - t.integer "tracking_id" - t.jsonb "properties", default: {} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id" - t.index ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id" - t.index ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id" - t.index ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id" - end - - create_table "enrollments", id: :serial, force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "status", default: "Active" - t.date "enrollment_date" - t.datetime "deleted_at" - t.string "programmable_type" - t.integer "programmable_id" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["deleted_at"], name: "index_enrollments_on_deleted_at" - t.index ["deleted_at"], name: "index_enrollments_on_deleted_at" - t.index ["program_stream_id"], name: "index_enrollments_on_program_stream_id" - t.index ["program_stream_id"], name: "index_enrollments_on_program_stream_id" - end - - create_table "enrollments", id: :serial, force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "status", default: "Active" - t.date "enrollment_date" - t.datetime "deleted_at" - t.string "programmable_type" - t.integer "programmable_id" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["deleted_at"], name: "index_enrollments_on_deleted_at" - t.index ["deleted_at"], name: "index_enrollments_on_deleted_at" - t.index ["program_stream_id"], name: "index_enrollments_on_program_stream_id" - t.index ["program_stream_id"], name: "index_enrollments_on_program_stream_id" - end - - create_table "enter_ngo_users", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "enter_ngo_id" - t.index ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id" - t.index ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id" - t.index ["user_id"], name: "index_enter_ngo_users_on_user_id" - t.index ["user_id"], name: "index_enter_ngo_users_on_user_id" - end - - create_table "enter_ngo_users", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "enter_ngo_id" - t.index ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id" - t.index ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id" - t.index ["user_id"], name: "index_enter_ngo_users_on_user_id" - t.index ["user_id"], name: "index_enter_ngo_users_on_user_id" - end - - create_table "enter_ngos", id: :serial, force: :cascade do |t| - t.date "accepted_date" - t.integer "client_id" - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "deleted_at" - t.index ["client_id"], name: "index_enter_ngos_on_client_id" - t.index ["client_id"], name: "index_enter_ngos_on_client_id" - t.index ["deleted_at"], name: "index_enter_ngos_on_deleted_at" - t.index ["deleted_at"], name: "index_enter_ngos_on_deleted_at" - end - - create_table "enter_ngos", id: :serial, force: :cascade do |t| - t.date "accepted_date" - t.integer "client_id" - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "deleted_at" - t.index ["client_id"], name: "index_enter_ngos_on_client_id" - t.index ["client_id"], name: "index_enter_ngos_on_client_id" - t.index ["deleted_at"], name: "index_enter_ngos_on_deleted_at" - t.index ["deleted_at"], name: "index_enter_ngos_on_deleted_at" - end - - create_table "exit_ngos", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.string "exit_circumstance", default: "" - t.string "other_info_of_exit", default: "" - t.string "exit_reasons", default: [], array: true - t.text "exit_note", default: "" - t.date "exit_date" - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "deleted_at" - t.index ["client_id"], name: "index_exit_ngos_on_client_id" - t.index ["client_id"], name: "index_exit_ngos_on_client_id" - t.index ["deleted_at"], name: "index_exit_ngos_on_deleted_at" - t.index ["deleted_at"], name: "index_exit_ngos_on_deleted_at" - end - - create_table "exit_ngos", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.string "exit_circumstance", default: "" - t.string "other_info_of_exit", default: "" - t.string "exit_reasons", default: [], array: true - t.text "exit_note", default: "" - t.date "exit_date" - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "deleted_at" - t.index ["client_id"], name: "index_exit_ngos_on_client_id" - t.index ["client_id"], name: "index_exit_ngos_on_client_id" - t.index ["deleted_at"], name: "index_exit_ngos_on_deleted_at" - t.index ["deleted_at"], name: "index_exit_ngos_on_deleted_at" - end - - create_table "external_system_global_identities", id: :integer, default: nil, force: :cascade do |t| - t.integer "external_system_id" - t.string "global_id" - t.string "external_id" - t.string "client_slug" - t.string "organization_name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id" - t.index ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id" - t.index ["global_id"], name: "index_external_system_global_identities_on_global_id" - t.index ["global_id"], name: "index_external_system_global_identities_on_global_id" - end - - create_table "external_system_global_identities", id: :integer, default: nil, force: :cascade do |t| - t.integer "external_system_id" - t.string "global_id" - t.string "external_id" - t.string "client_slug" - t.string "organization_name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id" - t.index ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id" - t.index ["global_id"], name: "index_external_system_global_identities_on_global_id" - t.index ["global_id"], name: "index_external_system_global_identities_on_global_id" - end - - create_table "external_systems", id: :integer, default: nil, force: :cascade do |t| - t.string "name" - t.string "url" - t.string "token" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "external_systems", id: :integer, default: nil, force: :cascade do |t| - t.string "name" - t.string "url" - t.string "token" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "families", id: :serial, force: :cascade do |t| - t.string "code" - t.string "name", default: "" - t.string "address", default: "" - t.text "caregiver_information", default: "" - t.integer "significant_family_member_count", default: 1 - t.float "household_income", default: 0.0 - t.boolean "dependable_income", default: false - t.integer "female_children_count", default: 0 - t.integer "male_children_count", default: 0 - t.integer "female_adult_count", default: 0 - t.integer "male_adult_count", default: 0 - t.string "family_type", default: "kinship" - t.date "contract_date" - t.integer "province_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.string "case_history", default: "" - t.integer "children", default: [], array: true - t.string "status", default: "" - t.integer "district_id" - t.string "old_commune", default: "" - t.string "old_village", default: "" - t.string "house", default: "" - t.string "street", default: "" - t.integer "commune_id" - t.integer "village_id" - t.integer "user_id" - t.datetime "deleted_at" - t.string "slug", default: "" - t.index ["commune_id"], name: "index_families_on_commune_id" - t.index ["commune_id"], name: "index_families_on_commune_id" - t.index ["deleted_at"], name: "index_families_on_deleted_at" - t.index ["deleted_at"], name: "index_families_on_deleted_at" - t.index ["district_id"], name: "index_families_on_district_id" - t.index ["district_id"], name: "index_families_on_district_id" - t.index ["user_id"], name: "index_families_on_user_id" - t.index ["user_id"], name: "index_families_on_user_id" - t.index ["village_id"], name: "index_families_on_village_id" - t.index ["village_id"], name: "index_families_on_village_id" - end - - create_table "families", id: :serial, force: :cascade do |t| - t.string "code" - t.string "name", default: "" - t.string "address", default: "" - t.text "caregiver_information", default: "" - t.integer "significant_family_member_count", default: 1 - t.float "household_income", default: 0.0 - t.boolean "dependable_income", default: false - t.integer "female_children_count", default: 0 - t.integer "male_children_count", default: 0 - t.integer "female_adult_count", default: 0 - t.integer "male_adult_count", default: 0 - t.string "family_type", default: "kinship" - t.date "contract_date" - t.integer "province_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.string "case_history", default: "" - t.integer "children", default: [], array: true - t.string "status", default: "" - t.integer "district_id" - t.string "old_commune", default: "" - t.string "old_village", default: "" - t.string "house", default: "" - t.string "street", default: "" - t.integer "commune_id" - t.integer "village_id" - t.integer "user_id" - t.datetime "deleted_at" - t.string "slug", default: "" - t.index ["commune_id"], name: "index_families_on_commune_id" - t.index ["commune_id"], name: "index_families_on_commune_id" - t.index ["deleted_at"], name: "index_families_on_deleted_at" - t.index ["deleted_at"], name: "index_families_on_deleted_at" - t.index ["district_id"], name: "index_families_on_district_id" - t.index ["district_id"], name: "index_families_on_district_id" - t.index ["user_id"], name: "index_families_on_user_id" - t.index ["user_id"], name: "index_families_on_user_id" - t.index ["village_id"], name: "index_families_on_village_id" - t.index ["village_id"], name: "index_families_on_village_id" - end - - create_table "family_members", id: :serial, force: :cascade do |t| - t.string "adult_name", default: "" - t.date "date_of_birth" - t.string "occupation", default: "" - t.string "relation", default: "" - t.integer "family_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "guardian", default: false - t.string "gender" - t.text "note" - t.index ["family_id"], name: "index_family_members_on_family_id" - t.index ["family_id"], name: "index_family_members_on_family_id" - end - - create_table "family_members", id: :serial, force: :cascade do |t| - t.string "adult_name", default: "" - t.date "date_of_birth" - t.string "occupation", default: "" - t.string "relation", default: "" - t.integer "family_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "guardian", default: false - t.string "gender" - t.text "note" - t.index ["family_id"], name: "index_family_members_on_family_id" - t.index ["family_id"], name: "index_family_members_on_family_id" - end - - create_table "family_plans", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "priority" - end - - create_table "family_plans", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "priority" - end - - create_table "family_referrals", id: :serial, force: :cascade do |t| - t.string "slug", default: "" - t.date "date_of_referral" - t.string "referred_to", default: "" - t.string "referred_from", default: "" - t.text "referral_reason", default: "" - t.string "name_of_referee", default: "" - t.string "referral_phone", default: "" - t.string "name_of_family", default: "" - t.string "ngo_name", default: "" - t.integer "referee_id" - t.boolean "saved", default: false - t.string "consent_form", default: [], array: true - t.integer "family_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["family_id"], name: "index_family_referrals_on_family_id" - t.index ["family_id"], name: "index_family_referrals_on_family_id" - end - - create_table "family_referrals", id: :serial, force: :cascade do |t| - t.string "slug", default: "" - t.date "date_of_referral" - t.string "referred_to", default: "" - t.string "referred_from", default: "" - t.text "referral_reason", default: "" - t.string "name_of_referee", default: "" - t.string "referral_phone", default: "" - t.string "name_of_family", default: "" - t.string "ngo_name", default: "" - t.integer "referee_id" - t.boolean "saved", default: false - t.string "consent_form", default: [], array: true - t.integer "family_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["family_id"], name: "index_family_referrals_on_family_id" - t.index ["family_id"], name: "index_family_referrals_on_family_id" - end - - create_table "field_setting_translations", id: :serial, force: :cascade do |t| - t.integer "field_setting_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "label" - t.index ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id" - t.index ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id" - t.index ["locale"], name: "index_field_setting_translations_on_locale" - t.index ["locale"], name: "index_field_setting_translations_on_locale" - end - - create_table "field_setting_translations", id: :serial, force: :cascade do |t| - t.integer "field_setting_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "label" - t.index ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id" - t.index ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id" - t.index ["locale"], name: "index_field_setting_translations_on_locale" - t.index ["locale"], name: "index_field_setting_translations_on_locale" - end - - create_table "field_settings", id: :serial, force: :cascade do |t| - t.string "name", null: false - t.string "group", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "type", default: "field", null: false - t.boolean "visible", default: true, null: false - t.string "current_label" - t.boolean "required", default: false - t.string "klass_name" - t.string "for_instances" - t.boolean "label_only", default: false - end - - create_table "field_settings", id: :serial, force: :cascade do |t| - t.string "name", null: false - t.string "group", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "type", default: "field", null: false - t.boolean "visible", default: true, null: false - t.string "current_label" - t.boolean "required", default: false - t.string "klass_name" - t.string "for_instances" - t.boolean "label_only", default: false - end - - create_table "form_builder_attachments", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.jsonb "file", default: [] - t.string "form_buildable_type" - t.integer "form_buildable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "form_builder_attachments", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.jsonb "file", default: [] - t.string "form_buildable_type" - t.integer "form_buildable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "friendly_id_slugs", id: :serial, force: :cascade do |t| - t.string "slug", null: false - t.integer "sluggable_id", null: false - t.string "sluggable_type", limit: 50 - t.string "scope" - t.datetime "created_at" - t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true - t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true - t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" - t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" - t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" - t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" - t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" - t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" - end - - create_table "friendly_id_slugs", id: :serial, force: :cascade do |t| - t.string "slug", null: false - t.integer "sluggable_id", null: false - t.string "sluggable_type", limit: 50 - t.string "scope" - t.datetime "created_at" - t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true - t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true - t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" - t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" - t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" - t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" - t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" - t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" - end - - create_table "global_identities", id: false, force: :cascade do |t| - t.string "ulid" - t.index ["ulid"], name: "index_global_identities_on_ulid", unique: true - t.index ["ulid"], name: "index_global_identities_on_ulid", unique: true - end - - create_table "global_identities", id: false, force: :cascade do |t| - t.string "ulid" - t.index ["ulid"], name: "index_global_identities_on_ulid", unique: true - t.index ["ulid"], name: "index_global_identities_on_ulid", unique: true - end - - create_table "global_identity_organizations", id: :integer, default: nil, force: :cascade do |t| - t.string "global_id" - t.integer "organization_id" - t.integer "client_id" - t.index ["client_id"], name: "index_global_identity_organizations_on_client_id" - t.index ["client_id"], name: "index_global_identity_organizations_on_client_id" - t.index ["global_id"], name: "index_global_identity_organizations_on_global_id" - t.index ["global_id"], name: "index_global_identity_organizations_on_global_id" - t.index ["organization_id"], name: "index_global_identity_organizations_on_organization_id" - t.index ["organization_id"], name: "index_global_identity_organizations_on_organization_id" - end - - create_table "global_identity_organizations", id: :integer, default: nil, force: :cascade do |t| - t.string "global_id" - t.integer "organization_id" - t.integer "client_id" - t.index ["client_id"], name: "index_global_identity_organizations_on_client_id" - t.index ["client_id"], name: "index_global_identity_organizations_on_client_id" - t.index ["global_id"], name: "index_global_identity_organizations_on_global_id" - t.index ["global_id"], name: "index_global_identity_organizations_on_global_id" - t.index ["organization_id"], name: "index_global_identity_organizations_on_organization_id" - t.index ["organization_id"], name: "index_global_identity_organizations_on_organization_id" - end - - create_table "global_identity_tmp", id: :integer, default: nil, force: :cascade do |t| - t.binary "ulid" - t.string "ngo_name" - t.integer "client_id" - end - - create_table "global_identity_tmp", id: :integer, default: nil, force: :cascade do |t| - t.binary "ulid" - t.string "ngo_name" - t.integer "client_id" - end - - create_table "global_services", id: false, force: :cascade do |t| - t.uuid "uuid" - t.index ["uuid"], name: "index_global_services_on_uuid", unique: true - t.index ["uuid"], name: "index_global_services_on_uuid", unique: true - end - - create_table "global_services", id: false, force: :cascade do |t| - t.uuid "uuid" - t.index ["uuid"], name: "index_global_services_on_uuid", unique: true - t.index ["uuid"], name: "index_global_services_on_uuid", unique: true - end - - create_table "government_form_children_plans", id: :serial, force: :cascade do |t| - t.text "goal", default: "" - t.text "action", default: "" - t.text "who", default: "" - t.integer "government_form_id" - t.integer "children_plan_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "score" - t.text "comment", default: "" - t.date "completion_date" - t.index ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id" - t.index ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id" - t.index ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id" - end - - create_table "government_form_children_plans", id: :serial, force: :cascade do |t| - t.text "goal", default: "" - t.text "action", default: "" - t.text "who", default: "" - t.integer "government_form_id" - t.integer "children_plan_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "score" - t.text "comment", default: "" - t.date "completion_date" - t.index ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id" - t.index ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id" - t.index ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id" - end - - create_table "government_form_family_plans", id: :serial, force: :cascade do |t| - t.text "goal", default: "" - t.text "action", default: "" - t.text "result", default: "" - t.integer "government_form_id" - t.integer "family_plan_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "score" - t.text "comment", default: "" - t.index ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id" - t.index ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id" - t.index ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id" - end - - create_table "government_form_family_plans", id: :serial, force: :cascade do |t| - t.text "goal", default: "" - t.text "action", default: "" - t.text "result", default: "" - t.integer "government_form_id" - t.integer "family_plan_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "score" - t.text "comment", default: "" - t.index ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id" - t.index ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id" - t.index ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id" - end - - create_table "government_form_interviewees", id: :serial, force: :cascade do |t| - t.integer "government_form_id" - t.integer "interviewee_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id" - t.index ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id" - t.index ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id" - end - - create_table "government_form_interviewees", id: :serial, force: :cascade do |t| - t.integer "government_form_id" - t.integer "interviewee_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id" - t.index ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id" - t.index ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id" - end - - create_table "government_form_needs", id: :serial, force: :cascade do |t| - t.integer "rank" - t.integer "need_id" - t.integer "government_form_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["government_form_id"], name: "index_government_form_needs_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_needs_on_government_form_id" - t.index ["need_id"], name: "index_government_form_needs_on_need_id" - t.index ["need_id"], name: "index_government_form_needs_on_need_id" - end - - create_table "government_form_needs", id: :serial, force: :cascade do |t| - t.integer "rank" - t.integer "need_id" - t.integer "government_form_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["government_form_id"], name: "index_government_form_needs_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_needs_on_government_form_id" - t.index ["need_id"], name: "index_government_form_needs_on_need_id" - t.index ["need_id"], name: "index_government_form_needs_on_need_id" - end - - create_table "government_form_problems", id: :serial, force: :cascade do |t| - t.integer "rank" - t.integer "problem_id" - t.integer "government_form_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["government_form_id"], name: "index_government_form_problems_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_problems_on_government_form_id" - t.index ["problem_id"], name: "index_government_form_problems_on_problem_id" - t.index ["problem_id"], name: "index_government_form_problems_on_problem_id" - end - - create_table "government_form_problems", id: :serial, force: :cascade do |t| - t.integer "rank" - t.integer "problem_id" - t.integer "government_form_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["government_form_id"], name: "index_government_form_problems_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_problems_on_government_form_id" - t.index ["problem_id"], name: "index_government_form_problems_on_problem_id" - t.index ["problem_id"], name: "index_government_form_problems_on_problem_id" - end - - create_table "government_form_service_types", id: :serial, force: :cascade do |t| - t.integer "government_form_id" - t.integer "service_type_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["government_form_id"], name: "index_government_form_service_types_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_service_types_on_government_form_id" - t.index ["service_type_id"], name: "index_government_form_service_types_on_service_type_id" - t.index ["service_type_id"], name: "index_government_form_service_types_on_service_type_id" - end - - create_table "government_form_service_types", id: :serial, force: :cascade do |t| - t.integer "government_form_id" - t.integer "service_type_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["government_form_id"], name: "index_government_form_service_types_on_government_form_id" - t.index ["government_form_id"], name: "index_government_form_service_types_on_government_form_id" - t.index ["service_type_id"], name: "index_government_form_service_types_on_service_type_id" - t.index ["service_type_id"], name: "index_government_form_service_types_on_service_type_id" - end - - create_table "government_forms", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.date "date" - t.string "client_code", default: "" - t.integer "interview_district_id" - t.integer "interview_province_id" - t.integer "case_worker_id" - t.string "case_worker_phone", default: "" - t.integer "client_id" - t.string "primary_carer_relationship", default: "" - t.string "primary_carer_house", default: "" - t.string "primary_carer_street", default: "" - t.integer "primary_carer_district_id" - t.integer "primary_carer_province_id" - t.text "source_info", default: "" - t.text "summary_info_of_referral", default: "" - t.text "guardian_comment", default: "" - t.text "case_worker_comment", default: "" - t.string "other_interviewee", default: "" - t.string "other_client_type", default: "" - t.string "other_need", default: "" - t.string "other_problem", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.string "caseworker_assumption", default: "" - t.text "assumption_description", default: "" - t.date "assumption_date" - t.string "contact_type", default: "" - t.string "client_decision", default: "" - t.string "other_service_type", default: "" - t.date "gov_placement_date" - t.string "care_type", default: "" - t.string "primary_carer", default: "" - t.string "secondary_carer", default: "" - t.string "carer_contact_info", default: "" - t.integer "assessment_province_id" - t.integer "assessment_district_id" - t.string "new_carer", default: "" - t.string "new_carer_gender", default: "" - t.date "new_carer_date_of_birth" - t.string "new_carer_relationship", default: "" - t.integer "interview_commune_id" - t.integer "interview_village_id" - t.integer "assessment_commune_id" - t.integer "primary_carer_commune_id" - t.integer "primary_carer_village_id" - t.text "recent_issues_and_progress", default: "" - t.string "other_case_closure" - t.text "brief_case_history" - t.integer "case_closure_id" - t.index ["client_id"], name: "index_government_forms_on_client_id" - t.index ["client_id"], name: "index_government_forms_on_client_id" - t.index ["commune_id"], name: "index_government_forms_on_commune_id" - t.index ["commune_id"], name: "index_government_forms_on_commune_id" - t.index ["district_id"], name: "index_government_forms_on_district_id" - t.index ["district_id"], name: "index_government_forms_on_district_id" - t.index ["province_id"], name: "index_government_forms_on_province_id" - t.index ["province_id"], name: "index_government_forms_on_province_id" - t.index ["village_id"], name: "index_government_forms_on_village_id" - t.index ["village_id"], name: "index_government_forms_on_village_id" - end - - create_table "government_forms", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.date "date" - t.string "client_code", default: "" - t.integer "interview_district_id" - t.integer "interview_province_id" - t.integer "case_worker_id" - t.string "case_worker_phone", default: "" - t.integer "client_id" - t.string "primary_carer_relationship", default: "" - t.string "primary_carer_house", default: "" - t.string "primary_carer_street", default: "" - t.integer "primary_carer_district_id" - t.integer "primary_carer_province_id" - t.text "source_info", default: "" - t.text "summary_info_of_referral", default: "" - t.text "guardian_comment", default: "" - t.text "case_worker_comment", default: "" - t.string "other_interviewee", default: "" - t.string "other_client_type", default: "" - t.string "other_need", default: "" - t.string "other_problem", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.string "caseworker_assumption", default: "" - t.text "assumption_description", default: "" - t.date "assumption_date" - t.string "contact_type", default: "" - t.string "client_decision", default: "" - t.string "other_service_type", default: "" - t.date "gov_placement_date" - t.string "care_type", default: "" - t.string "primary_carer", default: "" - t.string "secondary_carer", default: "" - t.string "carer_contact_info", default: "" - t.integer "assessment_province_id" - t.integer "assessment_district_id" - t.string "new_carer", default: "" - t.string "new_carer_gender", default: "" - t.date "new_carer_date_of_birth" - t.string "new_carer_relationship", default: "" - t.integer "interview_commune_id" - t.integer "interview_village_id" - t.integer "assessment_commune_id" - t.integer "primary_carer_commune_id" - t.integer "primary_carer_village_id" - t.text "recent_issues_and_progress", default: "" - t.string "other_case_closure" - t.text "brief_case_history" - t.integer "case_closure_id" - t.index ["client_id"], name: "index_government_forms_on_client_id" - t.index ["client_id"], name: "index_government_forms_on_client_id" - t.index ["commune_id"], name: "index_government_forms_on_commune_id" - t.index ["commune_id"], name: "index_government_forms_on_commune_id" - t.index ["district_id"], name: "index_government_forms_on_district_id" - t.index ["district_id"], name: "index_government_forms_on_district_id" - t.index ["province_id"], name: "index_government_forms_on_province_id" - t.index ["province_id"], name: "index_government_forms_on_province_id" - t.index ["village_id"], name: "index_government_forms_on_village_id" - t.index ["village_id"], name: "index_government_forms_on_village_id" - end - - create_table "government_reports", id: :serial, force: :cascade do |t| - t.string "code", default: "" - t.string "initial_capital", default: "" - t.string "initial_city", default: "" - t.string "initial_commune", default: "" - t.date "initial_date" - t.string "client_code", default: "" - t.string "commune", default: "" - t.string "city", default: "" - t.string "capital", default: "" - t.string "organisation_name", default: "" - t.string "organisation_phone_number", default: "" - t.string "client_name", default: "" - t.date "client_date_of_birth" - t.string "client_gender", default: "" - t.string "found_client_at", default: "" - t.string "found_client_village", default: "" - t.string "education", default: "" - t.string "carer_name", default: "" - t.string "client_contact", default: "" - t.string "carer_house_number", default: "" - t.string "carer_street_number", default: "" - t.string "carer_village", default: "" - t.string "carer_commune", default: "" - t.string "carer_city", default: "" - t.string "carer_capital", default: "" - t.string "carer_phone_number", default: "" - t.date "case_information_date" - t.string "referral_name", default: "" - t.string "referral_position", default: "" - t.boolean "anonymous", default: false - t.text "anonymous_description", default: "" - t.boolean "client_living_with_guardian", default: false - t.text "present_physical_health", default: "" - t.text "physical_health_need", default: "" - t.text "physical_health_plan", default: "" - t.text "present_supplies", default: "" - t.text "supplies_need", default: "" - t.text "supplies_plan", default: "" - t.text "present_education", default: "" - t.text "education_need", default: "" - t.text "education_plan", default: "" - t.text "present_family_communication", default: "" - t.text "family_communication_need", default: "" - t.text "family_communication_plan", default: "" - t.text "present_society_communication", default: "" - t.text "society_communication_need", default: "" - t.text "society_communication_plan", default: "" - t.text "present_emotional_health", default: "" - t.text "emotional_health_need", default: "" - t.text "emotional_health_plan", default: "" - t.boolean "mission_obtainable", default: false - t.boolean "first_mission", default: false - t.boolean "second_mission", default: false - t.boolean "third_mission", default: false - t.boolean "fourth_mission", default: false - t.date "done_date" - t.date "agreed_date" - t.integer "client_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "government_reports", id: :serial, force: :cascade do |t| - t.string "code", default: "" - t.string "initial_capital", default: "" - t.string "initial_city", default: "" - t.string "initial_commune", default: "" - t.date "initial_date" - t.string "client_code", default: "" - t.string "commune", default: "" - t.string "city", default: "" - t.string "capital", default: "" - t.string "organisation_name", default: "" - t.string "organisation_phone_number", default: "" - t.string "client_name", default: "" - t.date "client_date_of_birth" - t.string "client_gender", default: "" - t.string "found_client_at", default: "" - t.string "found_client_village", default: "" - t.string "education", default: "" - t.string "carer_name", default: "" - t.string "client_contact", default: "" - t.string "carer_house_number", default: "" - t.string "carer_street_number", default: "" - t.string "carer_village", default: "" - t.string "carer_commune", default: "" - t.string "carer_city", default: "" - t.string "carer_capital", default: "" - t.string "carer_phone_number", default: "" - t.date "case_information_date" - t.string "referral_name", default: "" - t.string "referral_position", default: "" - t.boolean "anonymous", default: false - t.text "anonymous_description", default: "" - t.boolean "client_living_with_guardian", default: false - t.text "present_physical_health", default: "" - t.text "physical_health_need", default: "" - t.text "physical_health_plan", default: "" - t.text "present_supplies", default: "" - t.text "supplies_need", default: "" - t.text "supplies_plan", default: "" - t.text "present_education", default: "" - t.text "education_need", default: "" - t.text "education_plan", default: "" - t.text "present_family_communication", default: "" - t.text "family_communication_need", default: "" - t.text "family_communication_plan", default: "" - t.text "present_society_communication", default: "" - t.text "society_communication_need", default: "" - t.text "society_communication_plan", default: "" - t.text "present_emotional_health", default: "" - t.text "emotional_health_need", default: "" - t.text "emotional_health_plan", default: "" - t.boolean "mission_obtainable", default: false - t.boolean "first_mission", default: false - t.boolean "second_mission", default: false - t.boolean "third_mission", default: false - t.boolean "fourth_mission", default: false - t.date "done_date" - t.date "agreed_date" - t.integer "client_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "hotlines", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "call_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["call_id"], name: "index_hotlines_on_call_id" - t.index ["call_id"], name: "index_hotlines_on_call_id" - t.index ["client_id"], name: "index_hotlines_on_client_id" - t.index ["client_id"], name: "index_hotlines_on_client_id" - end - - create_table "hotlines", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "call_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["call_id"], name: "index_hotlines_on_call_id" - t.index ["call_id"], name: "index_hotlines_on_call_id" - t.index ["client_id"], name: "index_hotlines_on_client_id" - t.index ["client_id"], name: "index_hotlines_on_client_id" - end - - create_table "interventions", id: :serial, force: :cascade do |t| - t.string "action", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "interventions", id: :serial, force: :cascade do |t| - t.string "action", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "interviewees", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "interviewees", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "leave_programs", id: :serial, force: :cascade do |t| - t.jsonb "properties", default: {} - t.integer "client_enrollment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "program_stream_id" - t.date "exit_date" - t.datetime "deleted_at" - t.integer "enrollment_id" - t.index ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id" - t.index ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id" - t.index ["deleted_at"], name: "index_leave_programs_on_deleted_at" - t.index ["deleted_at"], name: "index_leave_programs_on_deleted_at" - t.index ["enrollment_id"], name: "index_leave_programs_on_enrollment_id" - t.index ["enrollment_id"], name: "index_leave_programs_on_enrollment_id" - end - - create_table "leave_programs", id: :serial, force: :cascade do |t| - t.jsonb "properties", default: {} - t.integer "client_enrollment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "program_stream_id" - t.date "exit_date" - t.datetime "deleted_at" - t.integer "enrollment_id" - t.index ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id" - t.index ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id" - t.index ["deleted_at"], name: "index_leave_programs_on_deleted_at" - t.index ["deleted_at"], name: "index_leave_programs_on_deleted_at" - t.index ["enrollment_id"], name: "index_leave_programs_on_enrollment_id" - t.index ["enrollment_id"], name: "index_leave_programs_on_enrollment_id" - end - - create_table "locations", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "order_option", default: 0 - end - - create_table "locations", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "order_option", default: 0 - end - - create_table "materials", id: :serial, force: :cascade do |t| - t.string "status", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "materials", id: :serial, force: :cascade do |t| - t.string "status", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "meta_fields", id: :serial, force: :cascade do |t| - t.string "field_name" - t.string "field_type" - t.boolean "hidden", default: true - t.boolean "required", default: false - t.string "label" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "necessities", id: :serial, force: :cascade do |t| - t.string "content", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "necessities", id: :serial, force: :cascade do |t| - t.string "content", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "needs", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "needs", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "oauth_access_grants", id: :integer, default: nil, force: :cascade do |t| - t.integer "resource_owner_id", null: false - t.integer "application_id", null: false - t.string "token", null: false - t.integer "expires_in", null: false - t.text "redirect_uri", null: false - t.datetime "created_at", null: false - t.datetime "revoked_at" - t.string "scopes" - t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true - t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true - end - - create_table "oauth_access_grants", id: :integer, default: nil, force: :cascade do |t| - t.integer "resource_owner_id", null: false - t.integer "application_id", null: false - t.string "token", null: false - t.integer "expires_in", null: false - t.text "redirect_uri", null: false - t.datetime "created_at", null: false - t.datetime "revoked_at" - t.string "scopes" - t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true - t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true - end - - create_table "oauth_access_tokens", id: :integer, default: nil, force: :cascade do |t| - t.integer "resource_owner_id" - t.integer "application_id" - t.string "token", null: false - t.string "refresh_token" - t.integer "expires_in" - t.datetime "revoked_at" - t.datetime "created_at", null: false - t.string "scopes" - t.string "previous_refresh_token", default: "", null: false - t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true - t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true - t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" - t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" - t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true - t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true - end - - create_table "oauth_access_tokens", id: :integer, default: nil, force: :cascade do |t| - t.integer "resource_owner_id" - t.integer "application_id" - t.string "token", null: false - t.string "refresh_token" - t.integer "expires_in" - t.datetime "revoked_at" - t.datetime "created_at", null: false - t.string "scopes" - t.string "previous_refresh_token", default: "", null: false - t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true - t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true - t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" - t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" - t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true - t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true - end - - create_table "oauth_applications", id: :integer, default: nil, force: :cascade do |t| - t.string "name", null: false - t.string "uid", null: false - t.string "secret", null: false - t.text "redirect_uri", null: false - t.string "scopes", default: "", null: false - t.boolean "confidential", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true - t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true - end - - create_table "oauth_applications", id: :integer, default: nil, force: :cascade do |t| - t.string "name", null: false - t.string "uid", null: false - t.string "secret", null: false - t.text "redirect_uri", null: false - t.string "scopes", default: "", null: false - t.boolean "confidential", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true - t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true - end - - create_table "organization_types", id: :serial, force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "organization_types", id: :serial, force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "organizations", id: :serial, force: :cascade do |t| - t.string "full_name" - t.string "short_name" - t.string "logo" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "fcf_ngo", default: false - t.string "country", default: "" - t.boolean "aht", default: false - t.boolean "integrated", default: false - t.string "supported_languages", default: ["km", "en", "my"], array: true - t.integer "clients_count", default: 0 - t.integer "active_client", default: 0 - t.integer "accepted_client", default: 0 - t.boolean "demo", default: false - t.string "referral_source_category_name" - end - - create_table "organizations", id: :serial, force: :cascade do |t| - t.string "full_name" - t.string "short_name" - t.string "logo" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "fcf_ngo", default: false - t.string "country", default: "" - t.boolean "aht", default: false - t.boolean "integrated", default: false - t.string "supported_languages", default: ["km", "en", "my"], array: true - t.integer "clients_count", default: 0 - t.integer "active_client", default: 0 - t.integer "accepted_client", default: 0 - t.boolean "demo", default: false - t.string "referral_source_category_name" - end - - create_table "partners", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.string "address", default: "" - t.date "start_date" - t.string "contact_person_name", default: "" - t.string "contact_person_email", default: "" - t.string "contact_person_mobile", default: "" - t.string "archive_organization_type", default: "" - t.string "affiliation", default: "" - t.string "engagement", default: "" - t.text "background", default: "" - t.integer "province_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.integer "organization_type_id" - t.index ["organization_type_id"], name: "index_partners_on_organization_type_id" - t.index ["organization_type_id"], name: "index_partners_on_organization_type_id" - end - - create_table "partners", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.string "address", default: "" - t.date "start_date" - t.string "contact_person_name", default: "" - t.string "contact_person_email", default: "" - t.string "contact_person_mobile", default: "" - t.string "archive_organization_type", default: "" - t.string "affiliation", default: "" - t.string "engagement", default: "" - t.text "background", default: "" - t.integer "province_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.integer "organization_type_id" - t.index ["organization_type_id"], name: "index_partners_on_organization_type_id" - t.index ["organization_type_id"], name: "index_partners_on_organization_type_id" - end - - create_table "permissions", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.boolean "case_notes_readable", default: true - t.boolean "case_notes_editable", default: true - t.boolean "assessments_editable", default: true - t.boolean "assessments_readable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["user_id"], name: "index_permissions_on_user_id" - t.index ["user_id"], name: "index_permissions_on_user_id" - end - - create_table "permissions", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.boolean "case_notes_readable", default: true - t.boolean "case_notes_editable", default: true - t.boolean "assessments_editable", default: true - t.boolean "assessments_readable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["user_id"], name: "index_permissions_on_user_id" - t.index ["user_id"], name: "index_permissions_on_user_id" - end - - create_table "problems", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "problems", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "program_stream_permissions", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "program_stream_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "deleted_at" - t.index ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at" - t.index ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at" - t.index ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id" - t.index ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id" - t.index ["user_id"], name: "index_program_stream_permissions_on_user_id" - t.index ["user_id"], name: "index_program_stream_permissions_on_user_id" - end - - create_table "program_stream_permissions", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "program_stream_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "deleted_at" - t.index ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at" - t.index ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at" - t.index ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id" - t.index ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id" - t.index ["user_id"], name: "index_program_stream_permissions_on_user_id" - t.index ["user_id"], name: "index_program_stream_permissions_on_user_id" - end - - create_table "program_stream_services", id: :serial, force: :cascade do |t| - t.datetime "deleted_at" - t.integer "program_stream_id" - t.integer "service_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["deleted_at"], name: "index_program_stream_services_on_deleted_at" - t.index ["deleted_at"], name: "index_program_stream_services_on_deleted_at" - t.index ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id" - t.index ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id" - t.index ["service_id"], name: "index_program_stream_services_on_service_id" - t.index ["service_id"], name: "index_program_stream_services_on_service_id" - end + add_index "program_stream_permissions", ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at", using: :btree + add_index "program_stream_permissions", ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id", using: :btree + add_index "program_stream_permissions", ["user_id"], name: "index_program_stream_permissions_on_user_id", using: :btree - create_table "program_stream_services", id: :serial, force: :cascade do |t| + create_table "program_stream_services", force: :cascade do |t| t.datetime "deleted_at" - t.integer "program_stream_id" - t.integer "service_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["deleted_at"], name: "index_program_stream_services_on_deleted_at" - t.index ["deleted_at"], name: "index_program_stream_services_on_deleted_at" - t.index ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id" - t.index ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id" - t.index ["service_id"], name: "index_program_stream_services_on_service_id" - t.index ["service_id"], name: "index_program_stream_services_on_service_id" - end - - create_table "program_streams", id: :serial, force: :cascade do |t| - t.string "name" - t.text "description" - t.jsonb "rules", default: {} - t.jsonb "enrollment", default: {} - t.jsonb "exit_program", default: {} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "quantity" - t.string "ngo_name", default: "" - t.boolean "completed", default: false - t.integer "program_exclusive", default: [], array: true - t.integer "mutual_dependence", default: [], array: true - t.boolean "tracking_required", default: false - t.datetime "archived_at" - t.index ["archived_at"], name: "index_program_streams_on_archived_at" - t.index ["archived_at"], name: "index_program_streams_on_archived_at" - end - - create_table "program_streams", id: :serial, force: :cascade do |t| - t.string "name" - t.text "description" - t.jsonb "rules", default: {} - t.jsonb "enrollment", default: {} - t.jsonb "exit_program", default: {} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "quantity" - t.string "ngo_name", default: "" - t.boolean "completed", default: false - t.integer "program_exclusive", default: [], array: true - t.integer "mutual_dependence", default: [], array: true - t.boolean "tracking_required", default: false + t.integer "program_stream_id" + t.integer "service_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "program_stream_services", ["deleted_at"], name: "index_program_stream_services_on_deleted_at", using: :btree + add_index "program_stream_services", ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id", using: :btree + add_index "program_stream_services", ["service_id"], name: "index_program_stream_services_on_service_id", using: :btree + + create_table "program_streams", force: :cascade do |t| + t.string "name" + t.text "description" + t.jsonb "rules", default: {} + t.jsonb "enrollment", default: {} + t.jsonb "exit_program", default: {} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "quantity" + t.string "ngo_name", default: "" + t.boolean "completed", default: false + t.integer "program_exclusive", default: [], array: true + t.integer "mutual_dependence", default: [], array: true + t.boolean "tracking_required", default: false t.datetime "archived_at" - t.index ["archived_at"], name: "index_program_streams_on_archived_at" - t.index ["archived_at"], name: "index_program_streams_on_archived_at" - end - - create_table "progress_note_types", id: :serial, force: :cascade do |t| - t.string "note_type", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "progress_note_types", id: :serial, force: :cascade do |t| - t.string "note_type", default: "" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "progress_notes", id: :serial, force: :cascade do |t| - t.date "date" - t.string "other_location", default: "" - t.text "response", default: "" - t.text "additional_note", default: "" - t.integer "client_id" - t.integer "progress_note_type_id" - t.integer "location_id" - t.integer "material_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "user_id" - t.index ["client_id"], name: "index_progress_notes_on_client_id" - t.index ["client_id"], name: "index_progress_notes_on_client_id" - t.index ["location_id"], name: "index_progress_notes_on_location_id" - t.index ["location_id"], name: "index_progress_notes_on_location_id" - t.index ["material_id"], name: "index_progress_notes_on_material_id" - t.index ["material_id"], name: "index_progress_notes_on_material_id" - t.index ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id" - t.index ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id" - t.index ["user_id"], name: "index_progress_notes_on_user_id" - t.index ["user_id"], name: "index_progress_notes_on_user_id" - end - - create_table "progress_notes", id: :serial, force: :cascade do |t| - t.date "date" - t.string "other_location", default: "" - t.text "response", default: "" - t.text "additional_note", default: "" - t.integer "client_id" - t.integer "progress_note_type_id" - t.integer "location_id" - t.integer "material_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "user_id" - t.index ["client_id"], name: "index_progress_notes_on_client_id" - t.index ["client_id"], name: "index_progress_notes_on_client_id" - t.index ["location_id"], name: "index_progress_notes_on_location_id" - t.index ["location_id"], name: "index_progress_notes_on_location_id" - t.index ["material_id"], name: "index_progress_notes_on_material_id" - t.index ["material_id"], name: "index_progress_notes_on_material_id" - t.index ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id" - t.index ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id" - t.index ["user_id"], name: "index_progress_notes_on_user_id" - t.index ["user_id"], name: "index_progress_notes_on_user_id" - end - - create_table "protection_concerns", id: :serial, force: :cascade do |t| - t.string "content", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "protection_concerns", id: :serial, force: :cascade do |t| - t.string "content", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "provinces", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.integer "clients_count", default: 0 - t.integer "families_count", default: 0 - t.integer "partners_count", default: 0 - t.integer "users_count", default: 0, null: false - t.string "country" + t.string "entity_type", default: "" end - create_table "provinces", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.integer "clients_count", default: 0 - t.integer "families_count", default: 0 - t.integer "partners_count", default: 0 - t.integer "users_count", default: 0, null: false - t.string "country" - end + add_index "program_streams", ["archived_at"], name: "index_program_streams_on_archived_at", using: :btree - create_table "quantitative_cases", id: :serial, force: :cascade do |t| - t.string "value", default: "" - t.integer "quantitative_type_id" + create_table "progress_note_types", force: :cascade do |t| + t.string "note_type", default: "" t.datetime "created_at" t.datetime "updated_at" end - create_table "quantitative_cases", id: :serial, force: :cascade do |t| - t.string "value", default: "" - t.integer "quantitative_type_id" + create_table "progress_notes", force: :cascade do |t| + t.date "date" + t.string "other_location", default: "" + t.text "response", default: "" + t.text "additional_note", default: "" + t.integer "client_id" + t.integer "progress_note_type_id" + t.integer "location_id" + t.integer "material_id" t.datetime "created_at" t.datetime "updated_at" + t.integer "user_id" end - create_table "quantitative_type_permissions", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "quantitative_type_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id" - t.index ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id" - t.index ["user_id"], name: "index_quantitative_type_permissions_on_user_id" - t.index ["user_id"], name: "index_quantitative_type_permissions_on_user_id" - end + add_index "progress_notes", ["client_id"], name: "index_progress_notes_on_client_id", using: :btree + add_index "progress_notes", ["location_id"], name: "index_progress_notes_on_location_id", using: :btree + add_index "progress_notes", ["material_id"], name: "index_progress_notes_on_material_id", using: :btree + add_index "progress_notes", ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id", using: :btree + add_index "progress_notes", ["user_id"], name: "index_progress_notes_on_user_id", using: :btree - create_table "quantitative_type_permissions", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "quantitative_type_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id" - t.index ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id" - t.index ["user_id"], name: "index_quantitative_type_permissions_on_user_id" - t.index ["user_id"], name: "index_quantitative_type_permissions_on_user_id" + create_table "protection_concerns", force: :cascade do |t| + t.string "content", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "quantitative_types", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.integer "quantitative_cases_count", default: 0 + create_table "provinces", force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" t.datetime "created_at" t.datetime "updated_at" - t.boolean "multiple", default: true + t.integer "cases_count", default: 0 + t.integer "clients_count", default: 0 + t.integer "families_count", default: 0 + t.integer "partners_count", default: 0 + t.integer "users_count", default: 0, null: false + t.string "country" end - create_table "quantitative_types", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.integer "quantitative_cases_count", default: 0 + create_table "quantitative_cases", force: :cascade do |t| + t.string "value", default: "" + t.integer "quantitative_type_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "multiple", default: true - end - - create_table "quarterly_reports", id: :serial, force: :cascade do |t| - t.date "visit_date" - t.bigint "code" - t.integer "case_id" - t.text "general_health_or_appearance", default: "" - t.text "child_school_attendance_or_progress", default: "" - t.text "general_appearance_of_home", default: "" - t.text "observations_of_drug_alchohol_abuse", default: "" - t.text "describe_if_yes", default: "" - t.text "describe_the_family_current_situation", default: "" - t.text "has_the_situation_changed_from_the_previous_visit", default: "" - t.text "how_did_i_encourage_the_client", default: "" - t.text "what_future_teachings_or_trainings_could_help_the_client", default: "" - t.text "what_is_my_plan_for_the_next_visit_to_the_client", default: "" - t.boolean "money_and_supplies_being_used_appropriately", default: false - t.text "how_are_they_being_misused", default: "" - t.integer "staff_id" - t.text "spiritual_developments_with_the_child_or_family", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["case_id"], name: "index_quarterly_reports_on_case_id" - t.index ["case_id"], name: "index_quarterly_reports_on_case_id" - end - - create_table "quarterly_reports", id: :serial, force: :cascade do |t| - t.date "visit_date" - t.bigint "code" - t.integer "case_id" - t.text "general_health_or_appearance", default: "" - t.text "child_school_attendance_or_progress", default: "" - t.text "general_appearance_of_home", default: "" - t.text "observations_of_drug_alchohol_abuse", default: "" - t.text "describe_if_yes", default: "" - t.text "describe_the_family_current_situation", default: "" - t.text "has_the_situation_changed_from_the_previous_visit", default: "" - t.text "how_did_i_encourage_the_client", default: "" - t.text "what_future_teachings_or_trainings_could_help_the_client", default: "" - t.text "what_is_my_plan_for_the_next_visit_to_the_client", default: "" - t.boolean "money_and_supplies_being_used_appropriately", default: false - t.text "how_are_they_being_misused", default: "" - t.integer "staff_id" - t.text "spiritual_developments_with_the_child_or_family", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["case_id"], name: "index_quarterly_reports_on_case_id" - t.index ["case_id"], name: "index_quarterly_reports_on_case_id" - end - - create_table "question_groups", id: :serial, force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false end - create_table "question_groups", id: :serial, force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "quantitative_type_permissions", force: :cascade do |t| + t.integer "user_id" + t.integer "quantitative_type_id" + t.boolean "readable", default: true + t.boolean "editable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "referees", id: :serial, force: :cascade do |t| - t.string "address_type", default: "" - t.string "current_address", default: "" - t.string "email", default: "" - t.string "gender", default: "" - t.string "house_number", default: "" - t.string "outside_address", default: "" - t.string "street_number", default: "" - t.boolean "outside", default: false - t.boolean "anonymous", default: false - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name", default: "" - t.string "phone", default: "" - t.boolean "adult" - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "state_id" - t.integer "township_id" - t.integer "subdistrict_id" - t.string "locality" - t.index ["commune_id"], name: "index_referees_on_commune_id" - t.index ["commune_id"], name: "index_referees_on_commune_id" - t.index ["district_id"], name: "index_referees_on_district_id" - t.index ["district_id"], name: "index_referees_on_district_id" - t.index ["province_id"], name: "index_referees_on_province_id" - t.index ["province_id"], name: "index_referees_on_province_id" - t.index ["state_id"], name: "index_referees_on_state_id" - t.index ["state_id"], name: "index_referees_on_state_id" - t.index ["subdistrict_id"], name: "index_referees_on_subdistrict_id" - t.index ["subdistrict_id"], name: "index_referees_on_subdistrict_id" - t.index ["township_id"], name: "index_referees_on_township_id" - t.index ["township_id"], name: "index_referees_on_township_id" - t.index ["village_id"], name: "index_referees_on_village_id" - t.index ["village_id"], name: "index_referees_on_village_id" - end - - create_table "referees", id: :serial, force: :cascade do |t| - t.string "address_type", default: "" - t.string "current_address", default: "" - t.string "email", default: "" - t.string "gender", default: "" - t.string "house_number", default: "" - t.string "outside_address", default: "" - t.string "street_number", default: "" - t.boolean "outside", default: false - t.boolean "anonymous", default: false - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name", default: "" - t.string "phone", default: "" - t.boolean "adult" - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "state_id" - t.integer "township_id" - t.integer "subdistrict_id" - t.string "locality" - t.index ["commune_id"], name: "index_referees_on_commune_id" - t.index ["commune_id"], name: "index_referees_on_commune_id" - t.index ["district_id"], name: "index_referees_on_district_id" - t.index ["district_id"], name: "index_referees_on_district_id" - t.index ["province_id"], name: "index_referees_on_province_id" - t.index ["province_id"], name: "index_referees_on_province_id" - t.index ["state_id"], name: "index_referees_on_state_id" - t.index ["state_id"], name: "index_referees_on_state_id" - t.index ["subdistrict_id"], name: "index_referees_on_subdistrict_id" - t.index ["subdistrict_id"], name: "index_referees_on_subdistrict_id" - t.index ["township_id"], name: "index_referees_on_township_id" - t.index ["township_id"], name: "index_referees_on_township_id" - t.index ["village_id"], name: "index_referees_on_village_id" - t.index ["village_id"], name: "index_referees_on_village_id" - end - - create_table "referral_sources", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "clients_count", default: 0 - t.string "name_en", default: "" - t.string "ancestry" - t.index ["ancestry"], name: "index_referral_sources_on_ancestry" - t.index ["ancestry"], name: "index_referral_sources_on_ancestry" - end + add_index "quantitative_type_permissions", ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id", using: :btree + add_index "quantitative_type_permissions", ["user_id"], name: "index_quantitative_type_permissions_on_user_id", using: :btree - create_table "referral_sources", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" + create_table "quantitative_types", force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.integer "quantitative_cases_count", default: 0 t.datetime "created_at" t.datetime "updated_at" - t.integer "clients_count", default: 0 - t.string "name_en", default: "" - t.string "ancestry" - t.index ["ancestry"], name: "index_referral_sources_on_ancestry" - t.index ["ancestry"], name: "index_referral_sources_on_ancestry" - end - - create_table "referrals", id: :serial, force: :cascade do |t| - t.string "slug", default: "" - t.date "date_of_referral" - t.string "referred_to", default: "" - t.string "referred_from", default: "" - t.text "referral_reason", default: "" - t.string "name_of_referee", default: "" - t.string "referral_phone", default: "" - t.integer "referee_id" - t.string "client_name", default: "" - t.string "consent_form", default: [], array: true - t.boolean "saved", default: false - t.integer "client_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "ngo_name", default: "" - t.string "client_global_id" - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - t.string "client_gender", default: "" - t.date "client_date_of_birth" - t.string "village_code", default: "" - t.string "referee_email" - t.index ["client_global_id"], name: "index_referrals_on_client_global_id" - t.index ["client_global_id"], name: "index_referrals_on_client_global_id" - t.index ["client_id"], name: "index_referrals_on_client_id" - t.index ["client_id"], name: "index_referrals_on_client_id" - t.index ["external_id"], name: "index_referrals_on_external_id" - t.index ["external_id"], name: "index_referrals_on_external_id" - t.index ["mosvy_number"], name: "index_referrals_on_mosvy_number" - t.index ["mosvy_number"], name: "index_referrals_on_mosvy_number" - end - - create_table "referrals", id: :serial, force: :cascade do |t| - t.string "slug", default: "" - t.date "date_of_referral" - t.string "referred_to", default: "" - t.string "referred_from", default: "" - t.text "referral_reason", default: "" - t.string "name_of_referee", default: "" - t.string "referral_phone", default: "" - t.integer "referee_id" - t.string "client_name", default: "" - t.string "consent_form", default: [], array: true - t.boolean "saved", default: false - t.integer "client_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "ngo_name", default: "" - t.string "client_global_id" - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - t.string "client_gender", default: "" - t.date "client_date_of_birth" - t.string "village_code", default: "" - t.string "referee_email" - t.index ["client_global_id"], name: "index_referrals_on_client_global_id" - t.index ["client_global_id"], name: "index_referrals_on_client_global_id" - t.index ["client_id"], name: "index_referrals_on_client_id" - t.index ["client_id"], name: "index_referrals_on_client_id" - t.index ["external_id"], name: "index_referrals_on_external_id" - t.index ["external_id"], name: "index_referrals_on_external_id" - t.index ["mosvy_number"], name: "index_referrals_on_mosvy_number" - t.index ["mosvy_number"], name: "index_referrals_on_mosvy_number" + t.boolean "multiple", default: true end - create_table "referrals_services", id: false, force: :cascade do |t| - t.integer "referral_id" - t.integer "service_id" - end + create_table "quarterly_reports", force: :cascade do |t| + t.date "visit_date" + t.integer "code", limit: 8 + t.integer "case_id" + t.text "general_health_or_appearance", default: "" + t.text "child_school_attendance_or_progress", default: "" + t.text "general_appearance_of_home", default: "" + t.text "observations_of_drug_alchohol_abuse", default: "" + t.text "describe_if_yes", default: "" + t.text "describe_the_family_current_situation", default: "" + t.text "has_the_situation_changed_from_the_previous_visit", default: "" + t.text "how_did_i_encourage_the_client", default: "" + t.text "what_future_teachings_or_trainings_could_help_the_client", default: "" + t.text "what_is_my_plan_for_the_next_visit_to_the_client", default: "" + t.boolean "money_and_supplies_being_used_appropriately", default: false + t.text "how_are_they_being_misused", default: "" + t.integer "staff_id" + t.text "spiritual_developments_with_the_child_or_family", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "quarterly_reports", ["case_id"], name: "index_quarterly_reports_on_case_id", using: :btree + + create_table "question_groups", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "referees", force: :cascade do |t| + t.string "address_type", default: "" + t.string "current_address", default: "" + t.string "email", default: "" + t.string "gender", default: "" + t.string "house_number", default: "" + t.string "outside_address", default: "" + t.string "street_number", default: "" + t.boolean "outside", default: false + t.boolean "anonymous", default: false + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name", default: "" + t.string "phone", default: "" + t.boolean "adult" + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "state_id" + t.integer "township_id" + t.integer "subdistrict_id" + t.string "locality" + end + + add_index "referees", ["commune_id"], name: "index_referees_on_commune_id", using: :btree + add_index "referees", ["district_id"], name: "index_referees_on_district_id", using: :btree + add_index "referees", ["province_id"], name: "index_referees_on_province_id", using: :btree + add_index "referees", ["state_id"], name: "index_referees_on_state_id", using: :btree + add_index "referees", ["subdistrict_id"], name: "index_referees_on_subdistrict_id", using: :btree + add_index "referees", ["township_id"], name: "index_referees_on_township_id", using: :btree + add_index "referees", ["village_id"], name: "index_referees_on_village_id", using: :btree + + create_table "referral_sources", force: :cascade do |t| + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "clients_count", default: 0 + t.string "name_en", default: "" + t.string "ancestry" + end + + add_index "referral_sources", ["ancestry"], name: "index_referral_sources_on_ancestry", using: :btree + + create_table "referrals", force: :cascade do |t| + t.string "slug", default: "" + t.date "date_of_referral" + t.string "referred_to", default: "" + t.string "referred_from", default: "" + t.text "referral_reason", default: "" + t.string "name_of_referee", default: "" + t.string "referral_phone", default: "" + t.integer "referee_id" + t.string "client_name", default: "" + t.string "consent_form", default: [], array: true + t.boolean "saved", default: false + t.integer "client_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "ngo_name", default: "" + t.string "client_global_id" + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + t.string "client_gender", default: "" + t.date "client_date_of_birth" + t.string "village_code", default: "" + t.string "referee_email" + end + + add_index "referrals", ["client_global_id"], name: "index_referrals_on_client_global_id", using: :btree + add_index "referrals", ["client_id"], name: "index_referrals_on_client_id", using: :btree + add_index "referrals", ["external_id"], name: "index_referrals_on_external_id", using: :btree + add_index "referrals", ["mosvy_number"], name: "index_referrals_on_mosvy_number", using: :btree create_table "referrals_services", id: false, force: :cascade do |t| t.integer "referral_id" t.integer "service_id" end - create_table "service_types", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "service_types", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "service_types", force: :cascade do |t| + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "services", id: :serial, force: :cascade do |t| - t.string "name" - t.integer "parent_id" - t.datetime "deleted_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.uuid "uuid" - t.index ["deleted_at"], name: "index_services_on_deleted_at" - t.index ["deleted_at"], name: "index_services_on_deleted_at" - t.index ["name"], name: "index_services_on_name" - t.index ["name"], name: "index_services_on_name" - t.index ["parent_id"], name: "index_services_on_parent_id" - t.index ["parent_id"], name: "index_services_on_parent_id" - t.index ["uuid"], name: "index_services_on_uuid" - t.index ["uuid"], name: "index_services_on_uuid" - end - - create_table "services", id: :serial, force: :cascade do |t| - t.string "name" - t.integer "parent_id" + create_table "services", force: :cascade do |t| + t.string "name" + t.integer "parent_id" t.datetime "deleted_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.uuid "uuid" - t.index ["deleted_at"], name: "index_services_on_deleted_at" - t.index ["deleted_at"], name: "index_services_on_deleted_at" - t.index ["name"], name: "index_services_on_name" - t.index ["name"], name: "index_services_on_name" - t.index ["parent_id"], name: "index_services_on_parent_id" - t.index ["parent_id"], name: "index_services_on_parent_id" - t.index ["uuid"], name: "index_services_on_uuid" - t.index ["uuid"], name: "index_services_on_uuid" - end - - create_table "settings", id: :serial, force: :cascade do |t| - t.string "assessment_frequency", default: "month" - t.integer "min_assessment" - t.integer "max_assessment", default: 6 - t.string "country_name", default: "" - t.integer "max_case_note" - t.string "case_note_frequency" - t.string "client_default_columns", default: [], array: true - t.string "family_default_columns", default: [], array: true - t.string "partner_default_columns", default: [], array: true - t.string "user_default_columns", default: [], array: true - t.datetime "created_at" - t.datetime "updated_at" - t.string "org_name", default: "" - t.string "old_commune", default: "" - t.integer "province_id" - t.integer "district_id" - t.integer "age", default: 18 - t.integer "commune_id" - t.string "custom_assessment", default: "Custom Assessment" - t.boolean "enable_custom_assessment", default: false - t.boolean "enable_default_assessment", default: true - t.integer "max_custom_assessment", default: 6 - t.string "custom_assessment_frequency", default: "month" - t.integer "custom_age", default: 18 - t.string "default_assessment", default: "CSI Assessment" - t.boolean "sharing_data", default: false - t.string "custom_id1_latin", default: "" - t.string "custom_id1_local", default: "" - t.string "custom_id2_latin", default: "" - t.string "custom_id2_local", default: "" - t.boolean "enable_hotline", default: false - t.boolean "enable_client_form", default: true - t.string "assessment_score_order", default: "random_order", null: false - t.boolean "disable_required_fields", default: false, null: false - t.boolean "never_delete_incomplete_assessment", default: false, null: false - t.integer "delete_incomplete_after_period_value", default: 7 - t.string "delete_incomplete_after_period_unit", default: "days" - t.boolean "use_screening_assessment", default: false - t.integer "screening_assessment_form_id" - t.boolean "show_prev_assessment", default: false - t.boolean "two_weeks_assessment_reminder", default: false - t.index ["commune_id"], name: "index_settings_on_commune_id" - t.index ["commune_id"], name: "index_settings_on_commune_id" - t.index ["district_id"], name: "index_settings_on_district_id" - t.index ["district_id"], name: "index_settings_on_district_id" - t.index ["province_id"], name: "index_settings_on_province_id" - t.index ["province_id"], name: "index_settings_on_province_id" - end - - create_table "settings", id: :serial, force: :cascade do |t| - t.string "assessment_frequency", default: "month" - t.integer "min_assessment" - t.integer "max_assessment", default: 6 - t.string "country_name", default: "" - t.integer "max_case_note" - t.string "case_note_frequency" - t.string "client_default_columns", default: [], array: true - t.string "family_default_columns", default: [], array: true - t.string "partner_default_columns", default: [], array: true - t.string "user_default_columns", default: [], array: true - t.datetime "created_at" - t.datetime "updated_at" - t.string "org_name", default: "" - t.string "old_commune", default: "" - t.integer "province_id" - t.integer "district_id" - t.integer "age", default: 18 - t.integer "commune_id" - t.string "custom_assessment", default: "Custom Assessment" - t.boolean "enable_custom_assessment", default: false - t.boolean "enable_default_assessment", default: true - t.integer "max_custom_assessment", default: 6 - t.string "custom_assessment_frequency", default: "month" - t.integer "custom_age", default: 18 - t.string "default_assessment", default: "CSI Assessment" - t.boolean "sharing_data", default: false - t.string "custom_id1_latin", default: "" - t.string "custom_id1_local", default: "" - t.string "custom_id2_latin", default: "" - t.string "custom_id2_local", default: "" - t.boolean "enable_hotline", default: false - t.boolean "enable_client_form", default: true - t.string "assessment_score_order", default: "random_order", null: false - t.boolean "disable_required_fields", default: false, null: false - t.boolean "never_delete_incomplete_assessment", default: false, null: false - t.integer "delete_incomplete_after_period_value", default: 7 - t.string "delete_incomplete_after_period_unit", default: "days" - t.boolean "use_screening_assessment", default: false - t.integer "screening_assessment_form_id" - t.boolean "show_prev_assessment", default: false - t.boolean "two_weeks_assessment_reminder", default: false - t.index ["commune_id"], name: "index_settings_on_commune_id" - t.index ["commune_id"], name: "index_settings_on_commune_id" - t.index ["district_id"], name: "index_settings_on_district_id" - t.index ["district_id"], name: "index_settings_on_district_id" - t.index ["province_id"], name: "index_settings_on_province_id" - t.index ["province_id"], name: "index_settings_on_province_id" - end - - create_table "shared_clients", id: :serial, force: :cascade do |t| - t.string "slug", default: "" - t.string "given_name", default: "" - t.string "family_name", default: "" - t.string "local_given_name", default: "" - t.string "local_family_name", default: "" - t.string "gender", default: "" - t.date "date_of_birth" - t.string "live_with", default: "" - t.string "telephone_number", default: "" - t.integer "birth_province_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "country_origin", default: "" - t.string "duplicate_checker" - t.string "archived_slug" - t.string "global_id" - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - t.index ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker" - t.index ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker" - t.index ["external_id"], name: "index_shared_clients_on_external_id" - t.index ["external_id"], name: "index_shared_clients_on_external_id" - t.index ["global_id"], name: "index_shared_clients_on_global_id" - t.index ["global_id"], name: "index_shared_clients_on_global_id" - t.index ["mosvy_number"], name: "index_shared_clients_on_mosvy_number" - t.index ["mosvy_number"], name: "index_shared_clients_on_mosvy_number" - t.index ["slug"], name: "index_shared_clients_on_slug", unique: true - t.index ["slug"], name: "index_shared_clients_on_slug", unique: true - end - - create_table "shared_clients", id: :serial, force: :cascade do |t| - t.string "slug", default: "" - t.string "given_name", default: "" - t.string "family_name", default: "" - t.string "local_given_name", default: "" - t.string "local_family_name", default: "" - t.string "gender", default: "" - t.date "date_of_birth" - t.string "live_with", default: "" - t.string "telephone_number", default: "" - t.integer "birth_province_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "country_origin", default: "" - t.string "duplicate_checker" - t.string "archived_slug" - t.string "global_id" - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - t.index ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker" - t.index ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker" - t.index ["external_id"], name: "index_shared_clients_on_external_id" - t.index ["external_id"], name: "index_shared_clients_on_external_id" - t.index ["global_id"], name: "index_shared_clients_on_global_id" - t.index ["global_id"], name: "index_shared_clients_on_global_id" - t.index ["mosvy_number"], name: "index_shared_clients_on_mosvy_number" - t.index ["mosvy_number"], name: "index_shared_clients_on_mosvy_number" - t.index ["slug"], name: "index_shared_clients_on_slug", unique: true - t.index ["slug"], name: "index_shared_clients_on_slug", unique: true - end - - create_table "sponsors", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "donor_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["client_id"], name: "index_sponsors_on_client_id" - t.index ["client_id"], name: "index_sponsors_on_client_id" - t.index ["donor_id"], name: "index_sponsors_on_donor_id" - t.index ["donor_id"], name: "index_sponsors_on_donor_id" - end - - create_table "sponsors", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "donor_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["client_id"], name: "index_sponsors_on_client_id" - t.index ["client_id"], name: "index_sponsors_on_client_id" - t.index ["donor_id"], name: "index_sponsors_on_donor_id" - t.index ["donor_id"], name: "index_sponsors_on_donor_id" - end - - create_table "stages", id: :serial, force: :cascade do |t| - t.float "from_age" - t.float "to_age" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "stages", id: :serial, force: :cascade do |t| - t.float "from_age" - t.float "to_age" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "states", id: :serial, force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "states", id: :serial, force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "subdistricts", id: :serial, force: :cascade do |t| - t.string "name" - t.integer "district_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["district_id"], name: "index_subdistricts_on_district_id" - t.index ["district_id"], name: "index_subdistricts_on_district_id" - end - - create_table "subdistricts", id: :serial, force: :cascade do |t| - t.string "name" - t.integer "district_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["district_id"], name: "index_subdistricts_on_district_id" - t.index ["district_id"], name: "index_subdistricts_on_district_id" - end - - create_table "surveys", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "user_id" - t.integer "listening_score" - t.integer "problem_solving_score" - t.integer "getting_in_touch_score" - t.integer "trust_score" - t.integer "difficulty_help_score" - t.integer "support_score" - t.integer "family_need_score" - t.integer "care_score" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["client_id"], name: "index_surveys_on_client_id" - t.index ["client_id"], name: "index_surveys_on_client_id" - end - - create_table "surveys", id: :serial, force: :cascade do |t| - t.integer "client_id" - t.integer "user_id" - t.integer "listening_score" - t.integer "problem_solving_score" - t.integer "getting_in_touch_score" - t.integer "trust_score" - t.integer "difficulty_help_score" - t.integer "support_score" - t.integer "family_need_score" - t.integer "care_score" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["client_id"], name: "index_surveys_on_client_id" - t.index ["client_id"], name: "index_surveys_on_client_id" - end - - create_table "tasks", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.date "completion_date" - t.datetime "remind_at" - t.boolean "completed", default: false - t.integer "user_id" - t.integer "case_note_domain_group_id" - t.integer "domain_id" + t.uuid "uuid" + end + + add_index "services", ["deleted_at"], name: "index_services_on_deleted_at", using: :btree + add_index "services", ["name"], name: "index_services_on_name", using: :btree + add_index "services", ["parent_id"], name: "index_services_on_parent_id", using: :btree + add_index "services", ["uuid"], name: "index_services_on_uuid", using: :btree + + create_table "settings", force: :cascade do |t| + t.string "assessment_frequency", default: "month" + t.integer "min_assessment" + t.integer "max_assessment", default: 6 + t.string "country_name", default: "" + t.integer "max_case_note" + t.string "case_note_frequency" + t.string "client_default_columns", default: [], array: true + t.string "family_default_columns", default: [], array: true + t.string "partner_default_columns", default: [], array: true + t.string "user_default_columns", default: [], array: true + t.datetime "created_at" + t.datetime "updated_at" + t.string "org_name", default: "" + t.string "old_commune", default: "" + t.integer "province_id" + t.integer "district_id" + t.integer "age", default: 18 + t.integer "commune_id" + t.string "custom_assessment", default: "Custom Assessment" + t.boolean "enable_custom_assessment", default: false + t.boolean "enable_default_assessment", default: true + t.integer "max_custom_assessment", default: 6 + t.string "custom_assessment_frequency", default: "month" + t.integer "custom_age", default: 18 + t.string "default_assessment", default: "CSI Assessment" + t.boolean "sharing_data", default: false + t.string "custom_id1_latin", default: "" + t.string "custom_id1_local", default: "" + t.string "custom_id2_latin", default: "" + t.string "custom_id2_local", default: "" + t.boolean "enable_hotline", default: false + t.boolean "enable_client_form", default: true + t.string "assessment_score_order", default: "random_order", null: false + t.boolean "disable_required_fields", default: false, null: false + t.boolean "never_delete_incomplete_assessment", default: false, null: false + t.integer "delete_incomplete_after_period_value", default: 7 + t.string "delete_incomplete_after_period_unit", default: "days" + t.boolean "use_screening_assessment", default: false + t.integer "screening_assessment_form_id" + t.boolean "show_prev_assessment", default: false + t.boolean "two_weeks_assessment_reminder", default: false + end + + add_index "settings", ["commune_id"], name: "index_settings_on_commune_id", using: :btree + add_index "settings", ["district_id"], name: "index_settings_on_district_id", using: :btree + add_index "settings", ["province_id"], name: "index_settings_on_province_id", using: :btree + + create_table "shared_clients", force: :cascade do |t| + t.string "slug", default: "" + t.string "given_name", default: "" + t.string "family_name", default: "" + t.string "local_given_name", default: "" + t.string "local_family_name", default: "" + t.string "gender", default: "" + t.date "date_of_birth" + t.string "live_with", default: "" + t.string "telephone_number", default: "" + t.integer "birth_province_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "country_origin", default: "" + t.string "duplicate_checker" + t.string "archived_slug" + t.string "global_id" + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + end + + add_index "shared_clients", ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker", using: :btree + add_index "shared_clients", ["external_id"], name: "index_shared_clients_on_external_id", using: :btree + add_index "shared_clients", ["global_id"], name: "index_shared_clients_on_global_id", using: :btree + add_index "shared_clients", ["mosvy_number"], name: "index_shared_clients_on_mosvy_number", using: :btree + add_index "shared_clients", ["slug"], name: "index_shared_clients_on_slug", unique: true, using: :btree + + create_table "sponsors", force: :cascade do |t| + t.integer "client_id" + t.integer "donor_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "sponsors", ["client_id"], name: "index_sponsors_on_client_id", using: :btree + add_index "sponsors", ["donor_id"], name: "index_sponsors_on_donor_id", using: :btree + + create_table "stages", force: :cascade do |t| + t.float "from_age" + t.float "to_age" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "states", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "subdistricts", force: :cascade do |t| + t.string "name" + t.integer "district_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "subdistricts", ["district_id"], name: "index_subdistricts_on_district_id", using: :btree + + create_table "surveys", force: :cascade do |t| + t.integer "client_id" + t.integer "user_id" + t.integer "listening_score" + t.integer "problem_solving_score" + t.integer "getting_in_touch_score" + t.integer "trust_score" + t.integer "difficulty_help_score" + t.integer "support_score" + t.integer "family_need_score" + t.integer "care_score" t.datetime "created_at" t.datetime "updated_at" - t.integer "client_id" - t.string "relation", default: "" - t.string "case_note_id", default: "" - t.integer "taskable_id" - t.string "taskable_type" - t.datetime "deleted_at" - t.index ["client_id"], name: "index_tasks_on_client_id" - t.index ["client_id"], name: "index_tasks_on_client_id" - t.index ["deleted_at"], name: "index_tasks_on_deleted_at" - t.index ["deleted_at"], name: "index_tasks_on_deleted_at" - t.index ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id" - t.index ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id" end - create_table "tasks", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.date "completion_date" + add_index "surveys", ["client_id"], name: "index_surveys_on_client_id", using: :btree + + create_table "tasks", force: :cascade do |t| + t.string "name", default: "" + t.date "completion_date" t.datetime "remind_at" - t.boolean "completed", default: false - t.integer "user_id" - t.integer "case_note_domain_group_id" - t.integer "domain_id" + t.boolean "completed", default: false + t.integer "user_id" + t.integer "case_note_domain_group_id" + t.integer "domain_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "client_id" - t.string "relation", default: "" - t.string "case_note_id", default: "" - t.integer "taskable_id" - t.string "taskable_type" + t.integer "client_id" + t.string "relation", default: "" + t.string "case_note_id", default: "" + t.integer "taskable_id" + t.string "taskable_type" t.datetime "deleted_at" - t.index ["client_id"], name: "index_tasks_on_client_id" - t.index ["client_id"], name: "index_tasks_on_client_id" - t.index ["deleted_at"], name: "index_tasks_on_deleted_at" - t.index ["deleted_at"], name: "index_tasks_on_deleted_at" - t.index ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id" - t.index ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id" - end - - create_table "thredded_categories", id: :serial, force: :cascade do |t| - t.integer "messageboard_id", null: false - t.string "name", limit: 191, null: false - t.string "description", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "slug", limit: 191, null: false - t.index "lower((name)::text) text_pattern_ops", name: "thredded_categories_name_ci" - t.index ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true - t.index ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true - t.index ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id" - t.index ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id" - end - - create_table "thredded_categories", id: :serial, force: :cascade do |t| - t.integer "messageboard_id", null: false - t.string "name", limit: 191, null: false - t.string "description", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "slug", limit: 191, null: false - t.index "lower((name)::text) text_pattern_ops", name: "thredded_categories_name_ci" - t.index ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true - t.index ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true - t.index ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id" - t.index ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id" end - create_table "thredded_messageboard_groups", id: :serial, force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end + add_index "tasks", ["client_id"], name: "index_tasks_on_client_id", using: :btree + add_index "tasks", ["deleted_at"], name: "index_tasks_on_deleted_at", using: :btree + add_index "tasks", ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id", using: :btree - create_table "thredded_messageboard_groups", id: :serial, force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "thredded_categories", force: :cascade do |t| + t.integer "messageboard_id", null: false + t.string "name", limit: 191, null: false + t.string "description", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "slug", limit: 191, null: false end - create_table "thredded_messageboards", id: :serial, force: :cascade do |t| - t.string "name", limit: 255, null: false - t.string "slug", limit: 191 - t.text "description" - t.integer "topics_count", default: 0 - t.integer "posts_count", default: 0 - t.boolean "closed", default: false, null: false - t.integer "last_topic_id" - t.integer "messageboard_group_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["closed"], name: "index_thredded_messageboards_on_closed" - t.index ["closed"], name: "index_thredded_messageboards_on_closed" - t.index ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id" - t.index ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id" - t.index ["slug"], name: "index_thredded_messageboards_on_slug" - t.index ["slug"], name: "index_thredded_messageboards_on_slug" - end - - create_table "thredded_messageboards", id: :serial, force: :cascade do |t| - t.string "name", limit: 255, null: false - t.string "slug", limit: 191 - t.text "description" - t.integer "topics_count", default: 0 - t.integer "posts_count", default: 0 - t.boolean "closed", default: false, null: false - t.integer "last_topic_id" - t.integer "messageboard_group_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["closed"], name: "index_thredded_messageboards_on_closed" - t.index ["closed"], name: "index_thredded_messageboards_on_closed" - t.index ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id" - t.index ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id" - t.index ["slug"], name: "index_thredded_messageboards_on_slug" - t.index ["slug"], name: "index_thredded_messageboards_on_slug" - end - - create_table "thredded_post_moderation_records", id: :serial, force: :cascade do |t| - t.integer "post_id" - t.integer "messageboard_id" - t.text "post_content" - t.integer "post_user_id" - t.text "post_user_name" - t.integer "moderator_id" - t.integer "moderation_state", null: false - t.integer "previous_moderation_state", null: false - t.datetime "created_at", null: false - t.index ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: { created_at: :desc } - t.index ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: { created_at: :desc } - end - - create_table "thredded_post_moderation_records", id: :serial, force: :cascade do |t| - t.integer "post_id" - t.integer "messageboard_id" - t.text "post_content" - t.integer "post_user_id" - t.text "post_user_name" - t.integer "moderator_id" - t.integer "moderation_state", null: false - t.integer "previous_moderation_state", null: false - t.datetime "created_at", null: false - t.index ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: { created_at: :desc } - t.index ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: { created_at: :desc } - end + add_index "thredded_categories", ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true, using: :btree + add_index "thredded_categories", ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id", using: :btree - create_table "thredded_post_notifications", id: :serial, force: :cascade do |t| - t.string "email", limit: 191, null: false - t.integer "post_id", null: false + create_table "thredded_messageboard_groups", force: :cascade do |t| + t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.string "post_type", limit: 191 - t.index ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post" - t.index ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post" end - create_table "thredded_post_notifications", id: :serial, force: :cascade do |t| - t.string "email", limit: 191, null: false - t.integer "post_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "post_type", limit: 191 - t.index ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post" - t.index ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post" + create_table "thredded_messageboards", force: :cascade do |t| + t.string "name", limit: 255, null: false + t.string "slug", limit: 191 + t.text "description" + t.integer "topics_count", default: 0 + t.integer "posts_count", default: 0 + t.boolean "closed", default: false, null: false + t.integer "last_topic_id" + t.integer "messageboard_group_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "thredded_posts", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.text "content" - t.string "ip", limit: 255 - t.string "source", limit: 255, default: "web" - t.integer "postable_id", null: false - t.integer "messageboard_id", null: false - t.integer "moderation_state", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index "to_tsvector('english'::regconfig, content)", name: "thredded_posts_content_fts", using: :gist - t.index ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id" - t.index ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id" - t.index ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display" - t.index ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display" - t.index ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type" - t.index ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type" - t.index ["user_id"], name: "index_thredded_posts_on_user_id" - t.index ["user_id"], name: "index_thredded_posts_on_user_id" - end - - create_table "thredded_posts", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.text "content" - t.string "ip", limit: 255 - t.string "source", limit: 255, default: "web" - t.integer "postable_id", null: false - t.integer "messageboard_id", null: false - t.integer "moderation_state", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index "to_tsvector('english'::regconfig, content)", name: "thredded_posts_content_fts", using: :gist - t.index ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id" - t.index ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id" - t.index ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display" - t.index ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display" - t.index ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type" - t.index ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type" - t.index ["user_id"], name: "index_thredded_posts_on_user_id" - t.index ["user_id"], name: "index_thredded_posts_on_user_id" - end - - create_table "thredded_private_posts", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.text "content" - t.integer "postable_id", null: false - t.string "ip", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end + add_index "thredded_messageboards", ["closed"], name: "index_thredded_messageboards_on_closed", using: :btree + add_index "thredded_messageboards", ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id", using: :btree + add_index "thredded_messageboards", ["slug"], name: "index_thredded_messageboards_on_slug", using: :btree - create_table "thredded_private_posts", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.text "content" - t.integer "postable_id", null: false - t.string "ip", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "thredded_post_moderation_records", force: :cascade do |t| + t.integer "post_id" + t.integer "messageboard_id" + t.text "post_content" + t.integer "post_user_id" + t.text "post_user_name" + t.integer "moderator_id" + t.integer "moderation_state", null: false + t.integer "previous_moderation_state", null: false + t.datetime "created_at", null: false end - create_table "thredded_private_topics", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "last_user_id" - t.string "title", limit: 255, null: false - t.string "slug", limit: 191, null: false - t.integer "posts_count", default: 0 - t.string "hash_id", limit: 191, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["hash_id"], name: "index_thredded_private_topics_on_hash_id" - t.index ["hash_id"], name: "index_thredded_private_topics_on_hash_id" - t.index ["slug"], name: "index_thredded_private_topics_on_slug" - t.index ["slug"], name: "index_thredded_private_topics_on_slug" + add_index "thredded_post_moderation_records", ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: {"created_at"=>:desc}, using: :btree + + create_table "thredded_post_notifications", force: :cascade do |t| + t.string "email", limit: 191, null: false + t.integer "post_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "post_type", limit: 191 end - create_table "thredded_private_topics", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "last_user_id" - t.string "title", limit: 255, null: false - t.string "slug", limit: 191, null: false - t.integer "posts_count", default: 0 - t.string "hash_id", limit: 191, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["hash_id"], name: "index_thredded_private_topics_on_hash_id" - t.index ["hash_id"], name: "index_thredded_private_topics_on_hash_id" - t.index ["slug"], name: "index_thredded_private_topics_on_slug" - t.index ["slug"], name: "index_thredded_private_topics_on_slug" + add_index "thredded_post_notifications", ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post", using: :btree + + create_table "thredded_posts", force: :cascade do |t| + t.integer "user_id" + t.text "content" + t.string "ip", limit: 255 + t.string "source", limit: 255, default: "web" + t.integer "postable_id", null: false + t.integer "messageboard_id", null: false + t.integer "moderation_state", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "thredded_private_users", id: :serial, force: :cascade do |t| - t.integer "private_topic_id" - t.integer "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id" - t.index ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id" - t.index ["user_id"], name: "index_thredded_private_users_on_user_id" - t.index ["user_id"], name: "index_thredded_private_users_on_user_id" + add_index "thredded_posts", ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id", using: :btree + add_index "thredded_posts", ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display", using: :btree + add_index "thredded_posts", ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type", using: :btree + add_index "thredded_posts", ["user_id"], name: "index_thredded_posts_on_user_id", using: :btree + + create_table "thredded_private_posts", force: :cascade do |t| + t.integer "user_id" + t.text "content" + t.integer "postable_id", null: false + t.string "ip", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "thredded_private_users", id: :serial, force: :cascade do |t| - t.integer "private_topic_id" - t.integer "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id" - t.index ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id" - t.index ["user_id"], name: "index_thredded_private_users_on_user_id" - t.index ["user_id"], name: "index_thredded_private_users_on_user_id" + create_table "thredded_private_topics", force: :cascade do |t| + t.integer "user_id" + t.integer "last_user_id" + t.string "title", limit: 255, null: false + t.string "slug", limit: 191, null: false + t.integer "posts_count", default: 0 + t.string "hash_id", limit: 191, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "thredded_topic_categories", id: :serial, force: :cascade do |t| - t.integer "topic_id", null: false - t.integer "category_id", null: false - t.index ["category_id"], name: "index_thredded_topic_categories_on_category_id" - t.index ["category_id"], name: "index_thredded_topic_categories_on_category_id" - t.index ["topic_id"], name: "index_thredded_topic_categories_on_topic_id" - t.index ["topic_id"], name: "index_thredded_topic_categories_on_topic_id" + add_index "thredded_private_topics", ["hash_id"], name: "index_thredded_private_topics_on_hash_id", using: :btree + add_index "thredded_private_topics", ["slug"], name: "index_thredded_private_topics_on_slug", using: :btree + + create_table "thredded_private_users", force: :cascade do |t| + t.integer "private_topic_id" + t.integer "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "thredded_topic_categories", id: :serial, force: :cascade do |t| - t.integer "topic_id", null: false + add_index "thredded_private_users", ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id", using: :btree + add_index "thredded_private_users", ["user_id"], name: "index_thredded_private_users_on_user_id", using: :btree + + create_table "thredded_topic_categories", force: :cascade do |t| + t.integer "topic_id", null: false t.integer "category_id", null: false - t.index ["category_id"], name: "index_thredded_topic_categories_on_category_id" - t.index ["category_id"], name: "index_thredded_topic_categories_on_category_id" - t.index ["topic_id"], name: "index_thredded_topic_categories_on_topic_id" - t.index ["topic_id"], name: "index_thredded_topic_categories_on_topic_id" end - create_table "thredded_topics", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "last_user_id" - t.string "title", limit: 255, null: false - t.string "slug", limit: 191, null: false - t.integer "messageboard_id", null: false - t.integer "posts_count", default: 0, null: false - t.boolean "sticky", default: false, null: false - t.boolean "locked", default: false, null: false - t.string "hash_id", limit: 191, null: false - t.string "type", limit: 191 - t.integer "moderation_state", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index "to_tsvector('english'::regconfig, (title)::text)", name: "thredded_topics_title_fts", using: :gist - t.index ["hash_id"], name: "index_thredded_topics_on_hash_id" - t.index ["hash_id"], name: "index_thredded_topics_on_hash_id" - t.index ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true - t.index ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true - t.index ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id" - t.index ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id" - t.index ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: { sticky: :desc, updated_at: :desc } - t.index ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: { sticky: :desc, updated_at: :desc } - t.index ["user_id"], name: "index_thredded_topics_on_user_id" - t.index ["user_id"], name: "index_thredded_topics_on_user_id" - end - - create_table "thredded_topics", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.integer "last_user_id" - t.string "title", limit: 255, null: false - t.string "slug", limit: 191, null: false - t.integer "messageboard_id", null: false - t.integer "posts_count", default: 0, null: false - t.boolean "sticky", default: false, null: false - t.boolean "locked", default: false, null: false - t.string "hash_id", limit: 191, null: false - t.string "type", limit: 191 - t.integer "moderation_state", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index "to_tsvector('english'::regconfig, (title)::text)", name: "thredded_topics_title_fts", using: :gist - t.index ["hash_id"], name: "index_thredded_topics_on_hash_id" - t.index ["hash_id"], name: "index_thredded_topics_on_hash_id" - t.index ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true - t.index ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true - t.index ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id" - t.index ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id" - t.index ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: { sticky: :desc, updated_at: :desc } - t.index ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: { sticky: :desc, updated_at: :desc } - t.index ["user_id"], name: "index_thredded_topics_on_user_id" - t.index ["user_id"], name: "index_thredded_topics_on_user_id" - end - - create_table "thredded_user_details", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false + add_index "thredded_topic_categories", ["category_id"], name: "index_thredded_topic_categories_on_category_id", using: :btree + add_index "thredded_topic_categories", ["topic_id"], name: "index_thredded_topic_categories_on_topic_id", using: :btree + + create_table "thredded_topics", force: :cascade do |t| + t.integer "user_id" + t.integer "last_user_id" + t.string "title", limit: 255, null: false + t.string "slug", limit: 191, null: false + t.integer "messageboard_id", null: false + t.integer "posts_count", default: 0, null: false + t.boolean "sticky", default: false, null: false + t.boolean "locked", default: false, null: false + t.string "hash_id", limit: 191, null: false + t.string "type", limit: 191 + t.integer "moderation_state", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "thredded_topics", ["hash_id"], name: "index_thredded_topics_on_hash_id", using: :btree + add_index "thredded_topics", ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true, using: :btree + add_index "thredded_topics", ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id", using: :btree + add_index "thredded_topics", ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: {"sticky"=>:desc, "updated_at"=>:desc}, using: :btree + add_index "thredded_topics", ["user_id"], name: "index_thredded_topics_on_user_id", using: :btree + + create_table "thredded_user_details", force: :cascade do |t| + t.integer "user_id", null: false t.datetime "latest_activity_at" - t.integer "posts_count", default: 0 - t.integer "topics_count", default: 0 + t.integer "posts_count", default: 0 + t.integer "topics_count", default: 0 t.datetime "last_seen_at" - t.integer "moderation_state", default: 1, null: false + t.integer "moderation_state", default: 1, null: false t.datetime "moderation_state_changed_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at" - t.index ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at" - t.index ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: { moderation_state_changed_at: :desc } - t.index ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: { moderation_state_changed_at: :desc } - t.index ["user_id"], name: "index_thredded_user_details_on_user_id" - t.index ["user_id"], name: "index_thredded_user_details_on_user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "thredded_user_details", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false - t.datetime "latest_activity_at" - t.integer "posts_count", default: 0 - t.integer "topics_count", default: 0 - t.datetime "last_seen_at" - t.integer "moderation_state", default: 1, null: false - t.datetime "moderation_state_changed_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at" - t.index ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at" - t.index ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: { moderation_state_changed_at: :desc } - t.index ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: { moderation_state_changed_at: :desc } - t.index ["user_id"], name: "index_thredded_user_details_on_user_id" - t.index ["user_id"], name: "index_thredded_user_details_on_user_id" - end - - create_table "thredded_user_messageboard_preferences", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false - t.integer "messageboard_id", null: false - t.boolean "notify_on_mention", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true - t.index ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true - end + add_index "thredded_user_details", ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at", using: :btree + add_index "thredded_user_details", ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: {"moderation_state_changed_at"=>:desc}, using: :btree + add_index "thredded_user_details", ["user_id"], name: "index_thredded_user_details_on_user_id", using: :btree - create_table "thredded_user_messageboard_preferences", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false - t.integer "messageboard_id", null: false - t.boolean "notify_on_mention", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true - t.index ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true + create_table "thredded_user_messageboard_preferences", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "messageboard_id", null: false + t.boolean "notify_on_mention", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "thredded_user_preferences", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false - t.boolean "notify_on_mention", default: true, null: false - t.boolean "notify_on_message", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["user_id"], name: "index_thredded_user_preferences_on_user_id" - t.index ["user_id"], name: "index_thredded_user_preferences_on_user_id" - end + add_index "thredded_user_messageboard_preferences", ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true, using: :btree - create_table "thredded_user_preferences", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false - t.boolean "notify_on_mention", default: true, null: false - t.boolean "notify_on_message", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["user_id"], name: "index_thredded_user_preferences_on_user_id" - t.index ["user_id"], name: "index_thredded_user_preferences_on_user_id" + create_table "thredded_user_preferences", force: :cascade do |t| + t.integer "user_id", null: false + t.boolean "notify_on_mention", default: true, null: false + t.boolean "notify_on_message", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "thredded_user_private_topic_read_states", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false - t.integer "postable_id", null: false - t.integer "page", default: 1, null: false - t.datetime "read_at", null: false - t.index ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true - t.index ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true - end + add_index "thredded_user_preferences", ["user_id"], name: "index_thredded_user_preferences_on_user_id", using: :btree - create_table "thredded_user_private_topic_read_states", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false - t.integer "postable_id", null: false - t.integer "page", default: 1, null: false - t.datetime "read_at", null: false - t.index ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true - t.index ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true + create_table "thredded_user_private_topic_read_states", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "postable_id", null: false + t.integer "page", default: 1, null: false + t.datetime "read_at", null: false end - create_table "thredded_user_topic_follows", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false - t.integer "topic_id", null: false - t.datetime "created_at", null: false - t.integer "reason", limit: 2 - t.index ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true - t.index ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true - end + add_index "thredded_user_private_topic_read_states", ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true, using: :btree - create_table "thredded_user_topic_follows", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false - t.integer "topic_id", null: false - t.datetime "created_at", null: false - t.integer "reason", limit: 2 - t.index ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true - t.index ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true + create_table "thredded_user_topic_follows", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "topic_id", null: false + t.datetime "created_at", null: false + t.integer "reason", limit: 2 end - create_table "thredded_user_topic_read_states", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false - t.integer "postable_id", null: false - t.integer "page", default: 1, null: false - t.datetime "read_at", null: false - t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true - t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true - end + add_index "thredded_user_topic_follows", ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true, using: :btree - create_table "thredded_user_topic_read_states", id: :serial, force: :cascade do |t| - t.integer "user_id", null: false - t.integer "postable_id", null: false - t.integer "page", default: 1, null: false - t.datetime "read_at", null: false - t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true - t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true + create_table "thredded_user_topic_read_states", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "postable_id", null: false + t.integer "page", default: 1, null: false + t.datetime "read_at", null: false end - create_table "townships", id: :serial, force: :cascade do |t| - t.string "name" - t.integer "state_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["state_id"], name: "index_townships_on_state_id" - t.index ["state_id"], name: "index_townships_on_state_id" - end + add_index "thredded_user_topic_read_states", ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true, using: :btree - create_table "townships", id: :serial, force: :cascade do |t| - t.string "name" - t.integer "state_id" + create_table "townships", force: :cascade do |t| + t.string "name" + t.integer "state_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["state_id"], name: "index_townships_on_state_id" - t.index ["state_id"], name: "index_townships_on_state_id" end - create_table "trackings", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.jsonb "fields", default: {} - t.string "frequency", default: "" - t.integer "time_of_frequency" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "deleted_at" - t.index ["deleted_at"], name: "index_trackings_on_deleted_at" - t.index ["deleted_at"], name: "index_trackings_on_deleted_at" - t.index ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true - t.index ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true - t.index ["program_stream_id"], name: "index_trackings_on_program_stream_id" - t.index ["program_stream_id"], name: "index_trackings_on_program_stream_id" - end - - create_table "trackings", id: :serial, force: :cascade do |t| - t.string "name", default: "" - t.jsonb "fields", default: {} - t.string "frequency", default: "" - t.integer "time_of_frequency" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + add_index "townships", ["state_id"], name: "index_townships_on_state_id", using: :btree + + create_table "trackings", force: :cascade do |t| + t.string "name", default: "" + t.jsonb "fields", default: {} + t.string "frequency", default: "" + t.integer "time_of_frequency" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.datetime "deleted_at" - t.index ["deleted_at"], name: "index_trackings_on_deleted_at" - t.index ["deleted_at"], name: "index_trackings_on_deleted_at" - t.index ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true - t.index ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true - t.index ["program_stream_id"], name: "index_trackings_on_program_stream_id" - t.index ["program_stream_id"], name: "index_trackings_on_program_stream_id" - end - - create_table "users", id: :serial, force: :cascade do |t| - t.string "first_name", default: "" - t.string "last_name", default: "" - t.string "roles", default: "case worker" - t.date "start_date" - t.string "job_title", default: "" - t.string "mobile", default: "" - t.date "date_of_birth" - t.boolean "archived", default: false - t.integer "province_id" - t.integer "department_id" + end + + add_index "trackings", ["deleted_at"], name: "index_trackings_on_deleted_at", using: :btree + add_index "trackings", ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true, using: :btree + add_index "trackings", ["program_stream_id"], name: "index_trackings_on_program_stream_id", using: :btree + + create_table "users", force: :cascade do |t| + t.string "first_name", default: "" + t.string "last_name", default: "" + t.string "roles", default: "case worker" + t.date "start_date" + t.string "job_title", default: "" + t.string "mobile", default: "" + t.date "date_of_birth" + t.boolean "archived", default: false + t.integer "province_id" + t.integer "department_id" t.datetime "created_at" t.datetime "updated_at" - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.inet "current_sign_in_ip" - t.inet "last_sign_in_ip" - t.integer "clients_count", default: 0 - t.integer "cases_count", default: 0 - t.integer "tasks_count", default: 0 - t.string "provider", default: "email", null: false - t.string "uid", default: "", null: false - t.json "tokens" - t.boolean "admin", default: false - t.integer "changelogs_count", default: 0 - t.integer "organization_id" - t.boolean "disable", default: false + t.inet "current_sign_in_ip" + t.inet "last_sign_in_ip" + t.integer "clients_count", default: 0 + t.integer "cases_count", default: 0 + t.integer "tasks_count", default: 0 + t.string "provider", default: "email", null: false + t.string "uid", default: "", null: false + t.json "tokens" + t.boolean "admin", default: false + t.integer "changelogs_count", default: 0 + t.integer "organization_id" + t.boolean "disable", default: false t.datetime "expires_at" - t.boolean "task_notify", default: true - t.integer "manager_id" - t.boolean "calendar_integration", default: false - t.integer "pin_number" - t.integer "manager_ids", default: [], array: true - t.boolean "program_warning", default: false - t.boolean "staff_performance_notification", default: true - t.string "pin_code", default: "" - t.boolean "domain_warning", default: false - t.boolean "referral_notification", default: false - t.string "gender", default: "" - t.boolean "enable_gov_log_in", default: false - t.boolean "enable_research_log_in", default: false - t.datetime "deleted_at" + t.boolean "task_notify", default: true + t.integer "manager_id" + t.boolean "calendar_integration", default: false + t.integer "pin_number" + t.integer "manager_ids", default: [], array: true + t.boolean "program_warning", default: false + t.boolean "staff_performance_notification", default: true + t.string "pin_code", default: "" + t.boolean "domain_warning", default: false + t.boolean "referral_notification", default: false + t.string "gender", default: "" + t.boolean "enable_gov_log_in", default: false + t.boolean "enable_research_log_in", default: false t.datetime "activated_at" t.datetime "deactivated_at" - t.string "preferred_language", default: "en" - t.string "organization_name" - t.string "profile" - t.index "lower((email)::text) text_pattern_ops", name: "users_email_lower", unique: true - t.index ["deleted_at"], name: "index_users_on_deleted_at" - t.index ["deleted_at"], name: "index_users_on_deleted_at" - t.index ["email"], name: "index_users_on_email", unique: true - t.index ["email"], name: "index_users_on_email", unique: true - t.index ["organization_id"], name: "index_users_on_organization_id" - t.index ["organization_id"], name: "index_users_on_organization_id" - t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true - t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true - end - - create_table "users", id: :serial, force: :cascade do |t| - t.string "first_name", default: "" - t.string "last_name", default: "" - t.string "roles", default: "case worker" - t.date "start_date" - t.string "job_title", default: "" - t.string "mobile", default: "" - t.date "date_of_birth" - t.boolean "archived", default: false - t.integer "province_id" - t.integer "department_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.inet "current_sign_in_ip" - t.inet "last_sign_in_ip" - t.integer "clients_count", default: 0 - t.integer "cases_count", default: 0 - t.integer "tasks_count", default: 0 - t.string "provider", default: "email", null: false - t.string "uid", default: "", null: false - t.json "tokens" - t.boolean "admin", default: false - t.integer "changelogs_count", default: 0 - t.integer "organization_id" - t.boolean "disable", default: false - t.datetime "expires_at" - t.boolean "task_notify", default: true - t.integer "manager_id" - t.boolean "calendar_integration", default: false - t.integer "pin_number" - t.integer "manager_ids", default: [], array: true - t.boolean "program_warning", default: false - t.boolean "staff_performance_notification", default: true - t.string "pin_code", default: "" - t.boolean "domain_warning", default: false - t.boolean "referral_notification", default: false - t.string "gender", default: "" - t.boolean "enable_gov_log_in", default: false - t.boolean "enable_research_log_in", default: false t.datetime "deleted_at" - t.datetime "activated_at" - t.datetime "deactivated_at" - t.string "preferred_language", default: "en" - t.string "organization_name" - t.string "profile" - t.index "lower((email)::text) text_pattern_ops", name: "users_email_lower", unique: true - t.index ["deleted_at"], name: "index_users_on_deleted_at" - t.index ["deleted_at"], name: "index_users_on_deleted_at" - t.index ["email"], name: "index_users_on_email", unique: true - t.index ["email"], name: "index_users_on_email", unique: true - t.index ["organization_id"], name: "index_users_on_organization_id" - t.index ["organization_id"], name: "index_users_on_organization_id" - t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true - t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true - end - - create_table "version_associations", id: :serial, force: :cascade do |t| - t.integer "version_id" - t.string "foreign_key_name", null: false - t.integer "foreign_key_id" - t.string "foreign_type" - t.index ["foreign_key_name", "foreign_key_id", "foreign_type"], name: "index_version_associations_on_foreign_key" - t.index ["version_id"], name: "index_version_associations_on_version_id" - t.index ["version_id"], name: "index_version_associations_on_version_id" + t.string "preferred_language", default: "en" + t.string "organization_name" + t.string "profile" end - create_table "version_associations", id: :serial, force: :cascade do |t| + add_index "users", ["deleted_at"], name: "index_users_on_deleted_at", using: :btree + add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree + add_index "users", ["organization_id"], name: "index_users_on_organization_id", using: :btree + add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree + + create_table "version_associations", force: :cascade do |t| t.integer "version_id" - t.string "foreign_key_name", null: false + t.string "foreign_key_name", null: false t.integer "foreign_key_id" - t.string "foreign_type" - t.index ["foreign_key_name", "foreign_key_id", "foreign_type"], name: "index_version_associations_on_foreign_key" - t.index ["version_id"], name: "index_version_associations_on_version_id" - t.index ["version_id"], name: "index_version_associations_on_version_id" - end - - create_table "versions", id: :serial, force: :cascade do |t| - t.string "item_type", null: false - t.integer "item_id", null: false - t.string "event", null: false - t.string "whodunnit" - t.text "object" - t.datetime "created_at" - t.text "object_changes" - t.integer "transaction_id" - t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" - t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" - t.index ["transaction_id"], name: "index_versions_on_transaction_id" - t.index ["transaction_id"], name: "index_versions_on_transaction_id" - end - - create_table "versions", id: :serial, force: :cascade do |t| - t.string "item_type", null: false - t.integer "item_id", null: false - t.string "event", null: false - t.string "whodunnit" - t.text "object" - t.datetime "created_at" - t.text "object_changes" - t.integer "transaction_id" - t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" - t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" - t.index ["transaction_id"], name: "index_versions_on_transaction_id" - t.index ["transaction_id"], name: "index_versions_on_transaction_id" - end - - create_table "villages", id: :serial, force: :cascade do |t| - t.string "code", default: "" - t.string "name_kh", default: "" - t.string "name_en", default: "" - t.integer "commune_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["commune_id"], name: "index_villages_on_commune_id" - t.index ["commune_id"], name: "index_villages_on_commune_id" end - create_table "villages", id: :serial, force: :cascade do |t| - t.string "code", default: "" - t.string "name_kh", default: "" - t.string "name_en", default: "" - t.integer "commune_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["commune_id"], name: "index_villages_on_commune_id" - t.index ["commune_id"], name: "index_villages_on_commune_id" - end + add_index "version_associations", ["foreign_key_name", "foreign_key_id"], name: "index_version_associations_on_foreign_key", using: :btree + add_index "version_associations", ["version_id"], name: "index_version_associations_on_version_id", using: :btree - create_table "visit_clients", id: :serial, force: :cascade do |t| - t.integer "user_id" + create_table "versions", force: :cascade do |t| + t.string "item_type", null: false + t.integer "item_id", null: false + t.string "event", null: false + t.string "whodunnit" + t.text "object" t.datetime "created_at" - t.datetime "updated_at" - t.time "deleted_at" - t.index ["user_id"], name: "index_visit_clients_on_user_id" - t.index ["user_id"], name: "index_visit_clients_on_user_id" + t.text "object_changes" + t.integer "transaction_id" end - create_table "visit_clients", id: :serial, force: :cascade do |t| - t.integer "user_id" + add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree + add_index "versions", ["transaction_id"], name: "index_versions_on_transaction_id", using: :btree + + create_table "villages", force: :cascade do |t| + t.string "code", default: "" + t.string "name_kh", default: "" + t.string "name_en", default: "" + t.integer "commune_id" t.datetime "created_at" t.datetime "updated_at" - t.time "deleted_at" - t.index ["user_id"], name: "index_visit_clients_on_user_id" - t.index ["user_id"], name: "index_visit_clients_on_user_id" end - create_table "visits", id: :serial, force: :cascade do |t| - t.integer "user_id" + add_index "villages", ["commune_id"], name: "index_villages_on_commune_id", using: :btree + + create_table "visit_clients", force: :cascade do |t| + t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.time "deleted_at" - t.index ["user_id"], name: "index_visits_on_user_id" - t.index ["user_id"], name: "index_visits_on_user_id" + t.time "deleted_at" end - create_table "visits", id: :serial, force: :cascade do |t| - t.integer "user_id" + add_index "visit_clients", ["user_id"], name: "index_visit_clients_on_user_id", using: :btree + + create_table "visits", force: :cascade do |t| + t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.time "deleted_at" - t.index ["user_id"], name: "index_visits_on_user_id" - t.index ["user_id"], name: "index_visits_on_user_id" + t.time "deleted_at" end - add_foreign_key "able_screening_questions", "public.question_groups", column: "question_group_id" - add_foreign_key "able_screening_questions", "public.stages", column: "stage_id" - add_foreign_key "able_screening_questions", "question_groups" - add_foreign_key "able_screening_questions", "stages" - add_foreign_key "able_screening_questions", "public.question_groups", column: "question_group_id" - add_foreign_key "able_screening_questions", "public.stages", column: "stage_id" + add_index "visits", ["user_id"], name: "index_visits_on_user_id", using: :btree + add_foreign_key "able_screening_questions", "question_groups" add_foreign_key "able_screening_questions", "stages" add_foreign_key "action_results", "government_forms" - add_foreign_key "action_results", "public.government_forms", column: "government_form_id" - add_foreign_key "action_results", "government_forms" - add_foreign_key "action_results", "public.government_forms", column: "government_form_id" - add_foreign_key "advanced_searches", "public.users", column: "user_id" add_foreign_key "advanced_searches", "users" - add_foreign_key "advanced_searches", "public.users", column: "user_id" - add_foreign_key "advanced_searches", "users" - add_foreign_key "assessments", "clients" - add_foreign_key "assessments", "public.clients", column: "client_id" add_foreign_key "assessments", "clients" - add_foreign_key "assessments", "public.clients", column: "client_id" - add_foreign_key "attachments", "able_screening_questions" - add_foreign_key "attachments", "progress_notes" - add_foreign_key "attachments", "public.able_screening_questions", column: "able_screening_question_id" - add_foreign_key "attachments", "public.progress_notes", column: "progress_note_id" add_foreign_key "attachments", "able_screening_questions" add_foreign_key "attachments", "progress_notes" - add_foreign_key "attachments", "public.able_screening_questions", column: "able_screening_question_id" - add_foreign_key "attachments", "public.progress_notes", column: "progress_note_id" - add_foreign_key "calendars", "public.users", column: "user_id" add_foreign_key "calendars", "users" - add_foreign_key "calendars", "public.users", column: "user_id" - add_foreign_key "calendars", "users" - add_foreign_key "call_necessities", "calls" - add_foreign_key "call_necessities", "necessities" - add_foreign_key "call_necessities", "public.calls", column: "call_id" - add_foreign_key "call_necessities", "public.necessities", column: "necessity_id" add_foreign_key "call_necessities", "calls" add_foreign_key "call_necessities", "necessities" - add_foreign_key "call_necessities", "public.calls", column: "call_id" - add_foreign_key "call_necessities", "public.necessities", column: "necessity_id" - add_foreign_key "call_protection_concerns", "calls" - add_foreign_key "call_protection_concerns", "protection_concerns" - add_foreign_key "call_protection_concerns", "public.calls", column: "call_id" - add_foreign_key "call_protection_concerns", "public.protection_concerns", column: "protection_concern_id" add_foreign_key "call_protection_concerns", "calls" add_foreign_key "call_protection_concerns", "protection_concerns" - add_foreign_key "call_protection_concerns", "public.calls", column: "call_id" - add_foreign_key "call_protection_concerns", "public.protection_concerns", column: "protection_concern_id" - add_foreign_key "calls", "public.referees", column: "referee_id" - add_foreign_key "calls", "referees" - add_foreign_key "calls", "public.referees", column: "referee_id" add_foreign_key "calls", "referees" add_foreign_key "carers", "communes" add_foreign_key "carers", "districts" add_foreign_key "carers", "provinces" - add_foreign_key "carers", "public.communes", column: "commune_id" - add_foreign_key "carers", "public.districts", column: "district_id" - add_foreign_key "carers", "public.provinces", column: "province_id" - add_foreign_key "carers", "public.states", column: "state_id" - add_foreign_key "carers", "public.subdistricts", column: "subdistrict_id" - add_foreign_key "carers", "public.townships", column: "township_id" - add_foreign_key "carers", "public.villages", column: "village_id" - add_foreign_key "carers", "states" - add_foreign_key "carers", "subdistricts" - add_foreign_key "carers", "townships" - add_foreign_key "carers", "villages" - add_foreign_key "carers", "communes" - add_foreign_key "carers", "districts" - add_foreign_key "carers", "provinces" - add_foreign_key "carers", "public.communes", column: "commune_id" - add_foreign_key "carers", "public.districts", column: "district_id" - add_foreign_key "carers", "public.provinces", column: "province_id" - add_foreign_key "carers", "public.states", column: "state_id" - add_foreign_key "carers", "public.subdistricts", column: "subdistrict_id" - add_foreign_key "carers", "public.townships", column: "township_id" - add_foreign_key "carers", "public.villages", column: "village_id" add_foreign_key "carers", "states" add_foreign_key "carers", "subdistricts" add_foreign_key "carers", "townships" add_foreign_key "carers", "villages" add_foreign_key "case_contracts", "cases" - add_foreign_key "case_contracts", "public.cases", column: "case_id" - add_foreign_key "case_contracts", "cases" - add_foreign_key "case_contracts", "public.cases", column: "case_id" - add_foreign_key "case_notes", "clients" - add_foreign_key "case_notes", "custom_assessment_settings" - add_foreign_key "case_notes", "public.clients", column: "client_id" - add_foreign_key "case_notes", "public.custom_assessment_settings", column: "custom_assessment_setting_id" add_foreign_key "case_notes", "clients" add_foreign_key "case_notes", "custom_assessment_settings" - add_foreign_key "case_notes", "public.clients", column: "client_id" - add_foreign_key "case_notes", "public.custom_assessment_settings", column: "custom_assessment_setting_id" add_foreign_key "case_worker_clients", "clients" - add_foreign_key "case_worker_clients", "public.clients", column: "client_id" - add_foreign_key "case_worker_clients", "public.users", column: "user_id" add_foreign_key "case_worker_clients", "users" - add_foreign_key "case_worker_clients", "clients" - add_foreign_key "case_worker_clients", "public.clients", column: "client_id" - add_foreign_key "case_worker_clients", "public.users", column: "user_id" - add_foreign_key "case_worker_clients", "users" - add_foreign_key "case_worker_tasks", "public.tasks", column: "task_id" - add_foreign_key "case_worker_tasks", "public.users", column: "user_id" - add_foreign_key "case_worker_tasks", "tasks" - add_foreign_key "case_worker_tasks", "users" - add_foreign_key "case_worker_tasks", "public.tasks", column: "task_id" - add_foreign_key "case_worker_tasks", "public.users", column: "user_id" add_foreign_key "case_worker_tasks", "tasks" add_foreign_key "case_worker_tasks", "users" add_foreign_key "changelog_types", "changelogs" - add_foreign_key "changelog_types", "public.changelogs", column: "changelog_id" - add_foreign_key "changelog_types", "changelogs" - add_foreign_key "changelog_types", "public.changelogs", column: "changelog_id" - add_foreign_key "changelogs", "public.users", column: "user_id" - add_foreign_key "changelogs", "users" - add_foreign_key "changelogs", "public.users", column: "user_id" add_foreign_key "changelogs", "users" add_foreign_key "client_client_types", "client_types" add_foreign_key "client_client_types", "clients" - add_foreign_key "client_client_types", "public.client_types", column: "client_type_id" - add_foreign_key "client_client_types", "public.clients", column: "client_id" - add_foreign_key "client_client_types", "client_types" - add_foreign_key "client_client_types", "clients" - add_foreign_key "client_client_types", "public.client_types", column: "client_type_id" - add_foreign_key "client_client_types", "public.clients", column: "client_id" add_foreign_key "client_enrollment_trackings", "client_enrollments" - add_foreign_key "client_enrollment_trackings", "public.client_enrollments", column: "client_enrollment_id" - add_foreign_key "client_enrollment_trackings", "client_enrollments" - add_foreign_key "client_enrollment_trackings", "public.client_enrollments", column: "client_enrollment_id" - add_foreign_key "client_enrollments", "clients" - add_foreign_key "client_enrollments", "program_streams" - add_foreign_key "client_enrollments", "public.clients", column: "client_id" - add_foreign_key "client_enrollments", "public.program_streams", column: "program_stream_id" add_foreign_key "client_enrollments", "clients" add_foreign_key "client_enrollments", "program_streams" - add_foreign_key "client_enrollments", "public.clients", column: "client_id" - add_foreign_key "client_enrollments", "public.program_streams", column: "program_stream_id" - add_foreign_key "client_interviewees", "clients" - add_foreign_key "client_interviewees", "interviewees" - add_foreign_key "client_interviewees", "public.clients", column: "client_id" - add_foreign_key "client_interviewees", "public.interviewees", column: "interviewee_id" add_foreign_key "client_interviewees", "clients" add_foreign_key "client_interviewees", "interviewees" - add_foreign_key "client_interviewees", "public.clients", column: "client_id" - add_foreign_key "client_interviewees", "public.interviewees", column: "interviewee_id" - add_foreign_key "client_needs", "clients" - add_foreign_key "client_needs", "needs" - add_foreign_key "client_needs", "public.clients", column: "client_id" - add_foreign_key "client_needs", "public.needs", column: "need_id" add_foreign_key "client_needs", "clients" add_foreign_key "client_needs", "needs" - add_foreign_key "client_needs", "public.clients", column: "client_id" - add_foreign_key "client_needs", "public.needs", column: "need_id" - add_foreign_key "client_problems", "clients" - add_foreign_key "client_problems", "problems" - add_foreign_key "client_problems", "public.clients", column: "client_id" - add_foreign_key "client_problems", "public.problems", column: "problem_id" add_foreign_key "client_problems", "clients" add_foreign_key "client_problems", "problems" - add_foreign_key "client_problems", "public.clients", column: "client_id" - add_foreign_key "client_problems", "public.problems", column: "problem_id" - add_foreign_key "client_right_government_forms", "client_rights" - add_foreign_key "client_right_government_forms", "government_forms" - add_foreign_key "client_right_government_forms", "public.client_rights", column: "client_right_id" - add_foreign_key "client_right_government_forms", "public.government_forms", column: "government_form_id" add_foreign_key "client_right_government_forms", "client_rights" add_foreign_key "client_right_government_forms", "government_forms" - add_foreign_key "client_right_government_forms", "public.client_rights", column: "client_right_id" - add_foreign_key "client_right_government_forms", "public.government_forms", column: "government_form_id" - add_foreign_key "client_type_government_forms", "client_types" - add_foreign_key "client_type_government_forms", "government_forms" - add_foreign_key "client_type_government_forms", "public.client_types", column: "client_type_id" - add_foreign_key "client_type_government_forms", "public.government_forms", column: "government_form_id" add_foreign_key "client_type_government_forms", "client_types" add_foreign_key "client_type_government_forms", "government_forms" - add_foreign_key "client_type_government_forms", "public.client_types", column: "client_type_id" - add_foreign_key "client_type_government_forms", "public.government_forms", column: "government_form_id" - add_foreign_key "clients", "communes" - add_foreign_key "clients", "districts" - add_foreign_key "clients", "donors" - add_foreign_key "clients", "public.communes", column: "commune_id" - add_foreign_key "clients", "public.districts", column: "district_id" - add_foreign_key "clients", "public.donors", column: "donor_id" - add_foreign_key "clients", "public.states", column: "state_id" - add_foreign_key "clients", "public.subdistricts", column: "subdistrict_id" - add_foreign_key "clients", "public.townships", column: "township_id" - add_foreign_key "clients", "public.villages", column: "village_id" - add_foreign_key "clients", "states" - add_foreign_key "clients", "subdistricts" - add_foreign_key "clients", "townships" - add_foreign_key "clients", "villages" add_foreign_key "clients", "communes" add_foreign_key "clients", "districts" add_foreign_key "clients", "donors" - add_foreign_key "clients", "public.communes", column: "commune_id" - add_foreign_key "clients", "public.districts", column: "district_id" - add_foreign_key "clients", "public.donors", column: "donor_id" - add_foreign_key "clients", "public.states", column: "state_id" - add_foreign_key "clients", "public.subdistricts", column: "subdistrict_id" - add_foreign_key "clients", "public.townships", column: "township_id" - add_foreign_key "clients", "public.villages", column: "village_id" add_foreign_key "clients", "states" add_foreign_key "clients", "subdistricts" add_foreign_key "clients", "townships" add_foreign_key "clients", "villages" add_foreign_key "communes", "districts" - add_foreign_key "communes", "public.districts", column: "district_id" - add_foreign_key "communes", "districts" - add_foreign_key "communes", "public.districts", column: "district_id" - add_foreign_key "custom_field_permissions", "custom_fields" - add_foreign_key "custom_field_permissions", "public.custom_fields", column: "custom_field_id" - add_foreign_key "custom_field_permissions", "public.users", column: "user_id" - add_foreign_key "custom_field_permissions", "users" add_foreign_key "custom_field_permissions", "custom_fields" - add_foreign_key "custom_field_permissions", "public.custom_fields", column: "custom_field_id" - add_foreign_key "custom_field_permissions", "public.users", column: "user_id" add_foreign_key "custom_field_permissions", "users" add_foreign_key "custom_field_properties", "custom_fields" - add_foreign_key "custom_field_properties", "public.custom_fields", column: "custom_field_id" - add_foreign_key "custom_field_properties", "custom_fields" - add_foreign_key "custom_field_properties", "public.custom_fields", column: "custom_field_id" add_foreign_key "districts", "provinces" - add_foreign_key "districts", "public.provinces", column: "province_id" - add_foreign_key "districts", "provinces" - add_foreign_key "districts", "public.provinces", column: "province_id" - add_foreign_key "domains", "domain_groups" - add_foreign_key "domains", "public.domain_groups", column: "domain_group_id" add_foreign_key "domains", "domain_groups" - add_foreign_key "domains", "public.domain_groups", column: "domain_group_id" - add_foreign_key "donor_organizations", "donors" - add_foreign_key "donor_organizations", "organizations" - add_foreign_key "donor_organizations", "public.donors", column: "donor_id" - add_foreign_key "donor_organizations", "public.organizations", column: "organization_id" add_foreign_key "donor_organizations", "donors" add_foreign_key "donor_organizations", "organizations" - add_foreign_key "donor_organizations", "public.donors", column: "donor_id" - add_foreign_key "donor_organizations", "public.organizations", column: "organization_id" add_foreign_key "enrollment_trackings", "enrollments" - add_foreign_key "enrollment_trackings", "public.enrollments", column: "enrollment_id" - add_foreign_key "enrollment_trackings", "public.trackings", column: "tracking_id" - add_foreign_key "enrollment_trackings", "trackings" - add_foreign_key "enrollment_trackings", "enrollments" - add_foreign_key "enrollment_trackings", "public.enrollments", column: "enrollment_id" - add_foreign_key "enrollment_trackings", "public.trackings", column: "tracking_id" add_foreign_key "enrollment_trackings", "trackings" add_foreign_key "enrollments", "program_streams" - add_foreign_key "enrollments", "public.program_streams", column: "program_stream_id" - add_foreign_key "enrollments", "program_streams" - add_foreign_key "enrollments", "public.program_streams", column: "program_stream_id" - add_foreign_key "enter_ngo_users", "enter_ngos" - add_foreign_key "enter_ngo_users", "public.enter_ngos", column: "enter_ngo_id" - add_foreign_key "enter_ngo_users", "public.users", column: "user_id" - add_foreign_key "enter_ngo_users", "users" add_foreign_key "enter_ngo_users", "enter_ngos" - add_foreign_key "enter_ngo_users", "public.enter_ngos", column: "enter_ngo_id" - add_foreign_key "enter_ngo_users", "public.users", column: "user_id" add_foreign_key "enter_ngo_users", "users" add_foreign_key "enter_ngos", "clients" - add_foreign_key "enter_ngos", "public.clients", column: "client_id" - add_foreign_key "enter_ngos", "clients" - add_foreign_key "enter_ngos", "public.clients", column: "client_id" add_foreign_key "exit_ngos", "clients" - add_foreign_key "exit_ngos", "public.clients", column: "client_id" - add_foreign_key "exit_ngos", "clients" - add_foreign_key "exit_ngos", "public.clients", column: "client_id" - add_foreign_key "external_system_global_identities", "external_systems" - add_foreign_key "external_system_global_identities", "public.external_systems", column: "external_system_id" - add_foreign_key "external_system_global_identities", "public.global_identities", column: "global_id", primary_key: "ulid" add_foreign_key "external_system_global_identities", "external_systems" - add_foreign_key "external_system_global_identities", "public.external_systems", column: "external_system_id" - add_foreign_key "external_system_global_identities", "public.global_identities", column: "global_id", primary_key: "ulid" add_foreign_key "families", "communes" add_foreign_key "families", "districts" - add_foreign_key "families", "public.communes", column: "commune_id" - add_foreign_key "families", "public.districts", column: "district_id" - add_foreign_key "families", "public.users", column: "user_id" - add_foreign_key "families", "public.villages", column: "village_id" - add_foreign_key "families", "users" - add_foreign_key "families", "villages" - add_foreign_key "families", "communes" - add_foreign_key "families", "districts" - add_foreign_key "families", "public.communes", column: "commune_id" - add_foreign_key "families", "public.districts", column: "district_id" - add_foreign_key "families", "public.users", column: "user_id" - add_foreign_key "families", "public.villages", column: "village_id" add_foreign_key "families", "users" add_foreign_key "families", "villages" add_foreign_key "family_members", "families" - add_foreign_key "family_members", "public.families", column: "family_id" - add_foreign_key "family_members", "families" - add_foreign_key "family_members", "public.families", column: "family_id" - add_foreign_key "family_referrals", "families" - add_foreign_key "family_referrals", "public.families", column: "family_id" - add_foreign_key "family_referrals", "families" - add_foreign_key "family_referrals", "public.families", column: "family_id" - add_foreign_key "global_identity_organizations", "organizations" - add_foreign_key "global_identity_organizations", "public.organizations", column: "organization_id" add_foreign_key "global_identity_organizations", "organizations" - add_foreign_key "global_identity_organizations", "public.organizations", column: "organization_id" - add_foreign_key "government_form_children_plans", "children_plans" - add_foreign_key "government_form_children_plans", "government_forms" - add_foreign_key "government_form_children_plans", "public.children_plans", column: "children_plan_id" - add_foreign_key "government_form_children_plans", "public.government_forms", column: "government_form_id" add_foreign_key "government_form_children_plans", "children_plans" add_foreign_key "government_form_children_plans", "government_forms" - add_foreign_key "government_form_children_plans", "public.children_plans", column: "children_plan_id" - add_foreign_key "government_form_children_plans", "public.government_forms", column: "government_form_id" add_foreign_key "government_form_family_plans", "family_plans" add_foreign_key "government_form_family_plans", "government_forms" - add_foreign_key "government_form_family_plans", "public.family_plans", column: "family_plan_id" - add_foreign_key "government_form_family_plans", "public.government_forms", column: "government_form_id" - add_foreign_key "government_form_family_plans", "family_plans" - add_foreign_key "government_form_family_plans", "government_forms" - add_foreign_key "government_form_family_plans", "public.family_plans", column: "family_plan_id" - add_foreign_key "government_form_family_plans", "public.government_forms", column: "government_form_id" - add_foreign_key "government_form_interviewees", "government_forms" - add_foreign_key "government_form_interviewees", "interviewees" - add_foreign_key "government_form_interviewees", "public.government_forms", column: "government_form_id" - add_foreign_key "government_form_interviewees", "public.interviewees", column: "interviewee_id" add_foreign_key "government_form_interviewees", "government_forms" add_foreign_key "government_form_interviewees", "interviewees" - add_foreign_key "government_form_interviewees", "public.government_forms", column: "government_form_id" - add_foreign_key "government_form_interviewees", "public.interviewees", column: "interviewee_id" add_foreign_key "government_form_needs", "government_forms" add_foreign_key "government_form_needs", "needs" - add_foreign_key "government_form_needs", "public.government_forms", column: "government_form_id" - add_foreign_key "government_form_needs", "public.needs", column: "need_id" - add_foreign_key "government_form_needs", "government_forms" - add_foreign_key "government_form_needs", "needs" - add_foreign_key "government_form_needs", "public.government_forms", column: "government_form_id" - add_foreign_key "government_form_needs", "public.needs", column: "need_id" - add_foreign_key "government_form_problems", "government_forms" - add_foreign_key "government_form_problems", "problems" - add_foreign_key "government_form_problems", "public.government_forms", column: "government_form_id" - add_foreign_key "government_form_problems", "public.problems", column: "problem_id" add_foreign_key "government_form_problems", "government_forms" add_foreign_key "government_form_problems", "problems" - add_foreign_key "government_form_problems", "public.government_forms", column: "government_form_id" - add_foreign_key "government_form_problems", "public.problems", column: "problem_id" add_foreign_key "government_form_service_types", "government_forms" - add_foreign_key "government_form_service_types", "public.government_forms", column: "government_form_id" - add_foreign_key "government_form_service_types", "public.service_types", column: "service_type_id" add_foreign_key "government_form_service_types", "service_types" - add_foreign_key "government_form_service_types", "government_forms" - add_foreign_key "government_form_service_types", "public.government_forms", column: "government_form_id" - add_foreign_key "government_form_service_types", "public.service_types", column: "service_type_id" - add_foreign_key "government_form_service_types", "service_types" - add_foreign_key "government_forms", "clients" - add_foreign_key "government_forms", "communes" - add_foreign_key "government_forms", "districts" - add_foreign_key "government_forms", "provinces" - add_foreign_key "government_forms", "public.clients", column: "client_id" - add_foreign_key "government_forms", "public.communes", column: "commune_id" - add_foreign_key "government_forms", "public.districts", column: "district_id" - add_foreign_key "government_forms", "public.provinces", column: "province_id" - add_foreign_key "government_forms", "public.villages", column: "village_id" - add_foreign_key "government_forms", "villages" add_foreign_key "government_forms", "clients" add_foreign_key "government_forms", "communes" add_foreign_key "government_forms", "districts" add_foreign_key "government_forms", "provinces" - add_foreign_key "government_forms", "public.clients", column: "client_id" - add_foreign_key "government_forms", "public.communes", column: "commune_id" - add_foreign_key "government_forms", "public.districts", column: "district_id" - add_foreign_key "government_forms", "public.provinces", column: "province_id" - add_foreign_key "government_forms", "public.villages", column: "village_id" add_foreign_key "government_forms", "villages" add_foreign_key "hotlines", "calls" add_foreign_key "hotlines", "clients" - add_foreign_key "hotlines", "public.calls", column: "call_id" - add_foreign_key "hotlines", "public.clients", column: "client_id" - add_foreign_key "hotlines", "calls" - add_foreign_key "hotlines", "clients" - add_foreign_key "hotlines", "public.calls", column: "call_id" - add_foreign_key "hotlines", "public.clients", column: "client_id" - add_foreign_key "leave_programs", "client_enrollments" - add_foreign_key "leave_programs", "enrollments" - add_foreign_key "leave_programs", "public.client_enrollments", column: "client_enrollment_id" - add_foreign_key "leave_programs", "public.enrollments", column: "enrollment_id" add_foreign_key "leave_programs", "client_enrollments" add_foreign_key "leave_programs", "enrollments" - add_foreign_key "leave_programs", "public.client_enrollments", column: "client_enrollment_id" - add_foreign_key "leave_programs", "public.enrollments", column: "enrollment_id" - add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id" - add_foreign_key "oauth_access_grants", "public.oauth_applications", column: "application_id" add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id" - add_foreign_key "oauth_access_grants", "public.oauth_applications", column: "application_id" add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id" - add_foreign_key "oauth_access_tokens", "public.oauth_applications", column: "application_id" - add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id" - add_foreign_key "oauth_access_tokens", "public.oauth_applications", column: "application_id" - add_foreign_key "partners", "organization_types" - add_foreign_key "partners", "public.organization_types", column: "organization_type_id" add_foreign_key "partners", "organization_types" - add_foreign_key "partners", "public.organization_types", column: "organization_type_id" - add_foreign_key "program_stream_permissions", "program_streams" - add_foreign_key "program_stream_permissions", "public.program_streams", column: "program_stream_id" - add_foreign_key "program_stream_permissions", "public.users", column: "user_id" - add_foreign_key "program_stream_permissions", "users" add_foreign_key "program_stream_permissions", "program_streams" - add_foreign_key "program_stream_permissions", "public.program_streams", column: "program_stream_id" - add_foreign_key "program_stream_permissions", "public.users", column: "user_id" add_foreign_key "program_stream_permissions", "users" add_foreign_key "program_stream_services", "program_streams" - add_foreign_key "program_stream_services", "public.program_streams", column: "program_stream_id" - add_foreign_key "program_stream_services", "public.services", column: "service_id" add_foreign_key "program_stream_services", "services" - add_foreign_key "program_stream_services", "program_streams" - add_foreign_key "program_stream_services", "public.program_streams", column: "program_stream_id" - add_foreign_key "program_stream_services", "public.services", column: "service_id" - add_foreign_key "program_stream_services", "services" - add_foreign_key "progress_notes", "clients" - add_foreign_key "progress_notes", "locations" - add_foreign_key "progress_notes", "materials" - add_foreign_key "progress_notes", "progress_note_types" - add_foreign_key "progress_notes", "public.clients", column: "client_id" - add_foreign_key "progress_notes", "public.locations", column: "location_id" - add_foreign_key "progress_notes", "public.materials", column: "material_id" - add_foreign_key "progress_notes", "public.progress_note_types", column: "progress_note_type_id" - add_foreign_key "progress_notes", "public.users", column: "user_id" - add_foreign_key "progress_notes", "users" add_foreign_key "progress_notes", "clients" add_foreign_key "progress_notes", "locations" add_foreign_key "progress_notes", "materials" add_foreign_key "progress_notes", "progress_note_types" - add_foreign_key "progress_notes", "public.clients", column: "client_id" - add_foreign_key "progress_notes", "public.locations", column: "location_id" - add_foreign_key "progress_notes", "public.materials", column: "material_id" - add_foreign_key "progress_notes", "public.progress_note_types", column: "progress_note_type_id" - add_foreign_key "progress_notes", "public.users", column: "user_id" add_foreign_key "progress_notes", "users" - add_foreign_key "quantitative_type_permissions", "public.quantitative_types", column: "quantitative_type_id" - add_foreign_key "quantitative_type_permissions", "public.users", column: "user_id" - add_foreign_key "quantitative_type_permissions", "quantitative_types" - add_foreign_key "quantitative_type_permissions", "users" - add_foreign_key "quantitative_type_permissions", "public.quantitative_types", column: "quantitative_type_id" - add_foreign_key "quantitative_type_permissions", "public.users", column: "user_id" add_foreign_key "quantitative_type_permissions", "quantitative_types" add_foreign_key "quantitative_type_permissions", "users" add_foreign_key "quarterly_reports", "cases" - add_foreign_key "quarterly_reports", "public.cases", column: "case_id" - add_foreign_key "quarterly_reports", "cases" - add_foreign_key "quarterly_reports", "public.cases", column: "case_id" - add_foreign_key "referees", "communes" - add_foreign_key "referees", "districts" - add_foreign_key "referees", "provinces" - add_foreign_key "referees", "public.communes", column: "commune_id" - add_foreign_key "referees", "public.districts", column: "district_id" - add_foreign_key "referees", "public.provinces", column: "province_id" - add_foreign_key "referees", "public.states", column: "state_id" - add_foreign_key "referees", "public.subdistricts", column: "subdistrict_id" - add_foreign_key "referees", "public.townships", column: "township_id" - add_foreign_key "referees", "public.villages", column: "village_id" - add_foreign_key "referees", "states" - add_foreign_key "referees", "subdistricts" - add_foreign_key "referees", "townships" - add_foreign_key "referees", "villages" add_foreign_key "referees", "communes" add_foreign_key "referees", "districts" add_foreign_key "referees", "provinces" - add_foreign_key "referees", "public.communes", column: "commune_id" - add_foreign_key "referees", "public.districts", column: "district_id" - add_foreign_key "referees", "public.provinces", column: "province_id" - add_foreign_key "referees", "public.states", column: "state_id" - add_foreign_key "referees", "public.subdistricts", column: "subdistrict_id" - add_foreign_key "referees", "public.townships", column: "township_id" - add_foreign_key "referees", "public.villages", column: "village_id" add_foreign_key "referees", "states" add_foreign_key "referees", "subdistricts" add_foreign_key "referees", "townships" add_foreign_key "referees", "villages" add_foreign_key "referrals", "clients" - add_foreign_key "referrals", "public.clients", column: "client_id" - add_foreign_key "referrals", "clients" - add_foreign_key "referrals", "public.clients", column: "client_id" - add_foreign_key "services", "public.global_services", column: "uuid", primary_key: "uuid" - add_foreign_key "services", "public.global_services", column: "uuid", primary_key: "uuid" - add_foreign_key "services", "public.global_services", column: "uuid", primary_key: "uuid" - add_foreign_key "services", "public.global_services", column: "uuid", primary_key: "uuid" - add_foreign_key "settings", "communes" - add_foreign_key "settings", "districts" - add_foreign_key "settings", "provinces" - add_foreign_key "settings", "public.communes", column: "commune_id" - add_foreign_key "settings", "public.districts", column: "district_id" - add_foreign_key "settings", "public.provinces", column: "province_id" + add_foreign_key "services", "global_services", column: "uuid", primary_key: "uuid" add_foreign_key "settings", "communes" add_foreign_key "settings", "districts" add_foreign_key "settings", "provinces" - add_foreign_key "settings", "public.communes", column: "commune_id" - add_foreign_key "settings", "public.districts", column: "district_id" - add_foreign_key "settings", "public.provinces", column: "province_id" - add_foreign_key "sponsors", "clients" - add_foreign_key "sponsors", "donors" - add_foreign_key "sponsors", "public.clients", column: "client_id" - add_foreign_key "sponsors", "public.donors", column: "donor_id" add_foreign_key "sponsors", "clients" add_foreign_key "sponsors", "donors" - add_foreign_key "sponsors", "public.clients", column: "client_id" - add_foreign_key "sponsors", "public.donors", column: "donor_id" - add_foreign_key "subdistricts", "districts" - add_foreign_key "subdistricts", "public.districts", column: "district_id" add_foreign_key "subdistricts", "districts" - add_foreign_key "subdistricts", "public.districts", column: "district_id" add_foreign_key "surveys", "clients" - add_foreign_key "surveys", "public.clients", column: "client_id" - add_foreign_key "surveys", "clients" - add_foreign_key "surveys", "public.clients", column: "client_id" - add_foreign_key "tasks", "clients", on_delete: :nullify - add_foreign_key "tasks", "public.clients", column: "client_id", on_delete: :nullify add_foreign_key "tasks", "clients", on_delete: :nullify - add_foreign_key "tasks", "public.clients", column: "client_id", on_delete: :nullify - add_foreign_key "townships", "public.states", column: "state_id" add_foreign_key "townships", "states" - add_foreign_key "townships", "public.states", column: "state_id" - add_foreign_key "townships", "states" - add_foreign_key "trackings", "program_streams" - add_foreign_key "trackings", "public.program_streams", column: "program_stream_id" add_foreign_key "trackings", "program_streams" - add_foreign_key "trackings", "public.program_streams", column: "program_stream_id" add_foreign_key "users", "organizations" - add_foreign_key "users", "public.organizations", column: "organization_id" - add_foreign_key "users", "organizations" - add_foreign_key "users", "public.organizations", column: "organization_id" - add_foreign_key "villages", "communes" - add_foreign_key "villages", "public.communes", column: "commune_id" add_foreign_key "villages", "communes" - add_foreign_key "villages", "public.communes", column: "commune_id" - add_foreign_key "visit_clients", "public.users", column: "user_id" add_foreign_key "visit_clients", "users" - add_foreign_key "visit_clients", "public.users", column: "user_id" - add_foreign_key "visit_clients", "users" - add_foreign_key "visits", "public.users", column: "user_id" - add_foreign_key "visits", "users" - add_foreign_key "visits", "public.users", column: "user_id" add_foreign_key "visits", "users" end From 64ba56fbdc48c1d121c2ddbdd8db9a658a363481 Mon Sep 17 00:00:00 2001 From: kirykr Date: Fri, 18 Dec 2020 16:10:59 +0700 Subject: [PATCH 12/27] clearn up schema with fresh new database --- db/schema.rb | 3005 ++++++++++++++++++++++++-------------------------- 1 file changed, 1449 insertions(+), 1556 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index ab9169e7ee..78910a472a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,1654 +10,1576 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20201203072103) do +ActiveRecord::Schema.define(version: 2020_12_14_014711) do # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" enable_extension "hstore" enable_extension "pgcrypto" + enable_extension "plpgsql" enable_extension "uuid-ossp" create_table "able_screening_questions", force: :cascade do |t| - t.string "question" - t.string "mode" - t.integer "stage_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "alert_manager" - t.integer "question_group_id" + t.string "question" + t.string "mode" + t.integer "stage_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "alert_manager" + t.integer "question_group_id" + t.index ["question_group_id"], name: "index_able_screening_questions_on_question_group_id" + t.index ["stage_id"], name: "index_able_screening_questions_on_stage_id" end - add_index "able_screening_questions", ["question_group_id"], name: "index_able_screening_questions_on_question_group_id", using: :btree - add_index "able_screening_questions", ["stage_id"], name: "index_able_screening_questions_on_stage_id", using: :btree - create_table "action_results", force: :cascade do |t| - t.text "action", default: "" - t.text "result", default: "" - t.integer "government_form_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.text "action", default: "" + t.text "result", default: "" + t.integer "government_form_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["government_form_id"], name: "index_action_results_on_government_form_id" end - add_index "action_results", ["government_form_id"], name: "index_action_results_on_government_form_id", using: :btree - create_table "admin_users", force: :cascade do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "token" - t.string "first_name" - t.string "last_name" - t.string "provider", default: "email", null: false - t.string "uid", default: "", null: false - t.json "tokens" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "token" + t.string "first_name" + t.string "last_name" + t.string "provider", default: "email", null: false + t.string "uid", default: "", null: false + t.json "tokens" + t.index ["email"], name: "index_admin_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true + t.index ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true end - add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true, using: :btree - add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree - add_index "admin_users", ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true, using: :btree - create_table "advanced_searches", force: :cascade do |t| - t.string "name" - t.text "description" - t.jsonb "queries" - t.jsonb "field_visible" - t.string "custom_forms" - t.string "program_streams" - t.string "enrollment_check", default: "" - t.string "tracking_check", default: "" - t.string "exit_form_check", default: "" - t.string "quantitative_check", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "user_id" - t.string "hotline_check", default: "" - end - - add_index "advanced_searches", ["user_id"], name: "index_advanced_searches_on_user_id", using: :btree + t.string "name" + t.text "description" + t.jsonb "queries" + t.jsonb "field_visible" + t.string "custom_forms" + t.string "program_streams" + t.string "enrollment_check", default: "" + t.string "tracking_check", default: "" + t.string "exit_form_check", default: "" + t.string "quantitative_check", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "user_id" + t.string "hotline_check", default: "" + t.index ["user_id"], name: "index_advanced_searches_on_user_id" + end create_table "agencies", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" + t.string "name", default: "" + t.text "description", default: "" t.datetime "created_at" t.datetime "updated_at" - t.integer "agencies_clients_count", default: 0 + t.integer "agencies_clients_count", default: 0 end create_table "agencies_clients", force: :cascade do |t| - t.integer "client_id" - t.integer "agency_id" + t.integer "client_id" + t.integer "agency_id" t.datetime "created_at" t.datetime "updated_at" end create_table "agency_clients", force: :cascade do |t| - t.integer "agency_id" - t.integer "client_id" + t.integer "agency_id" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "ar_internal_metadata", primary_key: "key", force: :cascade do |t| - t.string "value" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - end - create_table "assessment_domains", force: :cascade do |t| - t.text "note", default: "" - t.integer "previous_score" - t.integer "score" - t.text "reason", default: "" - t.integer "assessment_id" - t.integer "domain_id" + t.text "note", default: "" + t.integer "previous_score" + t.integer "score" + t.text "reason", default: "" + t.integer "assessment_id" + t.integer "domain_id" t.datetime "created_at" t.datetime "updated_at" - t.text "goal", default: "" - t.string "attachments", default: [], array: true - t.boolean "goal_required", default: true - t.boolean "required_task_last", default: false + t.text "goal", default: "" + t.string "attachments", default: [], array: true + t.boolean "goal_required", default: true + t.boolean "required_task_last", default: false + t.index ["score"], name: "index_assessment_domains_on_score" end - add_index "assessment_domains", ["score"], name: "index_assessment_domains_on_score", using: :btree - create_table "assessments", force: :cascade do |t| t.datetime "created_at" t.datetime "updated_at" - t.integer "client_id" - t.boolean "completed", default: false - t.boolean "default", default: true + t.integer "client_id" + t.boolean "completed", default: false + t.boolean "default", default: true + t.index ["client_id"], name: "index_assessments_on_client_id" end - add_index "assessments", ["client_id"], name: "index_assessments_on_client_id", using: :btree - create_table "attachments", force: :cascade do |t| - t.string "image" - t.integer "able_screening_question_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "file", default: "" - t.integer "progress_note_id" + t.string "image" + t.integer "able_screening_question_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "file", default: "" + t.integer "progress_note_id" + t.index ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id" + t.index ["progress_note_id"], name: "index_attachments_on_progress_note_id" end - add_index "attachments", ["able_screening_question_id"], name: "index_attachments_on_able_screening_question_id", using: :btree - add_index "attachments", ["progress_note_id"], name: "index_attachments_on_progress_note_id", using: :btree - create_table "calendars", force: :cascade do |t| - t.string "title" + t.string "title" t.datetime "start_date" t.datetime "end_date" - t.boolean "sync_status", default: false - t.integer "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.boolean "sync_status", default: false + t.integer "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_calendars_on_user_id" end - add_index "calendars", ["user_id"], name: "index_calendars_on_user_id", using: :btree - create_table "call_necessities", force: :cascade do |t| - t.integer "call_id" - t.integer "necessity_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "call_id" + t.integer "necessity_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["call_id"], name: "index_call_necessities_on_call_id" + t.index ["necessity_id"], name: "index_call_necessities_on_necessity_id" end - add_index "call_necessities", ["call_id"], name: "index_call_necessities_on_call_id", using: :btree - add_index "call_necessities", ["necessity_id"], name: "index_call_necessities_on_necessity_id", using: :btree - create_table "call_protection_concerns", force: :cascade do |t| - t.integer "call_id" - t.integer "protection_concern_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "call_id" + t.integer "protection_concern_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["call_id"], name: "index_call_protection_concerns_on_call_id" + t.index ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id" end - add_index "call_protection_concerns", ["call_id"], name: "index_call_protection_concerns_on_call_id", using: :btree - add_index "call_protection_concerns", ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id", using: :btree - create_table "calls", force: :cascade do |t| - t.integer "referee_id" - t.string "phone_call_id", default: "" - t.integer "receiving_staff_id" + t.integer "referee_id" + t.string "phone_call_id", default: "" + t.integer "receiving_staff_id" t.datetime "start_datetime" - t.string "call_type", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "information_provided", default: "" - t.date "date_of_call" - t.boolean "answered_call" - t.boolean "called_before" - t.boolean "requested_update", default: false - t.boolean "not_a_phone_call", default: false - t.boolean "childsafe_agent" - t.string "other_more_information", default: "" - t.string "brief_note_summary", default: "" - end - - add_index "calls", ["referee_id"], name: "index_calls_on_referee_id", using: :btree + t.string "call_type", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "information_provided", default: "" + t.date "date_of_call" + t.boolean "answered_call" + t.boolean "called_before" + t.boolean "requested_update", default: false + t.boolean "not_a_phone_call", default: false + t.boolean "childsafe_agent" + t.string "other_more_information", default: "" + t.string "brief_note_summary", default: "" + t.index ["referee_id"], name: "index_calls_on_referee_id" + end create_table "carers", force: :cascade do |t| - t.string "address_type", default: "" - t.string "current_address", default: "" - t.string "email", default: "" - t.string "gender", default: "" - t.string "house_number", default: "" - t.string "outside_address", default: "" - t.string "street_number", default: "" - t.string "client_relationship", default: "" - t.boolean "outside", default: false - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name", default: "" - t.string "phone", default: "" - t.boolean "same_as_client", default: false - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "state_id" - t.integer "township_id" - t.integer "subdistrict_id" - t.string "locality" - end - - add_index "carers", ["commune_id"], name: "index_carers_on_commune_id", using: :btree - add_index "carers", ["district_id"], name: "index_carers_on_district_id", using: :btree - add_index "carers", ["province_id"], name: "index_carers_on_province_id", using: :btree - add_index "carers", ["state_id"], name: "index_carers_on_state_id", using: :btree - add_index "carers", ["subdistrict_id"], name: "index_carers_on_subdistrict_id", using: :btree - add_index "carers", ["township_id"], name: "index_carers_on_township_id", using: :btree - add_index "carers", ["village_id"], name: "index_carers_on_village_id", using: :btree + t.string "address_type", default: "" + t.string "current_address", default: "" + t.string "email", default: "" + t.string "gender", default: "" + t.string "house_number", default: "" + t.string "outside_address", default: "" + t.string "street_number", default: "" + t.string "client_relationship", default: "" + t.boolean "outside", default: false + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name", default: "" + t.string "phone", default: "" + t.boolean "same_as_client", default: false + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "state_id" + t.integer "township_id" + t.integer "subdistrict_id" + t.string "locality" + t.index ["commune_id"], name: "index_carers_on_commune_id" + t.index ["district_id"], name: "index_carers_on_district_id" + t.index ["province_id"], name: "index_carers_on_province_id" + t.index ["state_id"], name: "index_carers_on_state_id" + t.index ["subdistrict_id"], name: "index_carers_on_subdistrict_id" + t.index ["township_id"], name: "index_carers_on_township_id" + t.index ["village_id"], name: "index_carers_on_village_id" + end create_table "case_closures", force: :cascade do |t| - t.string "name" + t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "case_contracts", force: :cascade do |t| - t.date "signed_on" - t.integer "case_id" + t.date "signed_on" + t.integer "case_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["case_id"], name: "index_case_contracts_on_case_id" end - add_index "case_contracts", ["case_id"], name: "index_case_contracts_on_case_id", using: :btree - create_table "case_note_domain_groups", force: :cascade do |t| - t.text "note", default: "" - t.integer "case_note_id" - t.integer "domain_group_id" + t.text "note", default: "" + t.integer "case_note_id" + t.integer "domain_group_id" t.datetime "created_at" t.datetime "updated_at" - t.string "attachments", default: [], array: true + t.string "attachments", default: [], array: true end create_table "case_notes", force: :cascade do |t| - t.string "attendee", default: "" + t.string "attendee", default: "" t.datetime "meeting_date" - t.integer "assessment_id" + t.integer "assessment_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "client_id" - t.string "interaction_type", default: "" - t.boolean "custom", default: false - t.text "note", default: "" - t.integer "custom_assessment_setting_id" - t.string "selected_domain_group_ids", default: [], array: true + t.integer "client_id" + t.string "interaction_type", default: "" + t.boolean "custom", default: false + t.text "note", default: "" + t.integer "custom_assessment_setting_id" + t.string "selected_domain_group_ids", default: [], array: true + t.index ["client_id"], name: "index_case_notes_on_client_id" + t.index ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id" end - add_index "case_notes", ["client_id"], name: "index_case_notes_on_client_id", using: :btree - add_index "case_notes", ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id", using: :btree - create_table "case_worker_clients", force: :cascade do |t| - t.integer "user_id" - t.integer "client_id" + t.integer "user_id" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_case_worker_clients_on_client_id" + t.index ["user_id"], name: "index_case_worker_clients_on_user_id" end - add_index "case_worker_clients", ["client_id"], name: "index_case_worker_clients_on_client_id", using: :btree - add_index "case_worker_clients", ["user_id"], name: "index_case_worker_clients_on_user_id", using: :btree - create_table "case_worker_tasks", force: :cascade do |t| - t.integer "user_id" - t.integer "task_id" + t.integer "user_id" + t.integer "task_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["task_id"], name: "index_case_worker_tasks_on_task_id" + t.index ["user_id"], name: "index_case_worker_tasks_on_user_id" end - add_index "case_worker_tasks", ["task_id"], name: "index_case_worker_tasks_on_task_id", using: :btree - add_index "case_worker_tasks", ["user_id"], name: "index_case_worker_tasks_on_user_id", using: :btree - create_table "cases", force: :cascade do |t| - t.date "start_date" - t.string "carer_names", default: "" - t.string "carer_address", default: "" - t.string "carer_phone_number", default: "" - t.float "support_amount", default: 0.0 - t.text "support_note", default: "" - t.text "case_type", default: "EC" - t.boolean "exited", default: false - t.date "exit_date" - t.text "exit_note", default: "" - t.integer "user_id" - t.integer "client_id" - t.integer "family_id" - t.integer "partner_id" - t.integer "province_id" + t.date "start_date" + t.string "carer_names", default: "" + t.string "carer_address", default: "" + t.string "carer_phone_number", default: "" + t.float "support_amount", default: 0.0 + t.text "support_note", default: "" + t.text "case_type", default: "EC" + t.boolean "exited", default: false + t.date "exit_date" + t.text "exit_note", default: "" + t.integer "user_id" + t.integer "client_id" + t.integer "family_id" + t.integer "partner_id" + t.integer "province_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "family_preservation", default: false - t.string "status", default: "" - t.date "placement_date" - t.date "initial_assessment_date" - t.float "case_length" - t.date "case_conference_date" - t.float "time_in_care" - t.boolean "exited_from_cif", default: false - t.boolean "current", default: true + t.boolean "family_preservation", default: false + t.string "status", default: "" + t.date "placement_date" + t.date "initial_assessment_date" + t.float "case_length" + t.date "case_conference_date" + t.float "time_in_care" + t.boolean "exited_from_cif", default: false + t.boolean "current", default: true t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_cases_on_deleted_at" end - add_index "cases", ["deleted_at"], name: "index_cases_on_deleted_at", using: :btree - create_table "changelog_types", force: :cascade do |t| - t.integer "changelog_id" - t.string "change_type", default: "" - t.string "description", default: "" + t.integer "changelog_id" + t.string "change_type", default: "" + t.string "description", default: "" t.datetime "created_at" t.datetime "updated_at" + t.index ["changelog_id"], name: "index_changelog_types_on_changelog_id" end - add_index "changelog_types", ["changelog_id"], name: "index_changelog_types_on_changelog_id", using: :btree - create_table "changelogs", force: :cascade do |t| - t.string "change_version", default: "" - t.string "description", default: "" - t.integer "user_id" + t.string "change_version", default: "" + t.string "description", default: "" + t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["user_id"], name: "index_changelogs_on_user_id" end - add_index "changelogs", ["user_id"], name: "index_changelogs_on_user_id", using: :btree - create_table "children_plans", force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "client_client_types", force: :cascade do |t| - t.integer "client_id" - t.integer "client_type_id" + t.integer "client_id" + t.integer "client_type_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_client_client_types_on_client_id" + t.index ["client_type_id"], name: "index_client_client_types_on_client_type_id" end - add_index "client_client_types", ["client_id"], name: "index_client_client_types_on_client_id", using: :btree - add_index "client_client_types", ["client_type_id"], name: "index_client_client_types_on_client_type_id", using: :btree - create_table "client_enrollment_trackings", force: :cascade do |t| - t.jsonb "properties", default: {} - t.integer "client_enrollment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "tracking_id" + t.jsonb "properties", default: {} + t.integer "client_enrollment_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "tracking_id" + t.index ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id" end - add_index "client_enrollment_trackings", ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id", using: :btree - create_table "client_enrollments", force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "status", default: "Active" - t.integer "client_id" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.date "enrollment_date" + t.jsonb "properties", default: {} + t.string "status", default: "Active" + t.integer "client_id" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.date "enrollment_date" t.datetime "deleted_at" + t.index ["client_id"], name: "index_client_enrollments_on_client_id" + t.index ["deleted_at"], name: "index_client_enrollments_on_deleted_at" + t.index ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id" end - add_index "client_enrollments", ["client_id"], name: "index_client_enrollments_on_client_id", using: :btree - add_index "client_enrollments", ["deleted_at"], name: "index_client_enrollments_on_deleted_at", using: :btree - add_index "client_enrollments", ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id", using: :btree - create_table "client_interviewees", force: :cascade do |t| - t.integer "client_id" - t.integer "interviewee_id" + t.integer "client_id" + t.integer "interviewee_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_client_interviewees_on_client_id" + t.index ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id" end - add_index "client_interviewees", ["client_id"], name: "index_client_interviewees_on_client_id", using: :btree - add_index "client_interviewees", ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id", using: :btree - create_table "client_needs", force: :cascade do |t| - t.integer "rank" - t.integer "client_id" - t.integer "need_id" + t.integer "rank" + t.integer "client_id" + t.integer "need_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_client_needs_on_client_id" + t.index ["need_id"], name: "index_client_needs_on_need_id" end - add_index "client_needs", ["client_id"], name: "index_client_needs_on_client_id", using: :btree - add_index "client_needs", ["need_id"], name: "index_client_needs_on_need_id", using: :btree - create_table "client_problems", force: :cascade do |t| - t.integer "rank" - t.integer "client_id" - t.integer "problem_id" + t.integer "rank" + t.integer "client_id" + t.integer "problem_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_client_problems_on_client_id" + t.index ["problem_id"], name: "index_client_problems_on_problem_id" end - add_index "client_problems", ["client_id"], name: "index_client_problems_on_client_id", using: :btree - add_index "client_problems", ["problem_id"], name: "index_client_problems_on_problem_id", using: :btree - create_table "client_quantitative_cases", force: :cascade do |t| - t.integer "quantitative_case_id" - t.integer "client_id" + t.integer "quantitative_case_id" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" end create_table "client_right_government_forms", force: :cascade do |t| - t.integer "government_form_id" - t.integer "client_right_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "government_form_id" + t.integer "client_right_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id" + t.index ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id" end - add_index "client_right_government_forms", ["client_right_id"], name: "index_client_right_government_forms_on_client_right_id", using: :btree - add_index "client_right_government_forms", ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id", using: :btree - create_table "client_rights", force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "client_type_government_forms", force: :cascade do |t| - t.integer "client_type_id" - t.integer "government_form_id" + t.integer "client_type_id" + t.integer "government_form_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id" + t.index ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id" end - add_index "client_type_government_forms", ["client_type_id"], name: "index_client_type_government_forms_on_client_type_id", using: :btree - add_index "client_type_government_forms", ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id", using: :btree - create_table "client_types", force: :cascade do |t| - t.string "name", default: "" + t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" end create_table "clients", force: :cascade do |t| - t.string "code", default: "" - t.string "given_name", default: "" - t.string "family_name", default: "" - t.string "gender", default: "" - t.date "date_of_birth" - t.string "status", default: "Referred" - t.date "initial_referral_date" - t.string "referral_phone", default: "" - t.integer "birth_province_id" - t.integer "received_by_id" - t.integer "followed_up_by_id" - t.date "follow_up_date" - t.string "current_address", default: "" - t.string "school_name", default: "" - t.string "school_grade", default: "" - t.boolean "has_been_in_orphanage" - t.boolean "able", default: false - t.boolean "has_been_in_government_care" - t.text "relevant_referral_information", default: "" - t.string "archive_state", default: "" - t.text "rejected_note", default: "" - t.integer "province_id" - t.integer "referral_source_id" - t.integer "user_id" + t.string "code", default: "" + t.string "given_name", default: "" + t.string "family_name", default: "" + t.string "gender", default: "" + t.date "date_of_birth" + t.string "status", default: "Referred" + t.date "initial_referral_date" + t.string "referral_phone", default: "" + t.integer "birth_province_id" + t.integer "received_by_id" + t.integer "followed_up_by_id" + t.date "follow_up_date" + t.string "current_address", default: "" + t.string "school_name", default: "" + t.string "school_grade", default: "" + t.boolean "has_been_in_orphanage" + t.boolean "able", default: false + t.boolean "has_been_in_government_care" + t.text "relevant_referral_information", default: "" + t.string "archive_state", default: "" + t.text "rejected_note", default: "" + t.integer "province_id" + t.integer "referral_source_id" + t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "completed", default: false - t.text "reason_for_referral", default: "" - t.boolean "is_receiving_additional_benefits", default: false - t.text "background", default: "" - t.integer "grade" - t.string "slug" - t.string "able_state", default: "" - t.integer "donor_id" - t.string "local_given_name", default: "" - t.string "local_family_name", default: "" - t.string "kid_id", default: "" - t.string "house_number", default: "" - t.string "street_number", default: "" - t.string "old_village", default: "" - t.string "old_commune", default: "" - t.string "archive_district", default: "" - t.string "live_with", default: "" - t.integer "id_poor" - t.integer "rice_support", default: 0 - t.text "exit_note", default: "" - t.date "exit_date" - t.date "accepted_date" - t.string "gov_city", default: "" - t.string "gov_commune", default: "" - t.string "gov_district", default: "" - t.date "gov_date" - t.string "gov_village_code", default: "" - t.string "gov_client_code", default: "" - t.string "gov_interview_village", default: "" - t.string "gov_interview_commune", default: "" - t.string "gov_interview_district", default: "" - t.string "gov_interview_city", default: "" - t.string "gov_caseworker_name", default: "" - t.string "gov_caseworker_phone", default: "" - t.string "gov_carer_name", default: "" - t.string "gov_carer_relationship", default: "" - t.string "gov_carer_home", default: "" - t.string "gov_carer_street", default: "" - t.string "gov_carer_village", default: "" - t.string "gov_carer_commune", default: "" - t.string "gov_carer_district", default: "" - t.string "gov_carer_city", default: "" - t.string "gov_carer_phone", default: "" - t.string "gov_information_source", default: "" - t.text "gov_referral_reason", default: "" - t.text "gov_guardian_comment", default: "" - t.text "gov_caseworker_comment", default: "" - t.integer "district_id" - t.string "telephone_number", default: "" - t.string "name_of_referee", default: "" - t.string "main_school_contact", default: "" - t.string "rated_for_id_poor", default: "" - t.string "what3words", default: "" - t.string "exit_reasons", default: [], array: true - t.string "exit_circumstance", default: "" - t.string "other_info_of_exit", default: "" - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "subdistrict_id" - t.integer "township_id" - t.integer "state_id" - t.string "country_origin", default: "" - t.integer "commune_id" - t.integer "village_id" - t.string "profile" - t.integer "referral_source_category_id" - t.string "archived_slug" - t.integer "assessments_count", default: 0, null: false - t.integer "current_family_id" - t.boolean "outside", default: false - t.string "outside_address", default: "" - t.string "address_type", default: "" - t.string "client_phone", default: "" - t.string "phone_owner", default: "" - t.string "client_email", default: "" - t.string "referee_relationship", default: "" - t.integer "referee_id" - t.integer "carer_id" - t.string "nickname", default: "" - t.string "relation_to_referee", default: "" - t.boolean "concern_is_outside", default: false - t.string "concern_outside_address", default: "" - t.integer "concern_province_id" - t.integer "concern_district_id" - t.integer "concern_commune_id" - t.integer "concern_village_id" - t.string "concern_street", default: "" - t.string "concern_house", default: "" - t.string "concern_address", default: "" - t.string "concern_address_type", default: "" - t.string "concern_phone", default: "" - t.string "concern_phone_owner", default: "" - t.string "concern_email", default: "" - t.string "concern_email_owner", default: "" - t.string "concern_location", default: "" - t.boolean "concern_same_as_client", default: false - t.string "location_description", default: "" - t.string "phone_counselling_summary", default: "" - t.string "presented_id" - t.string "id_number" - t.string "other_phone_number" - t.string "brsc_branch" - t.string "current_island" - t.string "current_street" - t.string "current_po_box" - t.string "current_city" - t.string "current_settlement" - t.string "current_resident_own_or_rent" - t.string "current_household_type" - t.string "island2" - t.string "street2" - t.string "po_box2" - t.string "city2" - t.string "settlement2" - t.string "resident_own_or_rent2" - t.string "household_type2" - t.string "legacy_brcs_id" - t.boolean "whatsapp", default: false - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - t.boolean "other_phone_whatsapp", default: false - t.string "preferred_language", default: "English" - t.boolean "national_id", default: false, null: false - t.boolean "birth_cert", default: false, null: false - t.boolean "family_book", default: false, null: false - t.boolean "passport", default: false, null: false - t.boolean "travel_doc", default: false, null: false - t.boolean "referral_doc", default: false, null: false - t.boolean "local_consent", default: false, null: false - t.boolean "police_interview", default: false, null: false - t.boolean "other_legal_doc", default: false, null: false - t.string "national_id_files", default: [], array: true - t.string "birth_cert_files", default: [], array: true - t.string "family_book_files", default: [], array: true - t.string "passport_files", default: [], array: true - t.string "travel_doc_files", default: [], array: true - t.string "referral_doc_files", default: [], array: true - t.string "local_consent_files", default: [], array: true - t.string "police_interview_files", default: [], array: true - t.string "other_legal_doc_files", default: [], array: true - t.string "global_id" - t.boolean "referred_external", default: false - t.string "marital_status" - t.string "nationality" - t.string "ethnicity" - t.string "location_of_concern" - t.string "type_of_trafficking" - t.text "education_background" - t.string "department" - t.string "neighbor_name" - t.string "neighbor_phone" - t.string "dosavy_name" - t.string "dosavy_phone" - t.string "chief_commune_name" - t.string "chief_commune_phone" - t.string "chief_village_name" - t.string "chief_village_phone" - t.string "ccwc_name" - t.string "ccwc_phone" - t.string "legal_team_name" - t.string "legal_representative_name" - t.string "legal_team_phone" - t.string "other_agency_name" - t.string "other_representative_name" - t.string "other_agency_phone" - t.string "locality" - t.string "national_id_number" - t.string "passport_number" - end - - add_index "clients", ["commune_id"], name: "index_clients_on_commune_id", using: :btree - add_index "clients", ["current_family_id"], name: "index_clients_on_current_family_id", using: :btree - add_index "clients", ["district_id"], name: "index_clients_on_district_id", using: :btree - add_index "clients", ["donor_id"], name: "index_clients_on_donor_id", using: :btree - add_index "clients", ["external_id"], name: "index_clients_on_external_id", using: :btree - add_index "clients", ["global_id"], name: "index_clients_on_global_id", using: :btree - add_index "clients", ["mosvy_number"], name: "index_clients_on_mosvy_number", using: :btree - add_index "clients", ["slug"], name: "index_clients_on_slug", unique: true, using: :btree - add_index "clients", ["state_id"], name: "index_clients_on_state_id", using: :btree - add_index "clients", ["subdistrict_id"], name: "index_clients_on_subdistrict_id", using: :btree - add_index "clients", ["township_id"], name: "index_clients_on_township_id", using: :btree - add_index "clients", ["village_id"], name: "index_clients_on_village_id", using: :btree + t.boolean "completed", default: false + t.text "reason_for_referral", default: "" + t.boolean "is_receiving_additional_benefits", default: false + t.text "background", default: "" + t.integer "grade" + t.string "slug" + t.string "able_state", default: "" + t.integer "donor_id" + t.string "local_given_name", default: "" + t.string "local_family_name", default: "" + t.string "kid_id", default: "" + t.string "house_number", default: "" + t.string "street_number", default: "" + t.string "old_village", default: "" + t.string "old_commune", default: "" + t.string "archive_district", default: "" + t.string "live_with", default: "" + t.integer "id_poor" + t.integer "rice_support", default: 0 + t.text "exit_note", default: "" + t.date "exit_date" + t.date "accepted_date" + t.string "gov_city", default: "" + t.string "gov_commune", default: "" + t.string "gov_district", default: "" + t.date "gov_date" + t.string "gov_village_code", default: "" + t.string "gov_client_code", default: "" + t.string "gov_interview_village", default: "" + t.string "gov_interview_commune", default: "" + t.string "gov_interview_district", default: "" + t.string "gov_interview_city", default: "" + t.string "gov_caseworker_name", default: "" + t.string "gov_caseworker_phone", default: "" + t.string "gov_carer_name", default: "" + t.string "gov_carer_relationship", default: "" + t.string "gov_carer_home", default: "" + t.string "gov_carer_street", default: "" + t.string "gov_carer_village", default: "" + t.string "gov_carer_commune", default: "" + t.string "gov_carer_district", default: "" + t.string "gov_carer_city", default: "" + t.string "gov_carer_phone", default: "" + t.string "gov_information_source", default: "" + t.text "gov_referral_reason", default: "" + t.text "gov_guardian_comment", default: "" + t.text "gov_caseworker_comment", default: "" + t.integer "district_id" + t.string "telephone_number", default: "" + t.string "name_of_referee", default: "" + t.string "main_school_contact", default: "" + t.string "rated_for_id_poor", default: "" + t.string "what3words", default: "" + t.string "exit_reasons", default: [], array: true + t.string "exit_circumstance", default: "" + t.string "other_info_of_exit", default: "" + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "subdistrict_id" + t.integer "township_id" + t.integer "state_id" + t.string "country_origin", default: "" + t.integer "commune_id" + t.integer "village_id" + t.string "profile" + t.integer "referral_source_category_id" + t.string "archived_slug" + t.integer "assessments_count", default: 0, null: false + t.integer "current_family_id" + t.boolean "outside", default: false + t.string "outside_address", default: "" + t.string "address_type", default: "" + t.string "client_phone", default: "" + t.string "phone_owner", default: "" + t.string "client_email", default: "" + t.string "referee_relationship", default: "" + t.integer "referee_id" + t.integer "carer_id" + t.string "nickname", default: "" + t.string "relation_to_referee", default: "" + t.boolean "concern_is_outside", default: false + t.string "concern_outside_address", default: "" + t.integer "concern_province_id" + t.integer "concern_district_id" + t.integer "concern_commune_id" + t.integer "concern_village_id" + t.string "concern_street", default: "" + t.string "concern_house", default: "" + t.string "concern_address", default: "" + t.string "concern_address_type", default: "" + t.string "concern_phone", default: "" + t.string "concern_phone_owner", default: "" + t.string "concern_email", default: "" + t.string "concern_email_owner", default: "" + t.string "concern_location", default: "" + t.boolean "concern_same_as_client", default: false + t.string "location_description", default: "" + t.string "phone_counselling_summary", default: "" + t.string "presented_id" + t.string "id_number" + t.string "other_phone_number" + t.string "brsc_branch" + t.string "current_island" + t.string "current_street" + t.string "current_po_box" + t.string "current_city" + t.string "current_settlement" + t.string "current_resident_own_or_rent" + t.string "current_household_type" + t.string "island2" + t.string "street2" + t.string "po_box2" + t.string "city2" + t.string "settlement2" + t.string "resident_own_or_rent2" + t.string "household_type2" + t.string "legacy_brcs_id" + t.boolean "whatsapp", default: false + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + t.boolean "other_phone_whatsapp", default: false + t.string "preferred_language", default: "English" + t.boolean "national_id", default: false, null: false + t.boolean "birth_cert", default: false, null: false + t.boolean "family_book", default: false, null: false + t.boolean "passport", default: false, null: false + t.boolean "travel_doc", default: false, null: false + t.boolean "referral_doc", default: false, null: false + t.boolean "local_consent", default: false, null: false + t.boolean "police_interview", default: false, null: false + t.boolean "other_legal_doc", default: false, null: false + t.string "national_id_files", default: [], array: true + t.string "birth_cert_files", default: [], array: true + t.string "family_book_files", default: [], array: true + t.string "passport_files", default: [], array: true + t.string "travel_doc_files", default: [], array: true + t.string "referral_doc_files", default: [], array: true + t.string "local_consent_files", default: [], array: true + t.string "police_interview_files", default: [], array: true + t.string "other_legal_doc_files", default: [], array: true + t.string "global_id" + t.boolean "referred_external", default: false + t.string "marital_status" + t.string "nationality" + t.string "ethnicity" + t.string "location_of_concern" + t.string "type_of_trafficking" + t.text "education_background" + t.string "department" + t.string "neighbor_name" + t.string "neighbor_phone" + t.string "dosavy_name" + t.string "dosavy_phone" + t.string "chief_commune_name" + t.string "chief_commune_phone" + t.string "chief_village_name" + t.string "chief_village_phone" + t.string "ccwc_name" + t.string "ccwc_phone" + t.string "legal_team_name" + t.string "legal_representative_name" + t.string "legal_team_phone" + t.string "other_agency_name" + t.string "other_representative_name" + t.string "other_agency_phone" + t.string "locality" + t.string "national_id_number" + t.string "passport_number" + t.index ["commune_id"], name: "index_clients_on_commune_id" + t.index ["current_family_id"], name: "index_clients_on_current_family_id" + t.index ["district_id"], name: "index_clients_on_district_id" + t.index ["donor_id"], name: "index_clients_on_donor_id" + t.index ["external_id"], name: "index_clients_on_external_id" + t.index ["global_id"], name: "index_clients_on_global_id" + t.index ["mosvy_number"], name: "index_clients_on_mosvy_number" + t.index ["slug"], name: "index_clients_on_slug", unique: true + t.index ["state_id"], name: "index_clients_on_state_id" + t.index ["subdistrict_id"], name: "index_clients_on_subdistrict_id" + t.index ["township_id"], name: "index_clients_on_township_id" + t.index ["village_id"], name: "index_clients_on_village_id" + end create_table "clients_quantitative_cases", force: :cascade do |t| - t.integer "client_id" - t.integer "quantitative_case_id" + t.integer "client_id" + t.integer "quantitative_case_id" t.datetime "created_at" t.datetime "updated_at" end create_table "communes", force: :cascade do |t| - t.string "code", default: "" - t.string "name_kh", default: "" - t.string "name_en", default: "" - t.integer "district_id" + t.string "code", default: "" + t.string "name_kh", default: "" + t.string "name_en", default: "" + t.integer "district_id" t.datetime "created_at" t.datetime "updated_at" - t.string "district_type" + t.string "district_type" + t.index ["district_id"], name: "index_communes_on_district_id" end - add_index "communes", ["district_id"], name: "index_communes_on_district_id", using: :btree - create_table "custom_assessment_settings", force: :cascade do |t| - t.string "custom_assessment_name", default: "Custom Assessment" - t.integer "max_custom_assessment", default: 6 - t.string "custom_assessment_frequency", default: "month" - t.integer "custom_age", default: 18 - t.integer "setting_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "enable_custom_assessment", default: false + t.string "custom_assessment_name", default: "Custom Assessment" + t.integer "max_custom_assessment", default: 6 + t.string "custom_assessment_frequency", default: "month" + t.integer "custom_age", default: 18 + t.integer "setting_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "enable_custom_assessment", default: false end create_table "custom_field_permissions", force: :cascade do |t| - t.integer "user_id" - t.integer "custom_field_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "user_id" + t.integer "custom_field_id" + t.boolean "readable", default: true + t.boolean "editable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id" + t.index ["user_id"], name: "index_custom_field_permissions_on_user_id" end - add_index "custom_field_permissions", ["custom_field_id"], name: "index_custom_field_permissions_on_custom_field_id", using: :btree - add_index "custom_field_permissions", ["user_id"], name: "index_custom_field_permissions_on_user_id", using: :btree - create_table "custom_field_properties", force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "custom_formable_type" - t.integer "custom_formable_id" - t.integer "custom_field_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.jsonb "attachments" - t.integer "user_id" + t.jsonb "properties", default: {} + t.string "custom_formable_type" + t.integer "custom_formable_id" + t.integer "custom_field_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "attachments" + t.integer "user_id" + t.index ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id" end - add_index "custom_field_properties", ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id", using: :btree - create_table "custom_fields", force: :cascade do |t| - t.string "entity_type", default: "" - t.text "properties", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "form_title", default: "" - t.string "frequency", default: "" - t.integer "time_of_frequency", default: 0 - t.string "ngo_name", default: "" - t.jsonb "fields" + t.string "entity_type", default: "" + t.text "properties", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "form_title", default: "" + t.string "frequency", default: "" + t.integer "time_of_frequency", default: 0 + t.string "ngo_name", default: "" + t.jsonb "fields" end create_table "departments", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" + t.string "name", default: "" + t.text "description", default: "" t.datetime "created_at" t.datetime "updated_at" - t.integer "users_count", default: 0 + t.integer "users_count", default: 0 end create_table "districts", force: :cascade do |t| - t.string "name" - t.integer "province_id" - t.string "code", default: "" + t.string "name" + t.integer "province_id" + t.string "code", default: "" t.datetime "created_at" t.datetime "updated_at" + t.index ["province_id"], name: "index_districts_on_province_id" end - add_index "districts", ["province_id"], name: "index_districts_on_province_id", using: :btree - create_table "domain_groups", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" + t.string "name", default: "" + t.text "description", default: "" t.datetime "created_at" t.datetime "updated_at" - t.integer "domains_count", default: 0 + t.integer "domains_count", default: 0 end create_table "domain_program_streams", force: :cascade do |t| - t.integer "program_stream_id" - t.integer "domain_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "program_stream_id" + t.integer "domain_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_domain_program_streams_on_deleted_at" end - add_index "domain_program_streams", ["deleted_at"], name: "index_domain_program_streams_on_deleted_at", using: :btree - create_table "domains", force: :cascade do |t| - t.string "name", default: "" - t.string "identity", default: "" - t.text "description", default: "" - t.integer "domain_group_id" + t.string "name", default: "" + t.string "identity", default: "" + t.text "description", default: "" + t.integer "domain_group_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "tasks_count", default: 0 - t.string "score_1_color", default: "danger" - t.string "score_2_color", default: "warning" - t.string "score_3_color", default: "info" - t.string "score_4_color", default: "primary" - t.text "score_1_definition", default: "" - t.text "score_2_definition", default: "" - t.text "score_3_definition", default: "" - t.text "score_4_definition", default: "" - t.boolean "custom_domain", default: false - t.text "local_description", default: "" - t.text "score_1_local_definition", default: "" - t.text "score_2_local_definition", default: "" - t.text "score_3_local_definition", default: "" - t.text "score_4_local_definition", default: "" - t.integer "custom_assessment_setting_id" - end - - add_index "domains", ["domain_group_id"], name: "index_domains_on_domain_group_id", using: :btree + t.integer "tasks_count", default: 0 + t.string "score_1_color", default: "danger" + t.string "score_2_color", default: "warning" + t.string "score_3_color", default: "info" + t.string "score_4_color", default: "primary" + t.text "score_1_definition", default: "" + t.text "score_2_definition", default: "" + t.text "score_3_definition", default: "" + t.text "score_4_definition", default: "" + t.boolean "custom_domain", default: false + t.text "local_description", default: "" + t.text "score_1_local_definition", default: "" + t.text "score_2_local_definition", default: "" + t.text "score_3_local_definition", default: "" + t.text "score_4_local_definition", default: "" + t.integer "custom_assessment_setting_id" + t.index ["domain_group_id"], name: "index_domains_on_domain_group_id" + end create_table "donor_organizations", force: :cascade do |t| t.integer "donor_id" t.integer "organization_id" + t.index ["donor_id"], name: "index_donor_organizations_on_donor_id" + t.index ["organization_id"], name: "index_donor_organizations_on_organization_id" end - add_index "donor_organizations", ["donor_id"], name: "index_donor_organizations_on_donor_id", using: :btree - add_index "donor_organizations", ["organization_id"], name: "index_donor_organizations_on_organization_id", using: :btree - create_table "donors", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "code", default: "" - t.string "global_id", limit: 32, default: "", null: false + t.string "name", default: "" + t.text "description", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "code", default: "" + t.string "global_id", limit: 32, default: "", null: false + t.index ["global_id"], name: "index_donors_on_global_id" end - add_index "donors", ["global_id"], name: "index_donors_on_global_id", using: :btree - create_table "enrollment_trackings", force: :cascade do |t| - t.integer "enrollment_id" - t.integer "tracking_id" - t.jsonb "properties", default: {} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "enrollment_id" + t.integer "tracking_id" + t.jsonb "properties", default: {} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id" + t.index ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id" end - add_index "enrollment_trackings", ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id", using: :btree - add_index "enrollment_trackings", ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id", using: :btree - create_table "enrollments", force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "status", default: "Active" - t.date "enrollment_date" + t.jsonb "properties", default: {} + t.string "status", default: "Active" + t.date "enrollment_date" t.datetime "deleted_at" - t.string "programmable_type" - t.integer "programmable_id" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "programmable_type" + t.integer "programmable_id" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["deleted_at"], name: "index_enrollments_on_deleted_at" + t.index ["program_stream_id"], name: "index_enrollments_on_program_stream_id" end - add_index "enrollments", ["deleted_at"], name: "index_enrollments_on_deleted_at", using: :btree - add_index "enrollments", ["program_stream_id"], name: "index_enrollments_on_program_stream_id", using: :btree - create_table "enter_ngo_users", force: :cascade do |t| t.integer "user_id" t.integer "enter_ngo_id" + t.index ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id" + t.index ["user_id"], name: "index_enter_ngo_users_on_user_id" end - add_index "enter_ngo_users", ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id", using: :btree - add_index "enter_ngo_users", ["user_id"], name: "index_enter_ngo_users_on_user_id", using: :btree - create_table "enter_ngos", force: :cascade do |t| - t.date "accepted_date" - t.integer "client_id" + t.date "accepted_date" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" t.datetime "deleted_at" + t.index ["client_id"], name: "index_enter_ngos_on_client_id" + t.index ["deleted_at"], name: "index_enter_ngos_on_deleted_at" end - add_index "enter_ngos", ["client_id"], name: "index_enter_ngos_on_client_id", using: :btree - add_index "enter_ngos", ["deleted_at"], name: "index_enter_ngos_on_deleted_at", using: :btree - create_table "exit_ngos", force: :cascade do |t| - t.integer "client_id" - t.string "exit_circumstance", default: "" - t.string "other_info_of_exit", default: "" - t.string "exit_reasons", default: [], array: true - t.text "exit_note", default: "" - t.date "exit_date" + t.integer "client_id" + t.string "exit_circumstance", default: "" + t.string "other_info_of_exit", default: "" + t.string "exit_reasons", default: [], array: true + t.text "exit_note", default: "" + t.date "exit_date" t.datetime "created_at" t.datetime "updated_at" t.datetime "deleted_at" + t.index ["client_id"], name: "index_exit_ngos_on_client_id" + t.index ["deleted_at"], name: "index_exit_ngos_on_deleted_at" end - add_index "exit_ngos", ["client_id"], name: "index_exit_ngos_on_client_id", using: :btree - add_index "exit_ngos", ["deleted_at"], name: "index_exit_ngos_on_deleted_at", using: :btree - create_table "external_system_global_identities", force: :cascade do |t| - t.integer "external_system_id" - t.string "global_id" - t.string "external_id" - t.string "client_slug" - t.string "organization_name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "external_system_id" + t.string "global_id" + t.string "external_id" + t.string "client_slug" + t.string "organization_name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id" + t.index ["global_id"], name: "index_external_system_global_identities_on_global_id" end - add_index "external_system_global_identities", ["external_system_id"], name: "index_external_system_global_identities_on_external_system_id", using: :btree - add_index "external_system_global_identities", ["global_id"], name: "index_external_system_global_identities_on_global_id", using: :btree - create_table "external_systems", force: :cascade do |t| - t.string "name" - t.string "url" - t.string "token" + t.string "name" + t.string "url" + t.string "token" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "families", force: :cascade do |t| - t.string "code" - t.string "name", default: "" - t.string "address", default: "" - t.text "caregiver_information", default: "" - t.integer "significant_family_member_count", default: 1 - t.float "household_income", default: 0.0 - t.boolean "dependable_income", default: false - t.integer "female_children_count", default: 0 - t.integer "male_children_count", default: 0 - t.integer "female_adult_count", default: 0 - t.integer "male_adult_count", default: 0 - t.string "family_type", default: "kinship" - t.date "contract_date" - t.integer "province_id" + t.string "code" + t.string "name", default: "" + t.string "address", default: "" + t.text "caregiver_information", default: "" + t.integer "significant_family_member_count", default: 1 + t.float "household_income", default: 0.0 + t.boolean "dependable_income", default: false + t.integer "female_children_count", default: 0 + t.integer "male_children_count", default: 0 + t.integer "female_adult_count", default: 0 + t.integer "male_adult_count", default: 0 + t.string "family_type", default: "kinship" + t.date "contract_date" + t.integer "province_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.string "case_history", default: "" + t.integer "cases_count", default: 0 + t.string "case_history", default: "" t.datetime "deleted_at" - t.integer "children", default: [], array: true - t.string "status", default: "" - t.integer "district_id" - t.string "old_commune", default: "" - t.string "old_village", default: "" - t.string "house", default: "" - t.string "street", default: "" - t.integer "commune_id" - t.integer "village_id" - t.integer "user_id" - end - - add_index "families", ["commune_id"], name: "index_families_on_commune_id", using: :btree - add_index "families", ["deleted_at"], name: "index_families_on_deleted_at", using: :btree - add_index "families", ["district_id"], name: "index_families_on_district_id", using: :btree - add_index "families", ["user_id"], name: "index_families_on_user_id", using: :btree - add_index "families", ["village_id"], name: "index_families_on_village_id", using: :btree + t.integer "children", default: [], array: true + t.string "status", default: "" + t.integer "district_id" + t.string "old_commune", default: "" + t.string "old_village", default: "" + t.string "house", default: "" + t.string "street", default: "" + t.integer "commune_id" + t.integer "village_id" + t.integer "user_id" + t.index ["commune_id"], name: "index_families_on_commune_id" + t.index ["deleted_at"], name: "index_families_on_deleted_at" + t.index ["district_id"], name: "index_families_on_district_id" + t.index ["user_id"], name: "index_families_on_user_id" + t.index ["village_id"], name: "index_families_on_village_id" + end create_table "family_members", force: :cascade do |t| - t.string "adult_name", default: "" - t.date "date_of_birth" - t.string "occupation", default: "" - t.string "relation", default: "" - t.integer "family_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "guardian", default: false - t.string "gender" - t.text "note" + t.string "adult_name", default: "" + t.date "date_of_birth" + t.string "occupation", default: "" + t.string "relation", default: "" + t.integer "family_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "guardian", default: false + t.string "gender" + t.text "note" + t.index ["family_id"], name: "index_family_members_on_family_id" end - add_index "family_members", ["family_id"], name: "index_family_members_on_family_id", using: :btree - create_table "family_plans", force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "priority" + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "priority" end create_table "field_setting_translations", force: :cascade do |t| - t.integer "field_setting_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "label" + t.integer "field_setting_id", null: false + t.string "locale", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "label" + t.index ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id" + t.index ["locale"], name: "index_field_setting_translations_on_locale" end - add_index "field_setting_translations", ["field_setting_id"], name: "index_field_setting_translations_on_field_setting_id", using: :btree - add_index "field_setting_translations", ["locale"], name: "index_field_setting_translations_on_locale", using: :btree - create_table "field_settings", force: :cascade do |t| - t.string "name", null: false - t.string "group", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "type", default: "field", null: false - t.boolean "visible", default: true, null: false - t.string "current_label" - t.boolean "required", default: false - t.string "klass_name" - t.string "for_instances" - t.boolean "label_only", default: false + t.string "name", null: false + t.string "group", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "type", default: "field", null: false + t.boolean "visible", default: true, null: false + t.string "current_label" + t.boolean "required", default: false + t.string "klass_name" + t.string "for_instances" + t.boolean "label_only", default: false end create_table "form_builder_attachments", force: :cascade do |t| - t.string "name", default: "" - t.jsonb "file", default: [] - t.string "form_buildable_type" - t.integer "form_buildable_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name", default: "" + t.jsonb "file", default: [] + t.string "form_buildable_type" + t.integer "form_buildable_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "friendly_id_slugs", force: :cascade do |t| - t.string "slug", null: false - t.integer "sluggable_id", null: false - t.string "sluggable_type", limit: 50 - t.string "scope" + t.string "slug", null: false + t.integer "sluggable_id", null: false + t.string "sluggable_type", limit: 50 + t.string "scope" t.datetime "created_at" + t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true + t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" + t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" end - add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree - add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree - add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree - add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree - create_table "global_identities", id: false, force: :cascade do |t| t.string "ulid" + t.index ["ulid"], name: "index_global_identities_on_ulid", unique: true end - add_index "global_identities", ["ulid"], name: "index_global_identities_on_ulid", unique: true, using: :btree - create_table "global_identity_organizations", force: :cascade do |t| - t.string "global_id" + t.string "global_id" t.integer "organization_id" t.integer "client_id" + t.index ["client_id"], name: "index_global_identity_organizations_on_client_id" + t.index ["global_id"], name: "index_global_identity_organizations_on_global_id" + t.index ["organization_id"], name: "index_global_identity_organizations_on_organization_id" end - add_index "global_identity_organizations", ["client_id"], name: "index_global_identity_organizations_on_client_id", using: :btree - add_index "global_identity_organizations", ["global_id"], name: "index_global_identity_organizations_on_global_id", using: :btree - add_index "global_identity_organizations", ["organization_id"], name: "index_global_identity_organizations_on_organization_id", using: :btree - create_table "global_identity_tmp", force: :cascade do |t| - t.binary "ulid" - t.string "ngo_name" + t.binary "ulid" + t.string "ngo_name" t.integer "client_id" end create_table "global_services", id: false, force: :cascade do |t| t.uuid "uuid" + t.index ["uuid"], name: "index_global_services_on_uuid", unique: true end - add_index "global_services", ["uuid"], name: "index_global_services_on_uuid", unique: true, using: :btree - create_table "government_form_children_plans", force: :cascade do |t| - t.text "goal", default: "" - t.text "action", default: "" - t.text "who", default: "" - t.integer "government_form_id" - t.integer "children_plan_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "score" - t.text "comment", default: "" - t.date "completion_date" + t.text "goal", default: "" + t.text "action", default: "" + t.text "who", default: "" + t.integer "government_form_id" + t.integer "children_plan_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "score" + t.text "comment", default: "" + t.date "completion_date" + t.index ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id" + t.index ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id" end - add_index "government_form_children_plans", ["children_plan_id"], name: "index_government_form_children_plans_on_children_plan_id", using: :btree - add_index "government_form_children_plans", ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id", using: :btree - create_table "government_form_family_plans", force: :cascade do |t| - t.text "goal", default: "" - t.text "action", default: "" - t.text "result", default: "" - t.integer "government_form_id" - t.integer "family_plan_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "score" - t.text "comment", default: "" + t.text "goal", default: "" + t.text "action", default: "" + t.text "result", default: "" + t.integer "government_form_id" + t.integer "family_plan_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "score" + t.text "comment", default: "" + t.index ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id" + t.index ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id" end - add_index "government_form_family_plans", ["family_plan_id"], name: "index_government_form_family_plans_on_family_plan_id", using: :btree - add_index "government_form_family_plans", ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id", using: :btree - create_table "government_form_interviewees", force: :cascade do |t| - t.integer "government_form_id" - t.integer "interviewee_id" + t.integer "government_form_id" + t.integer "interviewee_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id" + t.index ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id" end - add_index "government_form_interviewees", ["government_form_id"], name: "index_government_form_interviewees_on_government_form_id", using: :btree - add_index "government_form_interviewees", ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id", using: :btree - create_table "government_form_needs", force: :cascade do |t| - t.integer "rank" - t.integer "need_id" - t.integer "government_form_id" + t.integer "rank" + t.integer "need_id" + t.integer "government_form_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["government_form_id"], name: "index_government_form_needs_on_government_form_id" + t.index ["need_id"], name: "index_government_form_needs_on_need_id" end - add_index "government_form_needs", ["government_form_id"], name: "index_government_form_needs_on_government_form_id", using: :btree - add_index "government_form_needs", ["need_id"], name: "index_government_form_needs_on_need_id", using: :btree - create_table "government_form_problems", force: :cascade do |t| - t.integer "rank" - t.integer "problem_id" - t.integer "government_form_id" + t.integer "rank" + t.integer "problem_id" + t.integer "government_form_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["government_form_id"], name: "index_government_form_problems_on_government_form_id" + t.index ["problem_id"], name: "index_government_form_problems_on_problem_id" end - add_index "government_form_problems", ["government_form_id"], name: "index_government_form_problems_on_government_form_id", using: :btree - add_index "government_form_problems", ["problem_id"], name: "index_government_form_problems_on_problem_id", using: :btree - create_table "government_form_service_types", force: :cascade do |t| - t.integer "government_form_id" - t.integer "service_type_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "government_form_id" + t.integer "service_type_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["government_form_id"], name: "index_government_form_service_types_on_government_form_id" + t.index ["service_type_id"], name: "index_government_form_service_types_on_service_type_id" end - add_index "government_form_service_types", ["government_form_id"], name: "index_government_form_service_types_on_government_form_id", using: :btree - add_index "government_form_service_types", ["service_type_id"], name: "index_government_form_service_types_on_service_type_id", using: :btree - create_table "government_forms", force: :cascade do |t| - t.string "name", default: "" - t.date "date" - t.string "client_code", default: "" - t.integer "interview_district_id" - t.integer "interview_province_id" - t.integer "case_worker_id" - t.string "case_worker_phone", default: "" - t.integer "client_id" - t.string "primary_carer_relationship", default: "" - t.string "primary_carer_house", default: "" - t.string "primary_carer_street", default: "" - t.integer "primary_carer_district_id" - t.integer "primary_carer_province_id" - t.text "source_info", default: "" - t.text "summary_info_of_referral", default: "" - t.text "guardian_comment", default: "" - t.text "case_worker_comment", default: "" - t.string "other_interviewee", default: "" - t.string "other_client_type", default: "" - t.string "other_need", default: "" - t.string "other_problem", default: "" + t.string "name", default: "" + t.date "date" + t.string "client_code", default: "" + t.integer "interview_district_id" + t.integer "interview_province_id" + t.integer "case_worker_id" + t.string "case_worker_phone", default: "" + t.integer "client_id" + t.string "primary_carer_relationship", default: "" + t.string "primary_carer_house", default: "" + t.string "primary_carer_street", default: "" + t.integer "primary_carer_district_id" + t.integer "primary_carer_province_id" + t.text "source_info", default: "" + t.text "summary_info_of_referral", default: "" + t.text "guardian_comment", default: "" + t.text "case_worker_comment", default: "" + t.string "other_interviewee", default: "" + t.string "other_client_type", default: "" + t.string "other_need", default: "" + t.string "other_problem", default: "" t.datetime "created_at" t.datetime "updated_at" - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.string "caseworker_assumption", default: "" - t.text "assumption_description", default: "" - t.date "assumption_date" - t.string "contact_type", default: "" - t.string "client_decision", default: "" - t.string "other_service_type", default: "" - t.date "gov_placement_date" - t.string "care_type", default: "" - t.string "primary_carer", default: "" - t.string "secondary_carer", default: "" - t.string "carer_contact_info", default: "" - t.integer "assessment_province_id" - t.integer "assessment_district_id" - t.string "new_carer", default: "" - t.string "new_carer_gender", default: "" - t.date "new_carer_date_of_birth" - t.string "new_carer_relationship", default: "" - t.integer "interview_commune_id" - t.integer "interview_village_id" - t.integer "assessment_commune_id" - t.integer "primary_carer_commune_id" - t.integer "primary_carer_village_id" - t.text "recent_issues_and_progress", default: "" - t.string "other_case_closure" - t.text "brief_case_history" - t.integer "case_closure_id" - end - - add_index "government_forms", ["client_id"], name: "index_government_forms_on_client_id", using: :btree - add_index "government_forms", ["commune_id"], name: "index_government_forms_on_commune_id", using: :btree - add_index "government_forms", ["district_id"], name: "index_government_forms_on_district_id", using: :btree - add_index "government_forms", ["province_id"], name: "index_government_forms_on_province_id", using: :btree - add_index "government_forms", ["village_id"], name: "index_government_forms_on_village_id", using: :btree + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.string "caseworker_assumption", default: "" + t.text "assumption_description", default: "" + t.date "assumption_date" + t.string "contact_type", default: "" + t.string "client_decision", default: "" + t.string "other_service_type", default: "" + t.date "gov_placement_date" + t.string "care_type", default: "" + t.string "primary_carer", default: "" + t.string "secondary_carer", default: "" + t.string "carer_contact_info", default: "" + t.integer "assessment_province_id" + t.integer "assessment_district_id" + t.string "new_carer", default: "" + t.string "new_carer_gender", default: "" + t.date "new_carer_date_of_birth" + t.string "new_carer_relationship", default: "" + t.integer "interview_commune_id" + t.integer "interview_village_id" + t.integer "assessment_commune_id" + t.integer "primary_carer_commune_id" + t.integer "primary_carer_village_id" + t.text "recent_issues_and_progress", default: "" + t.string "other_case_closure" + t.text "brief_case_history" + t.integer "case_closure_id" + t.index ["client_id"], name: "index_government_forms_on_client_id" + t.index ["commune_id"], name: "index_government_forms_on_commune_id" + t.index ["district_id"], name: "index_government_forms_on_district_id" + t.index ["province_id"], name: "index_government_forms_on_province_id" + t.index ["village_id"], name: "index_government_forms_on_village_id" + end create_table "government_reports", force: :cascade do |t| - t.string "code", default: "" - t.string "initial_capital", default: "" - t.string "initial_city", default: "" - t.string "initial_commune", default: "" - t.date "initial_date" - t.string "client_code", default: "" - t.string "commune", default: "" - t.string "city", default: "" - t.string "capital", default: "" - t.string "organisation_name", default: "" - t.string "organisation_phone_number", default: "" - t.string "client_name", default: "" - t.date "client_date_of_birth" - t.string "client_gender", default: "" - t.string "found_client_at", default: "" - t.string "found_client_village", default: "" - t.string "education", default: "" - t.string "carer_name", default: "" - t.string "client_contact", default: "" - t.string "carer_house_number", default: "" - t.string "carer_street_number", default: "" - t.string "carer_village", default: "" - t.string "carer_commune", default: "" - t.string "carer_city", default: "" - t.string "carer_capital", default: "" - t.string "carer_phone_number", default: "" - t.date "case_information_date" - t.string "referral_name", default: "" - t.string "referral_position", default: "" - t.boolean "anonymous", default: false - t.text "anonymous_description", default: "" - t.boolean "client_living_with_guardian", default: false - t.text "present_physical_health", default: "" - t.text "physical_health_need", default: "" - t.text "physical_health_plan", default: "" - t.text "present_supplies", default: "" - t.text "supplies_need", default: "" - t.text "supplies_plan", default: "" - t.text "present_education", default: "" - t.text "education_need", default: "" - t.text "education_plan", default: "" - t.text "present_family_communication", default: "" - t.text "family_communication_need", default: "" - t.text "family_communication_plan", default: "" - t.text "present_society_communication", default: "" - t.text "society_communication_need", default: "" - t.text "society_communication_plan", default: "" - t.text "present_emotional_health", default: "" - t.text "emotional_health_need", default: "" - t.text "emotional_health_plan", default: "" - t.boolean "mission_obtainable", default: false - t.boolean "first_mission", default: false - t.boolean "second_mission", default: false - t.boolean "third_mission", default: false - t.boolean "fourth_mission", default: false - t.date "done_date" - t.date "agreed_date" - t.integer "client_id" + t.string "code", default: "" + t.string "initial_capital", default: "" + t.string "initial_city", default: "" + t.string "initial_commune", default: "" + t.date "initial_date" + t.string "client_code", default: "" + t.string "commune", default: "" + t.string "city", default: "" + t.string "capital", default: "" + t.string "organisation_name", default: "" + t.string "organisation_phone_number", default: "" + t.string "client_name", default: "" + t.date "client_date_of_birth" + t.string "client_gender", default: "" + t.string "found_client_at", default: "" + t.string "found_client_village", default: "" + t.string "education", default: "" + t.string "carer_name", default: "" + t.string "client_contact", default: "" + t.string "carer_house_number", default: "" + t.string "carer_street_number", default: "" + t.string "carer_village", default: "" + t.string "carer_commune", default: "" + t.string "carer_city", default: "" + t.string "carer_capital", default: "" + t.string "carer_phone_number", default: "" + t.date "case_information_date" + t.string "referral_name", default: "" + t.string "referral_position", default: "" + t.boolean "anonymous", default: false + t.text "anonymous_description", default: "" + t.boolean "client_living_with_guardian", default: false + t.text "present_physical_health", default: "" + t.text "physical_health_need", default: "" + t.text "physical_health_plan", default: "" + t.text "present_supplies", default: "" + t.text "supplies_need", default: "" + t.text "supplies_plan", default: "" + t.text "present_education", default: "" + t.text "education_need", default: "" + t.text "education_plan", default: "" + t.text "present_family_communication", default: "" + t.text "family_communication_need", default: "" + t.text "family_communication_plan", default: "" + t.text "present_society_communication", default: "" + t.text "society_communication_need", default: "" + t.text "society_communication_plan", default: "" + t.text "present_emotional_health", default: "" + t.text "emotional_health_need", default: "" + t.text "emotional_health_plan", default: "" + t.boolean "mission_obtainable", default: false + t.boolean "first_mission", default: false + t.boolean "second_mission", default: false + t.boolean "third_mission", default: false + t.boolean "fourth_mission", default: false + t.date "done_date" + t.date "agreed_date" + t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" end create_table "hotlines", force: :cascade do |t| - t.integer "client_id" - t.integer "call_id" + t.integer "client_id" + t.integer "call_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["call_id"], name: "index_hotlines_on_call_id" + t.index ["client_id"], name: "index_hotlines_on_client_id" end - add_index "hotlines", ["call_id"], name: "index_hotlines_on_call_id", using: :btree - add_index "hotlines", ["client_id"], name: "index_hotlines_on_client_id", using: :btree - create_table "interventions", force: :cascade do |t| - t.string "action", default: "" + t.string "action", default: "" t.datetime "created_at" t.datetime "updated_at" end create_table "interviewees", force: :cascade do |t| - t.string "name", default: "" + t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" end create_table "leave_programs", force: :cascade do |t| - t.jsonb "properties", default: {} - t.integer "client_enrollment_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "program_stream_id" - t.date "exit_date" + t.jsonb "properties", default: {} + t.integer "client_enrollment_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "program_stream_id" + t.date "exit_date" t.datetime "deleted_at" - t.integer "enrollment_id" + t.integer "enrollment_id" + t.index ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id" + t.index ["deleted_at"], name: "index_leave_programs_on_deleted_at" + t.index ["enrollment_id"], name: "index_leave_programs_on_enrollment_id" end - add_index "leave_programs", ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id", using: :btree - add_index "leave_programs", ["deleted_at"], name: "index_leave_programs_on_deleted_at", using: :btree - add_index "leave_programs", ["enrollment_id"], name: "index_leave_programs_on_enrollment_id", using: :btree - create_table "locations", force: :cascade do |t| - t.string "name", default: "" + t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" - t.integer "order_option", default: 0 + t.integer "order_option", default: 0 end create_table "materials", force: :cascade do |t| - t.string "status", default: "" + t.string "status", default: "" t.datetime "created_at" t.datetime "updated_at" end create_table "meta_fields", force: :cascade do |t| - t.string "field_name" - t.string "field_type" - t.boolean "hidden", default: true - t.boolean "required", default: false - t.string "label" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "field_name" + t.string "field_type" + t.boolean "hidden", default: true + t.boolean "required", default: false + t.string "label" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "necessities", force: :cascade do |t| - t.string "content", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "content", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "needs", force: :cascade do |t| - t.string "name", default: "" + t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" end create_table "oauth_access_grants", force: :cascade do |t| - t.integer "resource_owner_id", null: false - t.integer "application_id", null: false - t.string "token", null: false - t.integer "expires_in", null: false - t.text "redirect_uri", null: false - t.datetime "created_at", null: false + t.integer "resource_owner_id", null: false + t.integer "application_id", null: false + t.string "token", null: false + t.integer "expires_in", null: false + t.text "redirect_uri", null: false + t.datetime "created_at", null: false t.datetime "revoked_at" - t.string "scopes" + t.string "scopes" + t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true end - add_index "oauth_access_grants", ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree - create_table "oauth_access_tokens", force: :cascade do |t| - t.integer "resource_owner_id" - t.integer "application_id" - t.string "token", null: false - t.string "refresh_token" - t.integer "expires_in" + t.integer "resource_owner_id" + t.integer "application_id" + t.string "token", null: false + t.string "refresh_token" + t.integer "expires_in" t.datetime "revoked_at" - t.datetime "created_at", null: false - t.string "scopes" - t.string "previous_refresh_token", default: "", null: false + t.datetime "created_at", null: false + t.string "scopes" + t.string "previous_refresh_token", default: "", null: false + t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true + t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" + t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true end - add_index "oauth_access_tokens", ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree - add_index "oauth_access_tokens", ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree - add_index "oauth_access_tokens", ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree - create_table "oauth_applications", force: :cascade do |t| - t.string "name", null: false - t.string "uid", null: false - t.string "secret", null: false - t.text "redirect_uri", null: false - t.string "scopes", default: "", null: false - t.boolean "confidential", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name", null: false + t.string "uid", null: false + t.string "secret", null: false + t.text "redirect_uri", null: false + t.string "scopes", default: "", null: false + t.boolean "confidential", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true end - add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree - create_table "organization_types", force: :cascade do |t| - t.string "name" + t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "organizations", force: :cascade do |t| - t.string "full_name" - t.string "short_name" - t.string "logo" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "fcf_ngo", default: false - t.string "country", default: "" - t.boolean "aht", default: false - t.boolean "integrated", default: false - t.string "supported_languages", default: ["km", "en", "my"], array: true - t.integer "clients_count", default: 0 - t.integer "active_client", default: 0 - t.integer "accepted_client", default: 0 - t.boolean "demo", default: false - t.string "referral_source_category_name" + t.string "full_name" + t.string "short_name" + t.string "logo" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "fcf_ngo", default: false + t.string "country", default: "" + t.boolean "aht", default: false + t.boolean "integrated", default: false + t.string "supported_languages", default: ["km", "en", "my"], array: true + t.integer "clients_count", default: 0 + t.integer "active_client", default: 0 + t.integer "accepted_client", default: 0 + t.boolean "demo", default: false + t.string "referral_source_category_name" end create_table "partners", force: :cascade do |t| - t.string "name", default: "" - t.string "address", default: "" - t.date "start_date" - t.string "contact_person_name", default: "" - t.string "contact_person_email", default: "" - t.string "contact_person_mobile", default: "" - t.string "archive_organization_type", default: "" - t.string "affiliation", default: "" - t.string "engagement", default: "" - t.text "background", default: "" - t.integer "province_id" + t.string "name", default: "" + t.string "address", default: "" + t.date "start_date" + t.string "contact_person_name", default: "" + t.string "contact_person_email", default: "" + t.string "contact_person_mobile", default: "" + t.string "archive_organization_type", default: "" + t.string "affiliation", default: "" + t.string "engagement", default: "" + t.text "background", default: "" + t.integer "province_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.integer "organization_type_id" + t.integer "cases_count", default: 0 + t.integer "organization_type_id" + t.index ["organization_type_id"], name: "index_partners_on_organization_type_id" end - add_index "partners", ["organization_type_id"], name: "index_partners_on_organization_type_id", using: :btree - create_table "permissions", force: :cascade do |t| - t.integer "user_id" - t.boolean "case_notes_readable", default: true - t.boolean "case_notes_editable", default: true - t.boolean "assessments_editable", default: true - t.boolean "assessments_readable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "user_id" + t.boolean "case_notes_readable", default: true + t.boolean "case_notes_editable", default: true + t.boolean "assessments_editable", default: true + t.boolean "assessments_readable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_permissions_on_user_id" end - add_index "permissions", ["user_id"], name: "index_permissions_on_user_id", using: :btree - create_table "problems", force: :cascade do |t| - t.string "name", default: "" + t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" end create_table "program_stream_permissions", force: :cascade do |t| - t.integer "user_id" - t.integer "program_stream_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "user_id" + t.integer "program_stream_id" + t.boolean "readable", default: true + t.boolean "editable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at" + t.index ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id" + t.index ["user_id"], name: "index_program_stream_permissions_on_user_id" end - add_index "program_stream_permissions", ["deleted_at"], name: "index_program_stream_permissions_on_deleted_at", using: :btree - add_index "program_stream_permissions", ["program_stream_id"], name: "index_program_stream_permissions_on_program_stream_id", using: :btree - add_index "program_stream_permissions", ["user_id"], name: "index_program_stream_permissions_on_user_id", using: :btree - create_table "program_stream_services", force: :cascade do |t| t.datetime "deleted_at" - t.integer "program_stream_id" - t.integer "service_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "program_stream_id" + t.integer "service_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["deleted_at"], name: "index_program_stream_services_on_deleted_at" + t.index ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id" + t.index ["service_id"], name: "index_program_stream_services_on_service_id" end - add_index "program_stream_services", ["deleted_at"], name: "index_program_stream_services_on_deleted_at", using: :btree - add_index "program_stream_services", ["program_stream_id"], name: "index_program_stream_services_on_program_stream_id", using: :btree - add_index "program_stream_services", ["service_id"], name: "index_program_stream_services_on_service_id", using: :btree - create_table "program_streams", force: :cascade do |t| - t.string "name" - t.text "description" - t.jsonb "rules", default: {} - t.jsonb "enrollment", default: {} - t.jsonb "exit_program", default: {} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "quantity" - t.string "ngo_name", default: "" - t.boolean "completed", default: false - t.integer "program_exclusive", default: [], array: true - t.integer "mutual_dependence", default: [], array: true - t.boolean "tracking_required", default: false + t.string "name" + t.text "description" + t.jsonb "rules", default: {} + t.jsonb "enrollment", default: {} + t.jsonb "exit_program", default: {} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "quantity" + t.string "ngo_name", default: "" + t.boolean "completed", default: false + t.integer "program_exclusive", default: [], array: true + t.integer "mutual_dependence", default: [], array: true + t.boolean "tracking_required", default: false t.datetime "archived_at" - t.string "entity_type", default: "" + t.string "entity_type", default: "" + t.index ["archived_at"], name: "index_program_streams_on_archived_at" end - add_index "program_streams", ["archived_at"], name: "index_program_streams_on_archived_at", using: :btree - create_table "progress_note_types", force: :cascade do |t| - t.string "note_type", default: "" + t.string "note_type", default: "" t.datetime "created_at" t.datetime "updated_at" end create_table "progress_notes", force: :cascade do |t| - t.date "date" - t.string "other_location", default: "" - t.text "response", default: "" - t.text "additional_note", default: "" - t.integer "client_id" - t.integer "progress_note_type_id" - t.integer "location_id" - t.integer "material_id" + t.date "date" + t.string "other_location", default: "" + t.text "response", default: "" + t.text "additional_note", default: "" + t.integer "client_id" + t.integer "progress_note_type_id" + t.integer "location_id" + t.integer "material_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "user_id" + t.integer "user_id" + t.index ["client_id"], name: "index_progress_notes_on_client_id" + t.index ["location_id"], name: "index_progress_notes_on_location_id" + t.index ["material_id"], name: "index_progress_notes_on_material_id" + t.index ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id" + t.index ["user_id"], name: "index_progress_notes_on_user_id" end - add_index "progress_notes", ["client_id"], name: "index_progress_notes_on_client_id", using: :btree - add_index "progress_notes", ["location_id"], name: "index_progress_notes_on_location_id", using: :btree - add_index "progress_notes", ["material_id"], name: "index_progress_notes_on_material_id", using: :btree - add_index "progress_notes", ["progress_note_type_id"], name: "index_progress_notes_on_progress_note_type_id", using: :btree - add_index "progress_notes", ["user_id"], name: "index_progress_notes_on_user_id", using: :btree - create_table "protection_concerns", force: :cascade do |t| - t.string "content", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "content", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "provinces", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" + t.string "name", default: "" + t.text "description", default: "" t.datetime "created_at" t.datetime "updated_at" - t.integer "cases_count", default: 0 - t.integer "clients_count", default: 0 - t.integer "families_count", default: 0 - t.integer "partners_count", default: 0 - t.integer "users_count", default: 0, null: false - t.string "country" + t.integer "cases_count", default: 0 + t.integer "clients_count", default: 0 + t.integer "families_count", default: 0 + t.integer "partners_count", default: 0 + t.integer "users_count", default: 0, null: false + t.string "country" end create_table "quantitative_cases", force: :cascade do |t| - t.string "value", default: "" - t.integer "quantitative_type_id" + t.string "value", default: "" + t.integer "quantitative_type_id" t.datetime "created_at" t.datetime "updated_at" end create_table "quantitative_type_permissions", force: :cascade do |t| - t.integer "user_id" - t.integer "quantitative_type_id" - t.boolean "readable", default: true - t.boolean "editable", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "user_id" + t.integer "quantitative_type_id" + t.boolean "readable", default: true + t.boolean "editable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id" + t.index ["user_id"], name: "index_quantitative_type_permissions_on_user_id" end - add_index "quantitative_type_permissions", ["quantitative_type_id"], name: "index_quantitative_type_permissions_on_quantitative_type_id", using: :btree - add_index "quantitative_type_permissions", ["user_id"], name: "index_quantitative_type_permissions_on_user_id", using: :btree - create_table "quantitative_types", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" - t.integer "quantitative_cases_count", default: 0 + t.string "name", default: "" + t.text "description", default: "" + t.integer "quantitative_cases_count", default: 0 t.datetime "created_at" t.datetime "updated_at" - t.boolean "multiple", default: true + t.boolean "multiple", default: true end create_table "quarterly_reports", force: :cascade do |t| - t.date "visit_date" - t.integer "code", limit: 8 - t.integer "case_id" - t.text "general_health_or_appearance", default: "" - t.text "child_school_attendance_or_progress", default: "" - t.text "general_appearance_of_home", default: "" - t.text "observations_of_drug_alchohol_abuse", default: "" - t.text "describe_if_yes", default: "" - t.text "describe_the_family_current_situation", default: "" - t.text "has_the_situation_changed_from_the_previous_visit", default: "" - t.text "how_did_i_encourage_the_client", default: "" - t.text "what_future_teachings_or_trainings_could_help_the_client", default: "" - t.text "what_is_my_plan_for_the_next_visit_to_the_client", default: "" - t.boolean "money_and_supplies_being_used_appropriately", default: false - t.text "how_are_they_being_misused", default: "" - t.integer "staff_id" - t.text "spiritual_developments_with_the_child_or_family", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "quarterly_reports", ["case_id"], name: "index_quarterly_reports_on_case_id", using: :btree + t.date "visit_date" + t.bigint "code" + t.integer "case_id" + t.text "general_health_or_appearance", default: "" + t.text "child_school_attendance_or_progress", default: "" + t.text "general_appearance_of_home", default: "" + t.text "observations_of_drug_alchohol_abuse", default: "" + t.text "describe_if_yes", default: "" + t.text "describe_the_family_current_situation", default: "" + t.text "has_the_situation_changed_from_the_previous_visit", default: "" + t.text "how_did_i_encourage_the_client", default: "" + t.text "what_future_teachings_or_trainings_could_help_the_client", default: "" + t.text "what_is_my_plan_for_the_next_visit_to_the_client", default: "" + t.boolean "money_and_supplies_being_used_appropriately", default: false + t.text "how_are_they_being_misused", default: "" + t.integer "staff_id" + t.text "spiritual_developments_with_the_child_or_family", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["case_id"], name: "index_quarterly_reports_on_case_id" + end create_table "question_groups", force: :cascade do |t| - t.string "name" + t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "referees", force: :cascade do |t| - t.string "address_type", default: "" - t.string "current_address", default: "" - t.string "email", default: "" - t.string "gender", default: "" - t.string "house_number", default: "" - t.string "outside_address", default: "" - t.string "street_number", default: "" - t.boolean "outside", default: false - t.boolean "anonymous", default: false - t.integer "province_id" - t.integer "district_id" - t.integer "commune_id" - t.integer "village_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "name", default: "" - t.string "phone", default: "" - t.boolean "adult" - t.string "suburb", default: "" - t.string "description_house_landmark", default: "" - t.string "directions", default: "" - t.string "street_line1", default: "" - t.string "street_line2", default: "" - t.string "plot", default: "" - t.string "road", default: "" - t.string "postal_code", default: "" - t.integer "state_id" - t.integer "township_id" - t.integer "subdistrict_id" - t.string "locality" - end - - add_index "referees", ["commune_id"], name: "index_referees_on_commune_id", using: :btree - add_index "referees", ["district_id"], name: "index_referees_on_district_id", using: :btree - add_index "referees", ["province_id"], name: "index_referees_on_province_id", using: :btree - add_index "referees", ["state_id"], name: "index_referees_on_state_id", using: :btree - add_index "referees", ["subdistrict_id"], name: "index_referees_on_subdistrict_id", using: :btree - add_index "referees", ["township_id"], name: "index_referees_on_township_id", using: :btree - add_index "referees", ["village_id"], name: "index_referees_on_village_id", using: :btree + t.string "address_type", default: "" + t.string "current_address", default: "" + t.string "email", default: "" + t.string "gender", default: "" + t.string "house_number", default: "" + t.string "outside_address", default: "" + t.string "street_number", default: "" + t.boolean "outside", default: false + t.boolean "anonymous", default: false + t.integer "province_id" + t.integer "district_id" + t.integer "commune_id" + t.integer "village_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name", default: "" + t.string "phone", default: "" + t.boolean "adult" + t.string "suburb", default: "" + t.string "description_house_landmark", default: "" + t.string "directions", default: "" + t.string "street_line1", default: "" + t.string "street_line2", default: "" + t.string "plot", default: "" + t.string "road", default: "" + t.string "postal_code", default: "" + t.integer "state_id" + t.integer "township_id" + t.integer "subdistrict_id" + t.string "locality" + t.index ["commune_id"], name: "index_referees_on_commune_id" + t.index ["district_id"], name: "index_referees_on_district_id" + t.index ["province_id"], name: "index_referees_on_province_id" + t.index ["state_id"], name: "index_referees_on_state_id" + t.index ["subdistrict_id"], name: "index_referees_on_subdistrict_id" + t.index ["township_id"], name: "index_referees_on_township_id" + t.index ["village_id"], name: "index_referees_on_village_id" + end create_table "referral_sources", force: :cascade do |t| - t.string "name", default: "" - t.text "description", default: "" + t.string "name", default: "" + t.text "description", default: "" t.datetime "created_at" t.datetime "updated_at" - t.integer "clients_count", default: 0 - t.string "name_en", default: "" - t.string "ancestry" + t.integer "clients_count", default: 0 + t.string "name_en", default: "" + t.string "ancestry" + t.index ["ancestry"], name: "index_referral_sources_on_ancestry" end - add_index "referral_sources", ["ancestry"], name: "index_referral_sources_on_ancestry", using: :btree - create_table "referrals", force: :cascade do |t| - t.string "slug", default: "" - t.date "date_of_referral" - t.string "referred_to", default: "" - t.string "referred_from", default: "" - t.text "referral_reason", default: "" - t.string "name_of_referee", default: "" - t.string "referral_phone", default: "" - t.integer "referee_id" - t.string "client_name", default: "" - t.string "consent_form", default: [], array: true - t.boolean "saved", default: false - t.integer "client_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "ngo_name", default: "" - t.string "client_global_id" - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - t.string "client_gender", default: "" - t.date "client_date_of_birth" - t.string "village_code", default: "" - t.string "referee_email" - end - - add_index "referrals", ["client_global_id"], name: "index_referrals_on_client_global_id", using: :btree - add_index "referrals", ["client_id"], name: "index_referrals_on_client_id", using: :btree - add_index "referrals", ["external_id"], name: "index_referrals_on_external_id", using: :btree - add_index "referrals", ["mosvy_number"], name: "index_referrals_on_mosvy_number", using: :btree + t.string "slug", default: "" + t.date "date_of_referral" + t.string "referred_to", default: "" + t.string "referred_from", default: "" + t.text "referral_reason", default: "" + t.string "name_of_referee", default: "" + t.string "referral_phone", default: "" + t.integer "referee_id" + t.string "client_name", default: "" + t.string "consent_form", default: [], array: true + t.boolean "saved", default: false + t.integer "client_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "ngo_name", default: "" + t.string "client_global_id" + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + t.string "client_gender", default: "" + t.date "client_date_of_birth" + t.string "village_code", default: "" + t.string "referee_email" + t.index ["client_global_id"], name: "index_referrals_on_client_global_id" + t.index ["client_id"], name: "index_referrals_on_client_id" + t.index ["external_id"], name: "index_referrals_on_external_id" + t.index ["mosvy_number"], name: "index_referrals_on_mosvy_number" + end create_table "referrals_services", id: false, force: :cascade do |t| t.integer "referral_id" @@ -1665,512 +1587,483 @@ end create_table "service_types", force: :cascade do |t| - t.string "name", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "services", force: :cascade do |t| - t.string "name" - t.integer "parent_id" + t.string "name" + t.integer "parent_id" t.datetime "deleted_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.uuid "uuid" + t.uuid "uuid" + t.index ["deleted_at"], name: "index_services_on_deleted_at" + t.index ["name"], name: "index_services_on_name" + t.index ["parent_id"], name: "index_services_on_parent_id" + t.index ["uuid"], name: "index_services_on_uuid" end - add_index "services", ["deleted_at"], name: "index_services_on_deleted_at", using: :btree - add_index "services", ["name"], name: "index_services_on_name", using: :btree - add_index "services", ["parent_id"], name: "index_services_on_parent_id", using: :btree - add_index "services", ["uuid"], name: "index_services_on_uuid", using: :btree - create_table "settings", force: :cascade do |t| - t.string "assessment_frequency", default: "month" - t.integer "min_assessment" - t.integer "max_assessment", default: 6 - t.string "country_name", default: "" - t.integer "max_case_note" - t.string "case_note_frequency" - t.string "client_default_columns", default: [], array: true - t.string "family_default_columns", default: [], array: true - t.string "partner_default_columns", default: [], array: true - t.string "user_default_columns", default: [], array: true + t.string "assessment_frequency", default: "month" + t.integer "min_assessment" + t.integer "max_assessment", default: 6 + t.string "country_name", default: "" + t.integer "max_case_note" + t.string "case_note_frequency" + t.string "client_default_columns", default: [], array: true + t.string "family_default_columns", default: [], array: true + t.string "partner_default_columns", default: [], array: true + t.string "user_default_columns", default: [], array: true t.datetime "created_at" t.datetime "updated_at" - t.string "org_name", default: "" - t.string "old_commune", default: "" - t.integer "province_id" - t.integer "district_id" - t.integer "age", default: 18 - t.integer "commune_id" - t.string "custom_assessment", default: "Custom Assessment" - t.boolean "enable_custom_assessment", default: false - t.boolean "enable_default_assessment", default: true - t.integer "max_custom_assessment", default: 6 - t.string "custom_assessment_frequency", default: "month" - t.integer "custom_age", default: 18 - t.string "default_assessment", default: "CSI Assessment" - t.boolean "sharing_data", default: false - t.string "custom_id1_latin", default: "" - t.string "custom_id1_local", default: "" - t.string "custom_id2_latin", default: "" - t.string "custom_id2_local", default: "" - t.boolean "enable_hotline", default: false - t.boolean "enable_client_form", default: true - t.string "assessment_score_order", default: "random_order", null: false - t.boolean "disable_required_fields", default: false, null: false - t.boolean "never_delete_incomplete_assessment", default: false, null: false - t.integer "delete_incomplete_after_period_value", default: 7 - t.string "delete_incomplete_after_period_unit", default: "days" - t.boolean "use_screening_assessment", default: false - t.integer "screening_assessment_form_id" - t.boolean "show_prev_assessment", default: false - t.boolean "two_weeks_assessment_reminder", default: false - end - - add_index "settings", ["commune_id"], name: "index_settings_on_commune_id", using: :btree - add_index "settings", ["district_id"], name: "index_settings_on_district_id", using: :btree - add_index "settings", ["province_id"], name: "index_settings_on_province_id", using: :btree + t.string "org_name", default: "" + t.string "old_commune", default: "" + t.integer "province_id" + t.integer "district_id" + t.integer "age", default: 18 + t.integer "commune_id" + t.string "custom_assessment", default: "Custom Assessment" + t.boolean "enable_custom_assessment", default: false + t.boolean "enable_default_assessment", default: true + t.integer "max_custom_assessment", default: 6 + t.string "custom_assessment_frequency", default: "month" + t.integer "custom_age", default: 18 + t.string "default_assessment", default: "CSI Assessment" + t.boolean "sharing_data", default: false + t.string "custom_id1_latin", default: "" + t.string "custom_id1_local", default: "" + t.string "custom_id2_latin", default: "" + t.string "custom_id2_local", default: "" + t.boolean "enable_hotline", default: false + t.boolean "enable_client_form", default: true + t.string "assessment_score_order", default: "random_order", null: false + t.boolean "disable_required_fields", default: false, null: false + t.boolean "never_delete_incomplete_assessment", default: false, null: false + t.integer "delete_incomplete_after_period_value", default: 7 + t.string "delete_incomplete_after_period_unit", default: "days" + t.boolean "use_screening_assessment", default: false + t.integer "screening_assessment_form_id" + t.boolean "show_prev_assessment", default: false + t.boolean "two_weeks_assessment_reminder", default: false + t.index ["commune_id"], name: "index_settings_on_commune_id" + t.index ["district_id"], name: "index_settings_on_district_id" + t.index ["province_id"], name: "index_settings_on_province_id" + end create_table "shared_clients", force: :cascade do |t| - t.string "slug", default: "" - t.string "given_name", default: "" - t.string "family_name", default: "" - t.string "local_given_name", default: "" - t.string "local_family_name", default: "" - t.string "gender", default: "" - t.date "date_of_birth" - t.string "live_with", default: "" - t.string "telephone_number", default: "" - t.integer "birth_province_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "country_origin", default: "" - t.string "duplicate_checker" - t.string "archived_slug" - t.string "global_id" - t.string "external_id" - t.string "external_id_display" - t.string "mosvy_number" - t.string "external_case_worker_name" - t.string "external_case_worker_id" - end - - add_index "shared_clients", ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker", using: :btree - add_index "shared_clients", ["external_id"], name: "index_shared_clients_on_external_id", using: :btree - add_index "shared_clients", ["global_id"], name: "index_shared_clients_on_global_id", using: :btree - add_index "shared_clients", ["mosvy_number"], name: "index_shared_clients_on_mosvy_number", using: :btree - add_index "shared_clients", ["slug"], name: "index_shared_clients_on_slug", unique: true, using: :btree + t.string "slug", default: "" + t.string "given_name", default: "" + t.string "family_name", default: "" + t.string "local_given_name", default: "" + t.string "local_family_name", default: "" + t.string "gender", default: "" + t.date "date_of_birth" + t.string "live_with", default: "" + t.string "telephone_number", default: "" + t.integer "birth_province_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "country_origin", default: "" + t.string "duplicate_checker" + t.string "archived_slug" + t.string "global_id" + t.string "external_id" + t.string "external_id_display" + t.string "mosvy_number" + t.string "external_case_worker_name" + t.string "external_case_worker_id" + t.index ["duplicate_checker"], name: "index_shared_clients_on_duplicate_checker" + t.index ["external_id"], name: "index_shared_clients_on_external_id" + t.index ["global_id"], name: "index_shared_clients_on_global_id" + t.index ["mosvy_number"], name: "index_shared_clients_on_mosvy_number" + t.index ["slug"], name: "index_shared_clients_on_slug", unique: true + end create_table "sponsors", force: :cascade do |t| - t.integer "client_id" - t.integer "donor_id" + t.integer "client_id" + t.integer "donor_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_sponsors_on_client_id" + t.index ["donor_id"], name: "index_sponsors_on_donor_id" end - add_index "sponsors", ["client_id"], name: "index_sponsors_on_client_id", using: :btree - add_index "sponsors", ["donor_id"], name: "index_sponsors_on_donor_id", using: :btree - create_table "stages", force: :cascade do |t| - t.float "from_age" - t.float "to_age" + t.float "from_age" + t.float "to_age" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "states", force: :cascade do |t| - t.string "name" + t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "subdistricts", force: :cascade do |t| - t.string "name" - t.integer "district_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name" + t.integer "district_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["district_id"], name: "index_subdistricts_on_district_id" end - add_index "subdistricts", ["district_id"], name: "index_subdistricts_on_district_id", using: :btree - create_table "surveys", force: :cascade do |t| - t.integer "client_id" - t.integer "user_id" - t.integer "listening_score" - t.integer "problem_solving_score" - t.integer "getting_in_touch_score" - t.integer "trust_score" - t.integer "difficulty_help_score" - t.integer "support_score" - t.integer "family_need_score" - t.integer "care_score" + t.integer "client_id" + t.integer "user_id" + t.integer "listening_score" + t.integer "problem_solving_score" + t.integer "getting_in_touch_score" + t.integer "trust_score" + t.integer "difficulty_help_score" + t.integer "support_score" + t.integer "family_need_score" + t.integer "care_score" t.datetime "created_at" t.datetime "updated_at" + t.index ["client_id"], name: "index_surveys_on_client_id" end - add_index "surveys", ["client_id"], name: "index_surveys_on_client_id", using: :btree - create_table "tasks", force: :cascade do |t| - t.string "name", default: "" - t.date "completion_date" + t.string "name", default: "" + t.date "completion_date" t.datetime "remind_at" - t.boolean "completed", default: false - t.integer "user_id" - t.integer "case_note_domain_group_id" - t.integer "domain_id" + t.boolean "completed", default: false + t.integer "user_id" + t.integer "case_note_domain_group_id" + t.integer "domain_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "client_id" - t.string "relation", default: "" - t.string "case_note_id", default: "" - t.integer "taskable_id" - t.string "taskable_type" + t.integer "client_id" + t.string "relation", default: "" + t.string "case_note_id", default: "" + t.integer "taskable_id" + t.string "taskable_type" t.datetime "deleted_at" + t.index ["client_id"], name: "index_tasks_on_client_id" + t.index ["deleted_at"], name: "index_tasks_on_deleted_at" + t.index ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id" end - add_index "tasks", ["client_id"], name: "index_tasks_on_client_id", using: :btree - add_index "tasks", ["deleted_at"], name: "index_tasks_on_deleted_at", using: :btree - add_index "tasks", ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id", using: :btree - create_table "thredded_categories", force: :cascade do |t| - t.integer "messageboard_id", null: false - t.string "name", limit: 191, null: false - t.string "description", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "slug", limit: 191, null: false + t.integer "messageboard_id", null: false + t.string "name", limit: 191, null: false + t.string "description", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "slug", limit: 191, null: false + t.index ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true + t.index ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id" end - add_index "thredded_categories", ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true, using: :btree - add_index "thredded_categories", ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id", using: :btree - create_table "thredded_messageboard_groups", force: :cascade do |t| - t.string "name" + t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "thredded_messageboards", force: :cascade do |t| - t.string "name", limit: 255, null: false - t.string "slug", limit: 191 - t.text "description" - t.integer "topics_count", default: 0 - t.integer "posts_count", default: 0 - t.boolean "closed", default: false, null: false - t.integer "last_topic_id" - t.integer "messageboard_group_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "thredded_messageboards", ["closed"], name: "index_thredded_messageboards_on_closed", using: :btree - add_index "thredded_messageboards", ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id", using: :btree - add_index "thredded_messageboards", ["slug"], name: "index_thredded_messageboards_on_slug", using: :btree + t.string "name", limit: 255, null: false + t.string "slug", limit: 191 + t.text "description" + t.integer "topics_count", default: 0 + t.integer "posts_count", default: 0 + t.boolean "closed", default: false, null: false + t.integer "last_topic_id" + t.integer "messageboard_group_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["closed"], name: "index_thredded_messageboards_on_closed" + t.index ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id" + t.index ["slug"], name: "index_thredded_messageboards_on_slug" + end create_table "thredded_post_moderation_records", force: :cascade do |t| - t.integer "post_id" - t.integer "messageboard_id" - t.text "post_content" - t.integer "post_user_id" - t.text "post_user_name" - t.integer "moderator_id" - t.integer "moderation_state", null: false - t.integer "previous_moderation_state", null: false - t.datetime "created_at", null: false + t.integer "post_id" + t.integer "messageboard_id" + t.text "post_content" + t.integer "post_user_id" + t.text "post_user_name" + t.integer "moderator_id" + t.integer "moderation_state", null: false + t.integer "previous_moderation_state", null: false + t.datetime "created_at", null: false + t.index ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: { created_at: :desc } end - add_index "thredded_post_moderation_records", ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: {"created_at"=>:desc}, using: :btree - create_table "thredded_post_notifications", force: :cascade do |t| - t.string "email", limit: 191, null: false - t.integer "post_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "post_type", limit: 191 + t.string "email", limit: 191, null: false + t.integer "post_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "post_type", limit: 191 + t.index ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post" end - add_index "thredded_post_notifications", ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post", using: :btree - create_table "thredded_posts", force: :cascade do |t| - t.integer "user_id" - t.text "content" - t.string "ip", limit: 255 - t.string "source", limit: 255, default: "web" - t.integer "postable_id", null: false - t.integer "messageboard_id", null: false - t.integer "moderation_state", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "thredded_posts", ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id", using: :btree - add_index "thredded_posts", ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display", using: :btree - add_index "thredded_posts", ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type", using: :btree - add_index "thredded_posts", ["user_id"], name: "index_thredded_posts_on_user_id", using: :btree + t.integer "user_id" + t.text "content" + t.string "ip", limit: 255 + t.string "source", limit: 255, default: "web" + t.integer "postable_id", null: false + t.integer "messageboard_id", null: false + t.integer "moderation_state", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id" + t.index ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display" + t.index ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type" + t.index ["user_id"], name: "index_thredded_posts_on_user_id" + end create_table "thredded_private_posts", force: :cascade do |t| - t.integer "user_id" - t.text "content" - t.integer "postable_id", null: false - t.string "ip", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "user_id" + t.text "content" + t.integer "postable_id", null: false + t.string "ip", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "thredded_private_topics", force: :cascade do |t| - t.integer "user_id" - t.integer "last_user_id" - t.string "title", limit: 255, null: false - t.string "slug", limit: 191, null: false - t.integer "posts_count", default: 0 - t.string "hash_id", limit: 191, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "user_id" + t.integer "last_user_id" + t.string "title", limit: 255, null: false + t.string "slug", limit: 191, null: false + t.integer "posts_count", default: 0 + t.string "hash_id", limit: 191, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["hash_id"], name: "index_thredded_private_topics_on_hash_id" + t.index ["slug"], name: "index_thredded_private_topics_on_slug" end - add_index "thredded_private_topics", ["hash_id"], name: "index_thredded_private_topics_on_hash_id", using: :btree - add_index "thredded_private_topics", ["slug"], name: "index_thredded_private_topics_on_slug", using: :btree - create_table "thredded_private_users", force: :cascade do |t| - t.integer "private_topic_id" - t.integer "user_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "private_topic_id" + t.integer "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id" + t.index ["user_id"], name: "index_thredded_private_users_on_user_id" end - add_index "thredded_private_users", ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id", using: :btree - add_index "thredded_private_users", ["user_id"], name: "index_thredded_private_users_on_user_id", using: :btree - create_table "thredded_topic_categories", force: :cascade do |t| - t.integer "topic_id", null: false + t.integer "topic_id", null: false t.integer "category_id", null: false + t.index ["category_id"], name: "index_thredded_topic_categories_on_category_id" + t.index ["topic_id"], name: "index_thredded_topic_categories_on_topic_id" end - add_index "thredded_topic_categories", ["category_id"], name: "index_thredded_topic_categories_on_category_id", using: :btree - add_index "thredded_topic_categories", ["topic_id"], name: "index_thredded_topic_categories_on_topic_id", using: :btree - create_table "thredded_topics", force: :cascade do |t| - t.integer "user_id" - t.integer "last_user_id" - t.string "title", limit: 255, null: false - t.string "slug", limit: 191, null: false - t.integer "messageboard_id", null: false - t.integer "posts_count", default: 0, null: false - t.boolean "sticky", default: false, null: false - t.boolean "locked", default: false, null: false - t.string "hash_id", limit: 191, null: false - t.string "type", limit: 191 - t.integer "moderation_state", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "thredded_topics", ["hash_id"], name: "index_thredded_topics_on_hash_id", using: :btree - add_index "thredded_topics", ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true, using: :btree - add_index "thredded_topics", ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id", using: :btree - add_index "thredded_topics", ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: {"sticky"=>:desc, "updated_at"=>:desc}, using: :btree - add_index "thredded_topics", ["user_id"], name: "index_thredded_topics_on_user_id", using: :btree + t.integer "user_id" + t.integer "last_user_id" + t.string "title", limit: 255, null: false + t.string "slug", limit: 191, null: false + t.integer "messageboard_id", null: false + t.integer "posts_count", default: 0, null: false + t.boolean "sticky", default: false, null: false + t.boolean "locked", default: false, null: false + t.string "hash_id", limit: 191, null: false + t.string "type", limit: 191 + t.integer "moderation_state", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["hash_id"], name: "index_thredded_topics_on_hash_id" + t.index ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true + t.index ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id" + t.index ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: { sticky: :desc, updated_at: :desc } + t.index ["user_id"], name: "index_thredded_topics_on_user_id" + end create_table "thredded_user_details", force: :cascade do |t| - t.integer "user_id", null: false + t.integer "user_id", null: false t.datetime "latest_activity_at" - t.integer "posts_count", default: 0 - t.integer "topics_count", default: 0 + t.integer "posts_count", default: 0 + t.integer "topics_count", default: 0 t.datetime "last_seen_at" - t.integer "moderation_state", default: 1, null: false + t.integer "moderation_state", default: 1, null: false t.datetime "moderation_state_changed_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at" + t.index ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: { moderation_state_changed_at: :desc } + t.index ["user_id"], name: "index_thredded_user_details_on_user_id" end - add_index "thredded_user_details", ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at", using: :btree - add_index "thredded_user_details", ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: {"moderation_state_changed_at"=>:desc}, using: :btree - add_index "thredded_user_details", ["user_id"], name: "index_thredded_user_details_on_user_id", using: :btree - create_table "thredded_user_messageboard_preferences", force: :cascade do |t| - t.integer "user_id", null: false - t.integer "messageboard_id", null: false - t.boolean "notify_on_mention", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "user_id", null: false + t.integer "messageboard_id", null: false + t.boolean "notify_on_mention", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true end - add_index "thredded_user_messageboard_preferences", ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true, using: :btree - create_table "thredded_user_preferences", force: :cascade do |t| - t.integer "user_id", null: false - t.boolean "notify_on_mention", default: true, null: false - t.boolean "notify_on_message", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "user_id", null: false + t.boolean "notify_on_mention", default: true, null: false + t.boolean "notify_on_message", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_thredded_user_preferences_on_user_id" end - add_index "thredded_user_preferences", ["user_id"], name: "index_thredded_user_preferences_on_user_id", using: :btree - create_table "thredded_user_private_topic_read_states", force: :cascade do |t| - t.integer "user_id", null: false - t.integer "postable_id", null: false - t.integer "page", default: 1, null: false - t.datetime "read_at", null: false + t.integer "user_id", null: false + t.integer "postable_id", null: false + t.integer "page", default: 1, null: false + t.datetime "read_at", null: false + t.index ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true end - add_index "thredded_user_private_topic_read_states", ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true, using: :btree - create_table "thredded_user_topic_follows", force: :cascade do |t| - t.integer "user_id", null: false - t.integer "topic_id", null: false - t.datetime "created_at", null: false - t.integer "reason", limit: 2 + t.integer "user_id", null: false + t.integer "topic_id", null: false + t.datetime "created_at", null: false + t.integer "reason", limit: 2 + t.index ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true end - add_index "thredded_user_topic_follows", ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true, using: :btree - create_table "thredded_user_topic_read_states", force: :cascade do |t| - t.integer "user_id", null: false - t.integer "postable_id", null: false - t.integer "page", default: 1, null: false - t.datetime "read_at", null: false + t.integer "user_id", null: false + t.integer "postable_id", null: false + t.integer "page", default: 1, null: false + t.datetime "read_at", null: false + t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true end - add_index "thredded_user_topic_read_states", ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true, using: :btree - create_table "townships", force: :cascade do |t| - t.string "name" - t.integer "state_id" + t.string "name" + t.integer "state_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["state_id"], name: "index_townships_on_state_id" end - add_index "townships", ["state_id"], name: "index_townships_on_state_id", using: :btree - create_table "trackings", force: :cascade do |t| - t.string "name", default: "" - t.jsonb "fields", default: {} - t.string "frequency", default: "" - t.integer "time_of_frequency" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name", default: "" + t.jsonb "fields", default: {} + t.string "frequency", default: "" + t.integer "time_of_frequency" + t.integer "program_stream_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.datetime "deleted_at" + t.index ["deleted_at"], name: "index_trackings_on_deleted_at" + t.index ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true + t.index ["program_stream_id"], name: "index_trackings_on_program_stream_id" end - add_index "trackings", ["deleted_at"], name: "index_trackings_on_deleted_at", using: :btree - add_index "trackings", ["name", "program_stream_id"], name: "index_trackings_on_name_and_program_stream_id", unique: true, using: :btree - add_index "trackings", ["program_stream_id"], name: "index_trackings_on_program_stream_id", using: :btree - create_table "users", force: :cascade do |t| - t.string "first_name", default: "" - t.string "last_name", default: "" - t.string "roles", default: "case worker" - t.date "start_date" - t.string "job_title", default: "" - t.string "mobile", default: "" - t.date "date_of_birth" - t.boolean "archived", default: false - t.integer "province_id" - t.integer "department_id" + t.string "first_name", default: "" + t.string "last_name", default: "" + t.string "roles", default: "case worker" + t.date "start_date" + t.string "job_title", default: "" + t.string "mobile", default: "" + t.date "date_of_birth" + t.boolean "archived", default: false + t.integer "province_id" + t.integer "department_id" t.datetime "created_at" t.datetime "updated_at" - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.inet "current_sign_in_ip" - t.inet "last_sign_in_ip" - t.integer "clients_count", default: 0 - t.integer "cases_count", default: 0 - t.integer "tasks_count", default: 0 - t.string "provider", default: "email", null: false - t.string "uid", default: "", null: false - t.json "tokens" - t.boolean "admin", default: false - t.integer "changelogs_count", default: 0 - t.integer "organization_id" - t.boolean "disable", default: false + t.inet "current_sign_in_ip" + t.inet "last_sign_in_ip" + t.integer "clients_count", default: 0 + t.integer "cases_count", default: 0 + t.integer "tasks_count", default: 0 + t.string "provider", default: "email", null: false + t.string "uid", default: "", null: false + t.json "tokens" + t.boolean "admin", default: false + t.integer "changelogs_count", default: 0 + t.integer "organization_id" + t.boolean "disable", default: false t.datetime "expires_at" - t.boolean "task_notify", default: true - t.integer "manager_id" - t.boolean "calendar_integration", default: false - t.integer "pin_number" - t.integer "manager_ids", default: [], array: true - t.boolean "program_warning", default: false - t.boolean "staff_performance_notification", default: true - t.string "pin_code", default: "" - t.boolean "domain_warning", default: false - t.boolean "referral_notification", default: false - t.string "gender", default: "" - t.boolean "enable_gov_log_in", default: false - t.boolean "enable_research_log_in", default: false + t.boolean "task_notify", default: true + t.integer "manager_id" + t.boolean "calendar_integration", default: false + t.integer "pin_number" + t.integer "manager_ids", default: [], array: true + t.boolean "program_warning", default: false + t.boolean "staff_performance_notification", default: true + t.string "pin_code", default: "" + t.boolean "domain_warning", default: false + t.boolean "referral_notification", default: false + t.string "gender", default: "" + t.boolean "enable_gov_log_in", default: false + t.boolean "enable_research_log_in", default: false t.datetime "activated_at" t.datetime "deactivated_at" t.datetime "deleted_at" - t.string "preferred_language", default: "en" - t.string "organization_name" - t.string "profile" + t.string "preferred_language", default: "en" + t.string "organization_name" + t.string "profile" + t.index ["deleted_at"], name: "index_users_on_deleted_at" + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["organization_id"], name: "index_users_on_organization_id" + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end - add_index "users", ["deleted_at"], name: "index_users_on_deleted_at", using: :btree - add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree - add_index "users", ["organization_id"], name: "index_users_on_organization_id", using: :btree - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree - create_table "version_associations", force: :cascade do |t| t.integer "version_id" - t.string "foreign_key_name", null: false + t.string "foreign_key_name", null: false t.integer "foreign_key_id" + t.string "foreign_type" + t.index ["foreign_key_name", "foreign_key_id", "foreign_type"], name: "index_version_associations_on_foreign_key" + t.index ["version_id"], name: "index_version_associations_on_version_id" end - add_index "version_associations", ["foreign_key_name", "foreign_key_id"], name: "index_version_associations_on_foreign_key", using: :btree - add_index "version_associations", ["version_id"], name: "index_version_associations_on_version_id", using: :btree - create_table "versions", force: :cascade do |t| - t.string "item_type", null: false - t.integer "item_id", null: false - t.string "event", null: false - t.string "whodunnit" - t.text "object" + t.string "item_type", null: false + t.integer "item_id", null: false + t.string "event", null: false + t.string "whodunnit" + t.text "object" t.datetime "created_at" - t.text "object_changes" - t.integer "transaction_id" + t.text "object_changes" + t.integer "transaction_id" + t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" + t.index ["transaction_id"], name: "index_versions_on_transaction_id" end - add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree - add_index "versions", ["transaction_id"], name: "index_versions_on_transaction_id", using: :btree - create_table "villages", force: :cascade do |t| - t.string "code", default: "" - t.string "name_kh", default: "" - t.string "name_en", default: "" - t.integer "commune_id" + t.string "code", default: "" + t.string "name_kh", default: "" + t.string "name_en", default: "" + t.integer "commune_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["commune_id"], name: "index_villages_on_commune_id" end - add_index "villages", ["commune_id"], name: "index_villages_on_commune_id", using: :btree - create_table "visit_clients", force: :cascade do |t| - t.integer "user_id" + t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.time "deleted_at" + t.time "deleted_at" + t.index ["user_id"], name: "index_visit_clients_on_user_id" end - add_index "visit_clients", ["user_id"], name: "index_visit_clients_on_user_id", using: :btree - create_table "visits", force: :cascade do |t| - t.integer "user_id" + t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.time "deleted_at" + t.time "deleted_at" + t.index ["user_id"], name: "index_visits_on_user_id" end - add_index "visits", ["user_id"], name: "index_visits_on_user_id", using: :btree - add_foreign_key "able_screening_questions", "question_groups" add_foreign_key "able_screening_questions", "stages" add_foreign_key "action_results", "government_forms" From 2bfc780ecbce8c980661564b3a086251eecb0685 Mon Sep 17 00:00:00 2001 From: kirykr Date: Mon, 21 Dec 2020 12:06:42 +0700 Subject: [PATCH 13/27] worked on fixing migration duplicates --- db/migrate/20160202073717_create_provinces.rb | 2 +- db/migrate/20160202073847_create_referral_sources.rb | 2 +- db/migrate/20160202074103_create_agencies.rb | 2 +- db/migrate/20160202074149_create_domain_groups.rb | 2 +- db/migrate/20160202074345_create_domains.rb | 2 +- db/migrate/20160202074629_create_departments.rb | 2 +- db/migrate/20160202074846_create_families.rb | 2 +- db/migrate/20160202075903_create_partners.rb | 2 +- db/migrate/20160202080206_create_users.rb | 2 +- db/migrate/20160202082051_create_clients.rb | 2 +- db/migrate/20160202085430_create_cases.rb | 2 +- db/migrate/20160202095024_create_assessments.rb | 2 +- db/migrate/20160202095145_create_assessment_domains.rb | 2 +- db/migrate/20160202095805_create_agencies_clients.rb | 2 +- db/migrate/20160202095859_create_case_notes.rb | 2 +- .../20160202100103_create_case_note_domain_groups.rb | 2 +- db/migrate/20160202100433_create_tasks.rb | 2 +- db/migrate/20160202100848_add_devise_to_users.rb | 2 +- ...0202101143_add_counter_cache_to_all_associations.rb | 2 +- .../20160216015733_add_client_reference_to_task.rb | 2 +- db/migrate/20160218080703_add_completed_to_clients.rb | 2 +- .../20160218081238_add_family_preservation_to_cases.rb | 2 +- db/migrate/20160218083422_create_quantitative_types.rb | 2 +- db/migrate/20160218083606_create_quantitative_cases.rb | 2 +- ...20160219031802_create_clients_quantitative_cases.rb | 2 +- db/migrate/20160220161914_create_quarterly_reports.rb | 2 +- db/migrate/20160222020203_update_references.rb | 2 +- db/migrate/20160222090336_create_case_contracts.rb | 2 +- .../20160222112312_add_missing_field_to_client.rb | 2 +- .../20160222112535_add_missing_field_to_cases.rb | 2 +- .../20160223072851_add_exited_from_cif_to_case.rb | 2 +- .../20160229164608_devise_token_auth_create_users.rb | 4 ++-- db/migrate/20160303021506_add_grade_to_client.rb | 4 ++-- ...0304071711_change_assessment_domain_score_column.rb | 2 +- db/migrate/20160305051724_update_user_data.rb | 2 +- db/migrate/20160328070346_add_score_color_to_domain.rb | 2 +- db/migrate/20160425070622_add_slug_to_client.rb | 2 +- db/migrate/20160425084248_create_friendly_id_slugs.rb | 2 +- .../20160425084249_update_old_client_alias_id.rb | 2 +- .../20160426020733_add_goal_to_assessment_domain.rb | 2 +- db/migrate/20160505031003_create_government_report.rb | 6 +++--- db/migrate/20160809092723_add_name_to_user.rb | 2 +- db/migrate/20160816034530_add_admin_to_user.rb | 4 ++-- db/migrate/20160816092724_create_thredded.thredded.rb | 2 +- db/migrate/20160817021354_remove_name_from_user.rb | 2 +- db/migrate/20160817075800_create_survey.rb | 2 +- db/migrate/20160908074157_create_changelog.rb | 2 +- db/migrate/20160919040653_create_material.rb | 2 +- db/migrate/20160920014557_create_location.rb | 2 +- db/migrate/20160920023649_create_progress_note_type.rb | 2 +- db/migrate/20160920041253_create_intervention.rb | 2 +- db/migrate/20160920081903_create_progress_note.rb | 2 +- db/migrate/20160920083452_create_stages.rb | 2 +- ...160920083920_create_interventions_progress_notes.rb | 2 +- .../20160920085515_create_able_screening_questions.rb | 2 +- db/migrate/20160920091650_create_answers.rb | 2 +- ...0921031639_add_user_association_to_progress_note.rb | 2 +- ...1065318_create_assessment_domains_progress_notes.rb | 2 +- ...d_alert_manager_field_to_able_screening_question.rb | 2 +- db/migrate/20160922092536_create_attachments.rb | 2 +- .../20160923043225_add_non_stage_field_to_stage.rb | 2 +- .../20160923072931_add_order_option_to_location.rb | 2 +- .../20160923084811_add_client_able_state_to_client.rb | 2 +- db/migrate/20160926042656_create_changelog_types.rb | 2 +- db/migrate/20160926074038_create_question_groups.rb | 2 +- ...stion_group_reference_to_able_screening_question.rb | 2 +- ...032508_remove_group_from_able_screening_question.rb | 2 +- db/migrate/20161005095556_create_versions.rb | 2 +- .../20161005095557_add_object_changes_to_versions.rb | 2 +- ...20161006020147_remove_non_stage_field_from_stage.rb | 2 +- .../20161006020906_create_version_associations.rb | 2 +- ...1006020907_add_transaction_id_column_to_versions.rb | 2 +- .../20161007045746_add_question_type_to_answer.rb | 2 +- .../20161010071854_update_able_state_of_able_client.rb | 2 +- .../20161018070113_rename_changelog_version_column.rb | 2 +- db/migrate/20161128035346_create_agency_clients.rb | 2 +- .../20161128064447_create_client_quantitative_cases.rb | 2 +- db/migrate/20161205040355_create_organizations.rb | 2 +- ...61207075009_add_reference_orignaztion_id_to_user.rb | 2 +- ...093338_fix_apartment_contraint_user_organization.rb | 2 +- db/migrate/20161215033551_add_file_to_attachment.rb | 2 +- ...1215070129_add_assessments_count_field_to_client.rb | 2 +- db/migrate/20161220064910_add_current_field_to_case.rb | 2 +- ...020143_change_default_value_of_domain_four_score.rb | 2 +- db/migrate/20170113100759_add_disable_to_users.rb | 2 +- db/migrate/20170118021235_create_custom_fields.rb | 2 +- .../20170202041655_create_client_custom_fields.rb | 2 +- ...170202042709_add_form_type_field_to_custom_field.rb | 2 +- .../20170202091136_create_family_custom_fields.rb | 2 +- .../20170206041958_create_partner_custom_fields.rb | 2 +- db/migrate/20170206070346_create_user_custom_fields.rb | 2 +- db/migrate/20170220064405_create_donors.rb | 2 +- .../20170220064819_add_donor_association_to_clients.rb | 2 +- ...ange_entity_name_to_entity_type_in_custom_fields.rb | 2 +- ...change_form_type_to_forom_title_in_custom_fields.rb | 2 +- .../20170302041000_add_frequency_to_custom_field.rb | 2 +- .../20170310043816_set_deafult_to_client_able_state.rb | 2 +- ...1128_update_visitor_role_to_strategic_overviewer.rb | 2 +- ...094205_add_client_first_name_and_last_name_local.rb | 2 +- ...17_split_client_name_to_first_name_and_last_name.rb | 2 +- ...0322045636_add_organization_name_to_custom_field.rb | 2 +- ...2074147_update_organization_name_in_custom_field.rb | 4 ++-- .../20170327015408_add_columns_for_icf_data_import.rb | 2 +- db/migrate/20170419023745_rename_client_name_fields.rb | 2 +- .../20170419032405_create_custom_field_properties.rb | 2 +- ...ove_client_custom_field_to_custom_field_property.rb | 2 +- ...ove_family_custom_field_to_custom_field_property.rb | 2 +- ...ve_partner_custom_field_to_custom_field_property.rb | 2 +- ..._move_user_custom_field_to_custom_field_property.rb | 2 +- .../20170504065720_add_expires_at_field_to_user.rb | 2 +- .../20170505025525_add_task_notify_field_to_user.rb | 2 +- .../20170505074210_add_manager_id_field_to_user.rb | 2 +- db/migrate/20170505074620_add_fields_to_client.rb | 2 +- ...505081953_add_calendar_integration_field_to_user.rb | 2 +- ...6023913_rename_field_in_custom_field_to_property.rb | 2 +- db/migrate/20170516034013_add_field_to_custom_field.rb | 2 +- ...516034242_move_property_to_field_in_custom_field.rb | 4 ++-- .../20170516082144_add_fields_to_client_for_cfi.rb | 2 +- db/migrate/20170517031807_add_pin_number_to_user.rb | 2 +- db/migrate/20170517043459_create_program_streams.rb | 2 +- .../20170517082509_add_fields_to_program_stream.rb | 2 +- ...18031811_add_attachment_to_custom_field_property.rb | 2 +- .../20170524021751_create_domain_program_streams.rb | 2 +- ...20170524033834_add_field_fcf_ngo_to_organization.rb | 2 +- ...70524071015_add_field_quantity_to_program_stream.rb | 2 +- db/migrate/20170525081727_create_visits.rb | 2 +- db/migrate/20170529024845_create_client_enrollments.rb | 2 +- db/migrate/20170529025228_create_trackings.rb | 2 +- db/migrate/20170529025247_create_leave_programs.rb | 2 +- ...628_add_field_program_stream_id_to_leave_program.rb | 2 +- ...01025654_add_field_program_stream_id_to_tracking.rb | 2 +- ...70607085522_add_field_ngo_name_to_program_stream.rb | 2 +- ...8035858_rename_tracking_table_to_client_tracking.rb | 2 +- db/migrate/20170608043550_tracking.rb | 2 +- ...02_add_tracking_id_to_client_enrollment_tracking.rb | 2 +- db/migrate/20170613025900_add_manager_ids_to_user.rb | 2 +- .../20170613030148_move_manager_id_to_manager_ids.rb | 2 +- .../20170614085443_add_unique_index_to_tracking.rb | 2 +- ...73859_rename_field_poverty_certificate_in_client.rb | 2 +- ...0035801_add_attachment_to_case_note_domain_group.rb | 2 +- ...0092900_add_rule_default_value_to_program_stream.rb | 2 +- ...3_add_enrollment_default_value_to_program_stream.rb | 2 +- ...dd_leave_program_default_value_to_program_stream.rb | 2 +- ...70621072056_add_attachments_to_assessment_domain.rb | 2 +- ...70621084646_add_fields_default_value_to_tracking.rb | 2 +- ...0622041205_add_completed_field_to_program_stream.rb | 2 +- ...20170703034520_remove_fields_from_program_stream.rb | 2 +- ...rogram_stream_id_from_client_enrollment_tracking.rb | 2 +- db/migrate/20170704070624_create_calendars.rb | 2 +- ...0706083521_add_exit_note_and_exit_date_to_client.rb | 2 +- db/migrate/20170710030328_create_case_worker_client.rb | 2 +- ...xclusive_and_mutual_dependence_to_program_stream.rb | 2 +- ...28_add_enrollment_date_to_client_enrollment_form.rb | 2 +- .../20170718090148_add_exit_date_to_leave_program.rb | 2 +- db/migrate/20170721064826_create_case_worker_task.rb | 2 +- ...20170727032556_add_field_accepted_date_to_client.rb | 2 +- .../20170801072754_add_tracking_to_program_stream.rb | 2 +- ...20170802065632_add_field_program_warning_to_user.rb | 2 +- .../20170802093802_create_form_builder_attachments.rb | 2 +- ...804045709_add_default_field_to_client_enrollment.rb | 2 +- ...0170804045725_add_default_field_to_leave_program.rb | 2 +- ..._add_default_field_to_client_enrollment_tracking.rb | 2 +- ...44532_add_staff_performance_notification_to_user.rb | 2 +- db/migrate/20170824021544_create_visit_client.rb | 2 +- ...13025014_add_field_interaction_type_to_case_note.rb | 2 +- ...remove_default_value_id_poor_and_grade_in_client.rb | 2 +- .../20170927071506_add_clients_field_to_family.rb | 2 +- db/migrate/20170927092118_create_advanced_searches.rb | 2 +- db/migrate/20171001033957_create_interviewee.rb | 2 +- db/migrate/20171001034252_create_client_interviewee.rb | 2 +- db/migrate/20171001034328_create_client_type.rb | 2 +- db/migrate/20171001034536_create_client_client_type.rb | 2 +- db/migrate/20171001034640_create_need.rb | 2 +- db/migrate/20171001034708_create_client_need.rb | 2 +- db/migrate/20171001034726_create_problem.rb | 2 +- db/migrate/20171001034756_create_client_problem.rb | 2 +- .../20171002022338_add_government_fields_to_client.rb | 2 +- db/migrate/20171009024810_create_permissions.rb | 2 +- .../20171009034120_add_user_id_to_advanced_search.rb | 2 +- .../20171009083951_create_custom_field_permissions.rb | 2 +- ...20171011040334_create_program_stream_permissions.rb | 4 ++-- .../20171023093833_change_permission_defalut_values.rb | 2 +- db/migrate/20171109080435_add_pin_code_to_user.rb | 2 +- .../20171123041647_move_grade_to_school_grade.rb | 2 +- .../20171124030426_add_field_domain_warning_to_user.rb | 2 +- db/migrate/20180104030119_create_district.rb | 2 +- db/migrate/20180105044017_add_district_id_to_client.rb | 2 +- ...nge_field_district_to_archive_district_to_client.rb | 2 +- ...80116031324_add_field_telephone_number_to_client.rb | 2 +- ...80306034903_add_multi_step_form_fields_to_client.rb | 2 +- ...20180314085911_add_fields_for_exit_ngo_to_client.rb | 2 +- db/migrate/20180402022052_create_setting.rb | 2 +- db/migrate/20180403085536_create_enter_ngo.rb | 2 +- db/migrate/20180403085748_create_exit_ngo.rb | 2 +- db/migrate/20180406024720_create_enter_ngo_user.rb | 2 +- ...0180419021522_add_international_fields_to_client.rb | 2 +- db/migrate/20180419023155_create_states.rb | 2 +- db/migrate/20180419023435_create_townships.rb | 2 +- db/migrate/20180419025035_create_subdistricts.rb | 2 +- ...338_add_internatinal_adress_references_to_client.rb | 2 +- ...48_change_field_state_to_archive_state_to_client.rb | 2 +- ...180423014515_add_user_to_custom_field_properties.rb | 2 +- ...80427035634_create_quantitative_type_permissions.rb | 2 +- db/migrate/20180506040228_add_timestamps_to_setting.rb | 2 +- ...e_organization_type_to_archive_organization_type.rb | 2 +- db/migrate/20180507051755_create_organization_types.rb | 2 +- ...0507051830_add_organization_type_ref_to_partners.rb | 2 +- db/migrate/20180524024004_create_referrals.rb | 2 +- db/migrate/20180524044456_create_shared_clients.rb | 2 +- db/migrate/20180530032127_add_country_to_provinces.rb | 2 +- .../20180530084737_change_default_column_clients.rb | 2 +- ...31024852_add_field_referral_notification_to_user.rb | 2 +- .../20180612073433_add_country_origin_to_client.rb | 2 +- .../20180620023347_change_consent_form_column_type.rb | 2 +- db/migrate/20180622081906_add_status_to_family.rb | 2 +- db/migrate/20180703094930_create_government_form.rb | 2 +- db/migrate/20180704070205_add_columns_to_families.rb | 2 +- db/migrate/20180705082629_add_fields_to_setting.rb | 2 +- ...0180705093607_create_government_form_interviewee.rb | 2 +- ...0180706083651_create_client_type_government_form.rb | 2 +- .../20180706085914_create_government_form_need.rb | 2 +- .../20180706092421_create_government_form_problem.rb | 2 +- db/migrate/20180709021636_create_family_members.rb | 2 +- db/migrate/20180712044911_create_children_plans.rb | 2 +- ...0712045031_create_government_form_children_plans.rb | 2 +- ...0180712092852_add_code_and_timestamp_to_district.rb | 2 +- db/migrate/20180713034135_create_family_plans.rb | 2 +- ...180713034226_create_government_form_family_plans.rb | 2 +- db/migrate/20180713102936_create_commune.rb | 2 +- db/migrate/20180713105414_create_village.rb | 2 +- ...22824_add_geography_reference_to_government_form.rb | 2 +- ...3421_add_fields_to_government_form_children_plan.rb | 2 +- ...083951_add_fields_to_government_form_family_plan.rb | 2 +- .../20180718022910_add_fields_to_government_form.rb | 2 +- db/migrate/20180718070909_create_service_types.rb | 2 +- ...80718071017_create_government_form_service_types.rb | 2 +- db/migrate/20180718072448_add_gender_field_to_users.rb | 2 +- db/migrate/20180718081014_create_client_rights.rb | 2 +- ...80718081031_create_client_right_government_forms.rb | 2 +- .../20180726023440_add_address_fields_to_families.rb | 2 +- ...07_rename_field_in_government_form_children_plan.rb | 2 +- .../20180731014745_change_government_form_fields.rb | 2 +- ...180808024324_add_commune_id_village_id_to_client.rb | 2 +- ...180808033036_add_commune_id_village_id_to_family.rb | 2 +- .../20180808035053_remove_default_client_fields.rb | 2 +- ...180808042845_change_column_name_in_client_family.rb | 2 +- .../20180808075606_add_age_fields_to_settings.rb | 2 +- db/migrate/20180809022059_add_commune_id_to_setting.rb | 2 +- .../20180809083746_add_guardian_to_family_member.rb | 2 +- db/migrate/20180813030846_create_sponsors.rb | 2 +- db/migrate/20180813072219_create_action_results.rb | 2 +- db/migrate/20180817042218_add_user_to_family.rb | 2 +- .../20180827023718_add_field_relation_to_task.rb | 2 +- ...dd_recent_issues_and_progress_to_government_form.rb | 2 +- db/migrate/20180906034129_create_case_closures.rb | 2 +- ...dd_other_case_closure_fields_to_government_forms.rb | 2 +- .../20180907035927_add_country_to_organization.rb | 2 +- ...20180917071148_add_priority_field_to_family_plan.rb | 2 +- db/migrate/20181019021124_add_profile_to_clients.rb | 2 +- db/migrate/20181023071121_add_status_to_assessments.rb | 2 +- db/migrate/20181030035922_add_definition_to_domain.rb | 2 +- .../20181031030528_add_custom_domain_to_domain.rb | 2 +- .../20181107032153_add_custom_csi_name_to_settings.rb | 2 +- db/migrate/20181112042033_add_default_to_assessment.rb | 2 +- .../20181112051352_add_fields_to_assessment_domain.rb | 2 +- ...20181112082013_add_custom_case_note_to_case_note.rb | 2 +- .../20181218071502_add_local_fields_to_domain.rb | 2 +- .../20190108045307_add_index_to_assessment_domain.rb | 2 +- ...0123075828_add_field_shared_anonymous_to_setting.rb | 2 +- ...le_gov_log_in_and_enable_research_log_in_to_user.rb | 2 +- ...0190227084038_add_archived_at_to_program_streams.rb | 2 +- .../20190301032544_add_deleted_to_client_enrollment.rb | 2 +- db/migrate/20190301033726_add_deleted_to_tracking.rb | 2 +- .../20190301034545_add_deleted_at_to_leave_program.rb | 2 +- ...1035300_add_deleted_at_to_domain_program_streams.rb | 2 +- ...5414_add_deleted_at_to_program_stream_permission.rb | 2 +- db/migrate/20190311025303_add_ngo_name_to_referral.rb | 2 +- ...8021414_add_activate_and_deactivate_date_to_user.rb | 2 +- .../20190320030908_add_name_en_to_referral_source.rb | 2 +- db/migrate/20190321033057_add_deleted_at_to_user.rb | 2 +- db/migrate/20190322023721_add_case_note_id_to_task.rb | 2 +- ...90404034803_change_data_type_of_government_forms.rb | 2 +- .../20190410023836_add_ancestry_to_referral_source.rb | 2 +- ...041510_add_referral_source_category_id_to_client.rb | 2 +- db/migrate/20190501084254_create_services.rb | 2 +- .../20190501085914_create_program_stream_services.rb | 2 +- ...508022540_add_duplicate_checker_to_shared_client.rb | 2 +- .../20190509031724_add_index_to_duplicate_checker.rb | 2 +- .../20190529031333_add_archived_slug_to_clients.rb | 2 +- db/migrate/20190627063528_drop_answers_table.rb | 2 +- ...627065544_drop_interventions_progress_note_table.rb | 2 +- ...627071643_drop_thredded_messageboard_users_table.rb | 2 +- ...5723_drop_assessment_domains_progress_note_table.rb | 2 +- .../20190726070312_add_custom_id_alias_to_setting.rb | 2 +- db/migrate/20190802065402_create_donor_organization.rb | 2 +- ...0814081157_fn_oscar_dashboard_assessment_domains.rb | 2 +- .../20190819041955_fn_oscar_dashboard_assessments.rb | 2 +- .../20190819042700_fn_oscar_dashboard_case_notes.rb | 2 +- ...0819042947_fn_oscar_dashboard_client_enrollments.rb | 2 +- ...228_fn_oscar_dashboard_client_quantitative_cases.rb | 2 +- .../20190819043419_fn_oscar_dashboard_districts.rb | 2 +- .../20190819043650_fn_oscar_dashboard_enter_ngos.rb | 2 +- .../20190819044012_fn_oscar_dashboard_exit_ngos.rb | 2 +- .../20190819044717_fn_oscar_dashboard_provinces.rb | 2 +- ...0819044845_fn_oscar_dashboard_quantitative_cases.rb | 2 +- ...0819045147_fn_oscar_dashboard_quantitative_types.rb | 2 +- .../20190819045449_fn_oscar_dashboard_referrals.rb | 2 +- .../20190820035300_fn_oscar_dashboard_domains.rb | 2 +- ...0190820085203_fn_oscar_dashboard_program_streams.rb | 2 +- .../20190820091522_fn_oscar_dashboard_services.rb | 2 +- ...91639_fn_oscar_dashboard_program_stream_services.rb | 2 +- ...add_field_case_note_domain_group_id_to_case_note.rb | 2 +- db/migrate/20190909064523_fn_oscar_dashboard_donors.rb | 2 +- ...190910023646_fn_oscar_dashboard_referral_sources.rb | 2 +- .../20191014021122_fn_oscar_dashboard_domain_groups.rb | 2 +- ...20191018044950_fn_oscar_dashboard_leave_programs.rb | 2 +- ...191018071239_fn_oscar_dashboard_shared_provinces.rb | 2 +- ...20191023050200_populate_client_assessments_count.rb | 2 +- ...23930_add_anti_human_trafficking_to_organization.rb | 2 +- .../20191104071018_add_field_deleted_at_to_visits.rb | 2 +- db/migrate/20191104081650_change_column_provinces.rb | 2 +- ...1107040332_add_field_current_family_id_to_client.rb | 2 +- ...191107074516_migrate_current_family_id_to_client.rb | 2 +- .../20191212031248_fn_oscar_dashboard_sponsors.rb | 2 +- .../20191212032110_fn_oscar_dashboard_org_donors.rb | 2 +- db/migrate/20191212083139_create_referees.rb | 2 +- ...1213064920_add_phone_owner_email_phone_to_client.rb | 2 +- .../20191213071929_add_referee_carer_to_client.rb | 2 +- db/migrate/20191213072011_create_carers.rb | 2 +- .../20191216023313_add_field_to_referee_and_carer.rb | 2 +- .../20191216083413_add_same_as_client_to_carer.rb | 2 +- .../20191224075206_add_deleted_at_to_enter_ngo.rb | 2 +- .../20191224080942_add_deleted_at_to_exit_ngo.rb | 2 +- db/migrate/20200104023629_create_calls.rb | 2 +- .../20200104023907_add_caller_fields_to_referee.rb | 2 +- .../20200104025346_add_hotline_fields_to_client.rb | 2 +- ...20200105064510_create_custom_assessment_settings.rb | 2 +- ...4528_add_custom_assessment_setting_id_to_domains.rb | 2 +- ...0107150040_change_concern_outside_address_column.rb | 2 +- ...dd_counselling_summary_and_info_provided_to_call.rb | 2 +- db/migrate/20200113064723_add_date_of_call_to_call.rb | 2 +- db/migrate/20200114124333_add_locations_to_client.rb | 2 +- db/migrate/20200116022605_create_hotline.rb | 2 +- ...00116041656_add_options_aht_and_calls_to_setting.rb | 2 +- ...e_custom_assessment_to_custom_assessment_setting.rb | 2 +- ...40853_add_field_hotline_check_to_advanced_search.rb | 2 +- db/migrate/20200121101537_create_necessities.rb | 2 +- db/migrate/20200121101841_create_client_necessities.rb | 2 +- .../20200121101945_create_protection_concerns.rb | 2 +- ...20200121102335_create_client_protection_concerns.rb | 2 +- .../20200123013924_add_brief_note_summary_to_client.rb | 2 +- ...ve_phone_counselling_summary_from_call_to_client.rb | 2 +- ...160216_move_hotline_columns_from_referee_to_call.rb | 2 +- ...lient_necessities_and_client_protection_concerns.rb | 2 +- db/migrate/20200208014349_create_call_necessities.rb | 2 +- .../20200208014523_create_call_protection_concerns.rb | 2 +- ...00208020035_add_other_more_information_to_client.rb | 2 +- .../20200209064139_add_not_a_phone_call_to_call.rb | 2 +- .../20200210020427_remove_end_datetime_from_calls.rb | 2 +- .../20200210102631_add_childsafe_agent_to_calls.rb | 2 +- ..._move_other_more_information_from_client_to_call.rb | 2 +- ...1301_move_brief_note_summary_from_client_to_call.rb | 2 +- .../20200221033504_add_field_note_to_case_note.rb | 2 +- ...24030525_change_column_meeting_date_of_case_note.rb | 2 +- db/migrate/20200228124341_create_field_settings.rb | 2 +- db/migrate/20200228125553_translate_field_setting.rb | 2 +- .../20200229100125_remove_label_from_field_setting.rb | 2 +- .../20200301073436_add_type_to_field_settings.rb | 2 +- .../20200302053723_rename_column_in_field_settings.rb | 2 +- .../20200304044337_add_association_to_case_note.rb | 2 +- .../20200306062433_add_fiels_to_field_settings.rb | 2 +- db/migrate/20200306064650_rename_field_settings.rb | 2 +- db/migrate/20200311075911_add_field_to_family.rb | 2 +- db/migrate/20200311092201_add_field_to_case.rb | 2 +- db/migrate/20200316043514_add_brc_fields_to_client.rb | 2 +- .../20200319040152_add_more_fields_to_clients.rb | 2 +- .../20200320030958_remove_some_columns_from_clients.rb | 2 +- ...00328004830_add_only_instances_to_field_settings.rb | 2 +- ...00330090123_add_legacy_brcs_id_to_field_settings.rb | 2 +- .../20200330110449_add_legacy_brcs_id_to_clients.rb | 2 +- db/migrate/20200331152552_change_whatsapp_type.rb | 2 +- db/migrate/20200331161800_remove_v_score.rb | 2 +- .../20200402005626_add_preferred_lan_to_users.rb | 2 +- .../20200403033722_add_relationship_to_referee.rb | 2 +- db/migrate/20200403033746_add_relationship_to_carer.rb | 2 +- .../20200404192532_add_gender_to_family_members.rb | 2 +- db/migrate/20200408083757_create_global_identities.rb | 2 +- db/migrate/20200408084848_add_global_id_to_clients.rb | 2 +- ...20200408093230_add_client_global_id_to_referrals.rb | 4 ++-- ...408093320_add_client_global_id_to_shared_clients.rb | 2 +- ...0410042355_add_integrated_field_to_organizations.rb | 2 +- .../20200410054110_add_integrated_fields_to_clients.rb | 2 +- .../20200412091835_remove_foreign_key_from_client.rb | 2 +- ...200412101201_add_other_phone_whatsapp_to_clients.rb | 2 +- .../20200413025327_add_note_to_family_members.rb | 2 +- ...20200414054443_add_preferred_language_to_clients.rb | 2 +- ...0200417074727_add_multiple_to_quantitative_types.rb | 2 +- ...0200417145348_add_integrated_fields_to_referrals.rb | 2 +- ...18095200_change_preferred_language_default_value.rb | 2 +- ...00419053051_create_global_identity_organizations.rb | 2 +- db/migrate/20200420035055_create_external_systems.rb | 2 +- ...0035550_create_external_system_global_identities.rb | 2 +- db/migrate/20200422045358_create_doorkeeper_tables.rb | 2 +- db/migrate/20200428115250_create_global_services.rb | 2 +- .../20200428121016_add_field_unique_id_to_services.rb | 2 +- ...05084319_add_integrated_fields_to_shared_clients.rb | 2 +- db/migrate/20200505091428_add_fields_to_referrals.rb | 2 +- ...ow_services_shared_in_external_system_to_clients.rb | 2 +- db/migrate/20200511061823_devise_create_admin_users.rb | 2 +- db/migrate/20200520100815_create_referrals_services.rb | 2 +- ...521085502_add_assessment_score_order_to_settings.rb | 2 +- ...43523_add_ignore_assessment_required_to_settings.rb | 2 +- ...1_add_delete_incomplete_after_period_to_settings.rb | 2 +- ...00522142638_add_government_form_to_field_setting.rb | 6 +++--- .../20200525030557_add_assessment_field_setting.rb | 6 +++--- db/migrate/20200526080908_add_documents_to_clients.rb | 2 +- .../20200526082659_add_documents_to_field_settings.rb | 6 +++--- db/migrate/20200526091702_add_taskable_to_task.rb | 2 +- db/migrate/20200528053755_update_gender_setting.rb | 2 +- db/migrate/20200603071312_add_field_to_task.rb | 2 +- db/migrate/20200603081325_add_service_type.rb | 2 +- ...00609042124_added_support_languages_to_instances.rb | 2 +- ...00611041442_remove_field_services_from_referrals.rb | 2 +- db/migrate/20200611080519_add_token_to_admin_users.rb | 2 +- .../20200618080326_add_first_name_to_admin_users.rb | 2 +- .../20200625042951_alter_tasks_client_id_contrain.rb | 2 +- ...26090546_add_client_agreegation_to_organizations.rb | 2 +- db/migrate/20200629053513_add_demo_to_organizations.rb | 2 +- ...ove_foreign_key_to_global_identity_organizations.rb | 2 +- .../20200707035255_add_additional_fields_to_clients.rb | 2 +- db/migrate/20200707042500_add_field_setting_data.rb | 10 +++++----- db/migrate/20200710030444_update_data.rb | 6 +++--- .../20200710032429_add_label_only_to_field_settings.rb | 2 +- .../20200710033402_add_label_data_to_field_settings.rb | 6 +++--- db/migrate/20200710122049_add_assessment_label.rb | 6 +++--- .../20200711153900_add_stack_holder_to_clients.rb | 2 +- ...13035828_add_stack_holder_data_to_field_settings.rb | 6 +++--- db/migrate/20200714092201_add_case_notes_note_label.rb | 6 +++--- ...9232917_add_use_screening_assessment_to_settings.rb | 2 +- db/migrate/20200723075102_add_fiel_to_users.rb | 2 +- db/migrate/20200731034640_add_field_to_communes.rb | 2 +- ...00803082706_add_show_prev_assessment_to_settings.rb | 2 +- ...14_add_two_weeks_assessment_reminder_to_settings.rb | 2 +- db/migrate/20200810055448_add_passport_to_clients.rb | 10 +++++----- db/migrate/20200810064734_add_field_to_clients.rb | 2 +- db/migrate/20200810070640_add_caregiver_label_data.rb | 6 +++--- db/migrate/20200810071756_add_field_to_carers.rb | 2 +- db/migrate/20200810071821_add_field_to_referees.rb | 2 +- ...01007034425_devise_token_auth_create_admin_users.rb | 2 +- ...add_referral_source_category_id_to_organizations.rb | 2 +- .../20201203072103_add_referee_email_to_referrals.rb | 2 +- ...4014711_add_foreign_type_to_version_associations.rb | 4 +++- lib/tasks/import_field_settings.rake | 10 +++++----- lib/tasks/tenant_data.rake | 2 +- 454 files changed, 495 insertions(+), 493 deletions(-) diff --git a/db/migrate/20160202073717_create_provinces.rb b/db/migrate/20160202073717_create_provinces.rb index fbf6ac06f2..bed04aee3b 100644 --- a/db/migrate/20160202073717_create_provinces.rb +++ b/db/migrate/20160202073717_create_provinces.rb @@ -1,4 +1,4 @@ -class CreateProvinces < ActiveRecord::Migration +class CreateProvinces < ActiveRecord::Migration[5.2] def change create_table :provinces do |t| t.string :name, default: '' diff --git a/db/migrate/20160202073847_create_referral_sources.rb b/db/migrate/20160202073847_create_referral_sources.rb index ff1e5eb7bc..b60685cfe8 100644 --- a/db/migrate/20160202073847_create_referral_sources.rb +++ b/db/migrate/20160202073847_create_referral_sources.rb @@ -1,4 +1,4 @@ -class CreateReferralSources < ActiveRecord::Migration +class CreateReferralSources < ActiveRecord::Migration[5.2] def change create_table :referral_sources do |t| t.string :name, default: '' diff --git a/db/migrate/20160202074103_create_agencies.rb b/db/migrate/20160202074103_create_agencies.rb index ab88692f13..0e4cc3f535 100644 --- a/db/migrate/20160202074103_create_agencies.rb +++ b/db/migrate/20160202074103_create_agencies.rb @@ -1,4 +1,4 @@ -class CreateAgencies < ActiveRecord::Migration +class CreateAgencies < ActiveRecord::Migration[5.2] def change create_table :agencies do |t| t.string :name, default: '' diff --git a/db/migrate/20160202074149_create_domain_groups.rb b/db/migrate/20160202074149_create_domain_groups.rb index db263e92f5..de7f426ac4 100644 --- a/db/migrate/20160202074149_create_domain_groups.rb +++ b/db/migrate/20160202074149_create_domain_groups.rb @@ -1,4 +1,4 @@ -class CreateDomainGroups < ActiveRecord::Migration +class CreateDomainGroups < ActiveRecord::Migration[5.2] def change create_table :domain_groups do |t| t.string :name, default: '' diff --git a/db/migrate/20160202074345_create_domains.rb b/db/migrate/20160202074345_create_domains.rb index d568a3e29d..a4c58580e7 100644 --- a/db/migrate/20160202074345_create_domains.rb +++ b/db/migrate/20160202074345_create_domains.rb @@ -1,4 +1,4 @@ -class CreateDomains < ActiveRecord::Migration +class CreateDomains < ActiveRecord::Migration[5.2] def change create_table :domains do |t| t.string :name, default: '' diff --git a/db/migrate/20160202074629_create_departments.rb b/db/migrate/20160202074629_create_departments.rb index d9c3a973ac..faedd7bf4d 100644 --- a/db/migrate/20160202074629_create_departments.rb +++ b/db/migrate/20160202074629_create_departments.rb @@ -1,4 +1,4 @@ -class CreateDepartments < ActiveRecord::Migration +class CreateDepartments < ActiveRecord::Migration[5.2] def change create_table :departments do |t| t.string :name, default: '' diff --git a/db/migrate/20160202074846_create_families.rb b/db/migrate/20160202074846_create_families.rb index b5fc43ca9e..89d3bf2091 100644 --- a/db/migrate/20160202074846_create_families.rb +++ b/db/migrate/20160202074846_create_families.rb @@ -1,4 +1,4 @@ -class CreateFamilies < ActiveRecord::Migration +class CreateFamilies < ActiveRecord::Migration[5.2] def change create_table :families do |t| diff --git a/db/migrate/20160202075903_create_partners.rb b/db/migrate/20160202075903_create_partners.rb index c7ede431ac..c450295d36 100644 --- a/db/migrate/20160202075903_create_partners.rb +++ b/db/migrate/20160202075903_create_partners.rb @@ -1,4 +1,4 @@ -class CreatePartners < ActiveRecord::Migration +class CreatePartners < ActiveRecord::Migration[5.2] def change create_table :partners do |t| t.string :name, default: '' diff --git a/db/migrate/20160202080206_create_users.rb b/db/migrate/20160202080206_create_users.rb index c0ef0cae6b..e5b2be69d0 100644 --- a/db/migrate/20160202080206_create_users.rb +++ b/db/migrate/20160202080206_create_users.rb @@ -1,4 +1,4 @@ -class CreateUsers < ActiveRecord::Migration +class CreateUsers < ActiveRecord::Migration[5.2] def change create_table :users do |t| t.string :first_name, default: '' diff --git a/db/migrate/20160202082051_create_clients.rb b/db/migrate/20160202082051_create_clients.rb index a3259a3d01..2123a63b82 100644 --- a/db/migrate/20160202082051_create_clients.rb +++ b/db/migrate/20160202082051_create_clients.rb @@ -1,4 +1,4 @@ -class CreateClients < ActiveRecord::Migration +class CreateClients < ActiveRecord::Migration[5.2] def change create_table :clients do |t| t.string :code, default: '' diff --git a/db/migrate/20160202085430_create_cases.rb b/db/migrate/20160202085430_create_cases.rb index c5b0c7e69f..ea396f1d0c 100644 --- a/db/migrate/20160202085430_create_cases.rb +++ b/db/migrate/20160202085430_create_cases.rb @@ -1,4 +1,4 @@ -class CreateCases < ActiveRecord::Migration +class CreateCases < ActiveRecord::Migration[5.2] def change create_table :cases do |t| t.date :start_date diff --git a/db/migrate/20160202095024_create_assessments.rb b/db/migrate/20160202095024_create_assessments.rb index ccc442665b..fab2b9653f 100644 --- a/db/migrate/20160202095024_create_assessments.rb +++ b/db/migrate/20160202095024_create_assessments.rb @@ -1,4 +1,4 @@ -class CreateAssessments < ActiveRecord::Migration +class CreateAssessments < ActiveRecord::Migration[5.2] def change create_table :assessments do |t| t.references :case diff --git a/db/migrate/20160202095145_create_assessment_domains.rb b/db/migrate/20160202095145_create_assessment_domains.rb index b08f5ca010..bef8f772a9 100644 --- a/db/migrate/20160202095145_create_assessment_domains.rb +++ b/db/migrate/20160202095145_create_assessment_domains.rb @@ -1,4 +1,4 @@ -class CreateAssessmentDomains < ActiveRecord::Migration +class CreateAssessmentDomains < ActiveRecord::Migration[5.2] def change create_table :assessment_domains do |t| t.text :note, default: '' diff --git a/db/migrate/20160202095805_create_agencies_clients.rb b/db/migrate/20160202095805_create_agencies_clients.rb index c50e2458b6..dfcd283f5a 100644 --- a/db/migrate/20160202095805_create_agencies_clients.rb +++ b/db/migrate/20160202095805_create_agencies_clients.rb @@ -1,4 +1,4 @@ -class CreateAgenciesClients < ActiveRecord::Migration +class CreateAgenciesClients < ActiveRecord::Migration[5.2] def change create_table :agencies_clients do |t| t.references :client diff --git a/db/migrate/20160202095859_create_case_notes.rb b/db/migrate/20160202095859_create_case_notes.rb index a573bf2a18..0ded2be7cb 100644 --- a/db/migrate/20160202095859_create_case_notes.rb +++ b/db/migrate/20160202095859_create_case_notes.rb @@ -1,4 +1,4 @@ -class CreateCaseNotes < ActiveRecord::Migration +class CreateCaseNotes < ActiveRecord::Migration[5.2] def change create_table :case_notes do |t| t.string :attendee, default: '' diff --git a/db/migrate/20160202100103_create_case_note_domain_groups.rb b/db/migrate/20160202100103_create_case_note_domain_groups.rb index def4ecacb8..a3c114ceb7 100644 --- a/db/migrate/20160202100103_create_case_note_domain_groups.rb +++ b/db/migrate/20160202100103_create_case_note_domain_groups.rb @@ -1,4 +1,4 @@ -class CreateCaseNoteDomainGroups < ActiveRecord::Migration +class CreateCaseNoteDomainGroups < ActiveRecord::Migration[5.2] def change create_table :case_note_domain_groups do |t| t.text :note, default: '' diff --git a/db/migrate/20160202100433_create_tasks.rb b/db/migrate/20160202100433_create_tasks.rb index 54479d617e..18522a0915 100644 --- a/db/migrate/20160202100433_create_tasks.rb +++ b/db/migrate/20160202100433_create_tasks.rb @@ -1,4 +1,4 @@ -class CreateTasks < ActiveRecord::Migration +class CreateTasks < ActiveRecord::Migration[5.2] def change create_table :tasks do |t| t.string :name, default: '' diff --git a/db/migrate/20160202100848_add_devise_to_users.rb b/db/migrate/20160202100848_add_devise_to_users.rb index 1b43f96f92..dc9b568ff9 100644 --- a/db/migrate/20160202100848_add_devise_to_users.rb +++ b/db/migrate/20160202100848_add_devise_to_users.rb @@ -1,4 +1,4 @@ -class AddDeviseToUsers < ActiveRecord::Migration +class AddDeviseToUsers < ActiveRecord::Migration[5.2] def self.up change_table(:users) do |t| ## Database authenticatable diff --git a/db/migrate/20160202101143_add_counter_cache_to_all_associations.rb b/db/migrate/20160202101143_add_counter_cache_to_all_associations.rb index fef8ddb2d1..7f86ae9189 100644 --- a/db/migrate/20160202101143_add_counter_cache_to_all_associations.rb +++ b/db/migrate/20160202101143_add_counter_cache_to_all_associations.rb @@ -1,4 +1,4 @@ -class AddCounterCacheToAllAssociations < ActiveRecord::Migration +class AddCounterCacheToAllAssociations < ActiveRecord::Migration[5.2] def change add_column :agencies, :agencies_clients_count, :integer, default: 0 diff --git a/db/migrate/20160216015733_add_client_reference_to_task.rb b/db/migrate/20160216015733_add_client_reference_to_task.rb index 09d35ee98a..e729d75ade 100644 --- a/db/migrate/20160216015733_add_client_reference_to_task.rb +++ b/db/migrate/20160216015733_add_client_reference_to_task.rb @@ -1,4 +1,4 @@ -class AddClientReferenceToTask < ActiveRecord::Migration +class AddClientReferenceToTask < ActiveRecord::Migration[5.2] def change add_reference :tasks, :client, index: true, foreign_key: true end diff --git a/db/migrate/20160218080703_add_completed_to_clients.rb b/db/migrate/20160218080703_add_completed_to_clients.rb index d87b0f58dd..83b7f48331 100644 --- a/db/migrate/20160218080703_add_completed_to_clients.rb +++ b/db/migrate/20160218080703_add_completed_to_clients.rb @@ -1,4 +1,4 @@ -class AddCompletedToClients < ActiveRecord::Migration +class AddCompletedToClients < ActiveRecord::Migration[5.2] def change add_column :clients, :completed, :boolean, default: false end diff --git a/db/migrate/20160218081238_add_family_preservation_to_cases.rb b/db/migrate/20160218081238_add_family_preservation_to_cases.rb index 9b8ffc32bf..8dfb517156 100644 --- a/db/migrate/20160218081238_add_family_preservation_to_cases.rb +++ b/db/migrate/20160218081238_add_family_preservation_to_cases.rb @@ -1,4 +1,4 @@ -class AddFamilyPreservationToCases < ActiveRecord::Migration +class AddFamilyPreservationToCases < ActiveRecord::Migration[5.2] def change add_column :cases, :family_preservation, :boolean, default: false end diff --git a/db/migrate/20160218083422_create_quantitative_types.rb b/db/migrate/20160218083422_create_quantitative_types.rb index 263ba7a42e..2212a70220 100644 --- a/db/migrate/20160218083422_create_quantitative_types.rb +++ b/db/migrate/20160218083422_create_quantitative_types.rb @@ -1,4 +1,4 @@ -class CreateQuantitativeTypes < ActiveRecord::Migration +class CreateQuantitativeTypes < ActiveRecord::Migration[5.2] def change create_table :quantitative_types do |t| t.string :name, default: '' diff --git a/db/migrate/20160218083606_create_quantitative_cases.rb b/db/migrate/20160218083606_create_quantitative_cases.rb index 300b18f05f..4d40398a1c 100644 --- a/db/migrate/20160218083606_create_quantitative_cases.rb +++ b/db/migrate/20160218083606_create_quantitative_cases.rb @@ -1,4 +1,4 @@ -class CreateQuantitativeCases < ActiveRecord::Migration +class CreateQuantitativeCases < ActiveRecord::Migration[5.2] def change create_table :quantitative_cases do |t| t.string :value, default: '' diff --git a/db/migrate/20160219031802_create_clients_quantitative_cases.rb b/db/migrate/20160219031802_create_clients_quantitative_cases.rb index 7d30451581..75adcbd3e9 100644 --- a/db/migrate/20160219031802_create_clients_quantitative_cases.rb +++ b/db/migrate/20160219031802_create_clients_quantitative_cases.rb @@ -1,4 +1,4 @@ -class CreateClientsQuantitativeCases < ActiveRecord::Migration +class CreateClientsQuantitativeCases < ActiveRecord::Migration[5.2] def change create_table :clients_quantitative_cases do |t| diff --git a/db/migrate/20160220161914_create_quarterly_reports.rb b/db/migrate/20160220161914_create_quarterly_reports.rb index ef8c9e162b..4f2fa98e2d 100644 --- a/db/migrate/20160220161914_create_quarterly_reports.rb +++ b/db/migrate/20160220161914_create_quarterly_reports.rb @@ -1,4 +1,4 @@ -class CreateQuarterlyReports < ActiveRecord::Migration +class CreateQuarterlyReports < ActiveRecord::Migration[5.2] def change create_table :quarterly_reports do |t| t.date :visit_date diff --git a/db/migrate/20160222020203_update_references.rb b/db/migrate/20160222020203_update_references.rb index f38e1b2631..b2a2758e3d 100644 --- a/db/migrate/20160222020203_update_references.rb +++ b/db/migrate/20160222020203_update_references.rb @@ -1,4 +1,4 @@ -class UpdateReferences < ActiveRecord::Migration +class UpdateReferences < ActiveRecord::Migration[5.2] def change remove_reference :case_notes, :case remove_reference :assessments, :case diff --git a/db/migrate/20160222090336_create_case_contracts.rb b/db/migrate/20160222090336_create_case_contracts.rb index bb616aaa28..4279cb7485 100644 --- a/db/migrate/20160222090336_create_case_contracts.rb +++ b/db/migrate/20160222090336_create_case_contracts.rb @@ -1,4 +1,4 @@ -class CreateCaseContracts < ActiveRecord::Migration +class CreateCaseContracts < ActiveRecord::Migration[5.2] def change create_table :case_contracts do |t| t.date :signed_on diff --git a/db/migrate/20160222112312_add_missing_field_to_client.rb b/db/migrate/20160222112312_add_missing_field_to_client.rb index 73780c3e2b..74efd0ec78 100644 --- a/db/migrate/20160222112312_add_missing_field_to_client.rb +++ b/db/migrate/20160222112312_add_missing_field_to_client.rb @@ -1,4 +1,4 @@ -class AddMissingFieldToClient < ActiveRecord::Migration +class AddMissingFieldToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :reason_for_referral, :text, default: '' add_column :clients, :is_receiving_additional_benefits, :boolean, default: false diff --git a/db/migrate/20160222112535_add_missing_field_to_cases.rb b/db/migrate/20160222112535_add_missing_field_to_cases.rb index 600f631bab..6f79cbbfb4 100644 --- a/db/migrate/20160222112535_add_missing_field_to_cases.rb +++ b/db/migrate/20160222112535_add_missing_field_to_cases.rb @@ -1,4 +1,4 @@ -class AddMissingFieldToCases < ActiveRecord::Migration +class AddMissingFieldToCases < ActiveRecord::Migration[5.2] def change add_column :cases, :status, :string, default: '' add_column :cases, :placement_date, :date diff --git a/db/migrate/20160223072851_add_exited_from_cif_to_case.rb b/db/migrate/20160223072851_add_exited_from_cif_to_case.rb index 4a6b5c2ebe..eff770f23a 100644 --- a/db/migrate/20160223072851_add_exited_from_cif_to_case.rb +++ b/db/migrate/20160223072851_add_exited_from_cif_to_case.rb @@ -1,4 +1,4 @@ -class AddExitedFromCifToCase < ActiveRecord::Migration +class AddExitedFromCifToCase < ActiveRecord::Migration[5.2] def change add_column :cases, :exited_from_cif, :boolean, default: false end diff --git a/db/migrate/20160229164608_devise_token_auth_create_users.rb b/db/migrate/20160229164608_devise_token_auth_create_users.rb index 96cad64288..a18544e643 100644 --- a/db/migrate/20160229164608_devise_token_auth_create_users.rb +++ b/db/migrate/20160229164608_devise_token_auth_create_users.rb @@ -1,7 +1,7 @@ -class DeviseTokenAuthCreateUsers < ActiveRecord::Migration +class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[5.2] def change add_column :users, :provider, :string, null: false, default: 'email' add_column :users, :uid, :string, null: false, default: '' add_column :users, :tokens, :json end -end \ No newline at end of file +end diff --git a/db/migrate/20160303021506_add_grade_to_client.rb b/db/migrate/20160303021506_add_grade_to_client.rb index 0ffd6670f0..c414ce567b 100644 --- a/db/migrate/20160303021506_add_grade_to_client.rb +++ b/db/migrate/20160303021506_add_grade_to_client.rb @@ -1,5 +1,5 @@ -class AddGradeToClient < ActiveRecord::Migration - +class AddGradeToClient < ActiveRecord::Migration[5.2] + def change add_column :clients, :grade, :integer, default: 0 diff --git a/db/migrate/20160304071711_change_assessment_domain_score_column.rb b/db/migrate/20160304071711_change_assessment_domain_score_column.rb index ae2e367937..f1cbc35fce 100644 --- a/db/migrate/20160304071711_change_assessment_domain_score_column.rb +++ b/db/migrate/20160304071711_change_assessment_domain_score_column.rb @@ -1,4 +1,4 @@ -class ChangeAssessmentDomainScoreColumn < ActiveRecord::Migration +class ChangeAssessmentDomainScoreColumn < ActiveRecord::Migration[5.2] def change change_column :assessment_domains, :score, :integer, :default => nil end diff --git a/db/migrate/20160305051724_update_user_data.rb b/db/migrate/20160305051724_update_user_data.rb index cbfdb6bc38..05275c7000 100644 --- a/db/migrate/20160305051724_update_user_data.rb +++ b/db/migrate/20160305051724_update_user_data.rb @@ -1,4 +1,4 @@ -class UpdateUserData < ActiveRecord::Migration +class UpdateUserData < ActiveRecord::Migration[5.2] def change User.all.each do |user| begin diff --git a/db/migrate/20160328070346_add_score_color_to_domain.rb b/db/migrate/20160328070346_add_score_color_to_domain.rb index e26c6bcaf7..9b97509771 100644 --- a/db/migrate/20160328070346_add_score_color_to_domain.rb +++ b/db/migrate/20160328070346_add_score_color_to_domain.rb @@ -1,4 +1,4 @@ -class AddScoreColorToDomain < ActiveRecord::Migration +class AddScoreColorToDomain < ActiveRecord::Migration[5.2] def change add_column :domains, :score_1_color, :string, default: 'danger' add_column :domains, :score_2_color, :string, default: 'warning' diff --git a/db/migrate/20160425070622_add_slug_to_client.rb b/db/migrate/20160425070622_add_slug_to_client.rb index 9b7896ed88..d13afa2648 100644 --- a/db/migrate/20160425070622_add_slug_to_client.rb +++ b/db/migrate/20160425070622_add_slug_to_client.rb @@ -1,4 +1,4 @@ -class AddSlugToClient < ActiveRecord::Migration +class AddSlugToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :slug, :string add_index :clients, :slug, unique: true diff --git a/db/migrate/20160425084248_create_friendly_id_slugs.rb b/db/migrate/20160425084248_create_friendly_id_slugs.rb index 770f626446..134c328bb9 100644 --- a/db/migrate/20160425084248_create_friendly_id_slugs.rb +++ b/db/migrate/20160425084248_create_friendly_id_slugs.rb @@ -1,4 +1,4 @@ -class CreateFriendlyIdSlugs < ActiveRecord::Migration +class CreateFriendlyIdSlugs < ActiveRecord::Migration[5.2] def change create_table :friendly_id_slugs do |t| t.string :slug, :null => false diff --git a/db/migrate/20160425084249_update_old_client_alias_id.rb b/db/migrate/20160425084249_update_old_client_alias_id.rb index c033663507..67fdb088bc 100644 --- a/db/migrate/20160425084249_update_old_client_alias_id.rb +++ b/db/migrate/20160425084249_update_old_client_alias_id.rb @@ -1,4 +1,4 @@ -class UpdateOldClientAliasId < ActiveRecord::Migration +class UpdateOldClientAliasId < ActiveRecord::Migration[5.2] def change unprocessable_clients = [] diff --git a/db/migrate/20160426020733_add_goal_to_assessment_domain.rb b/db/migrate/20160426020733_add_goal_to_assessment_domain.rb index ab0d84ade8..23132aa17a 100644 --- a/db/migrate/20160426020733_add_goal_to_assessment_domain.rb +++ b/db/migrate/20160426020733_add_goal_to_assessment_domain.rb @@ -1,4 +1,4 @@ -class AddGoalToAssessmentDomain < ActiveRecord::Migration +class AddGoalToAssessmentDomain < ActiveRecord::Migration[5.2] def change add_column :assessment_domains, :goal, :text, default: '' end diff --git a/db/migrate/20160505031003_create_government_report.rb b/db/migrate/20160505031003_create_government_report.rb index d431dc224a..f74dc137a5 100644 --- a/db/migrate/20160505031003_create_government_report.rb +++ b/db/migrate/20160505031003_create_government_report.rb @@ -1,4 +1,4 @@ -class CreateGovernmentReport < ActiveRecord::Migration +class CreateGovernmentReport < ActiveRecord::Migration[5.2] def change create_table :government_reports do |t| t.string :code, default: '' @@ -56,8 +56,8 @@ def change t.boolean :second_mission, default: false t.boolean :third_mission, default: false t.boolean :fourth_mission, default: false - t.date :done_date - t.date :agreed_date + t.date :done_date + t.date :agreed_date t.belongs_to :client diff --git a/db/migrate/20160809092723_add_name_to_user.rb b/db/migrate/20160809092723_add_name_to_user.rb index c28f45c5cd..315d79472f 100644 --- a/db/migrate/20160809092723_add_name_to_user.rb +++ b/db/migrate/20160809092723_add_name_to_user.rb @@ -1,4 +1,4 @@ -class AddNameToUser < ActiveRecord::Migration +class AddNameToUser < ActiveRecord::Migration[5.2] def change add_column :users, :name, :string, default: '' diff --git a/db/migrate/20160816034530_add_admin_to_user.rb b/db/migrate/20160816034530_add_admin_to_user.rb index d693d29136..4cf4c449dc 100644 --- a/db/migrate/20160816034530_add_admin_to_user.rb +++ b/db/migrate/20160816034530_add_admin_to_user.rb @@ -1,4 +1,4 @@ -class AddAdminToUser < ActiveRecord::Migration +class AddAdminToUser < ActiveRecord::Migration[5.2] def change add_column :users, :admin, :boolean, default: false @@ -19,4 +19,4 @@ def change system "echo #{unprocessable_users} >> error.txt" if unprocessable_users.present? end -end \ No newline at end of file +end diff --git a/db/migrate/20160816092724_create_thredded.thredded.rb b/db/migrate/20160816092724_create_thredded.thredded.rb index f50f89ea25..df973de5ee 100644 --- a/db/migrate/20160816092724_create_thredded.thredded.rb +++ b/db/migrate/20160816092724_create_thredded.thredded.rb @@ -2,7 +2,7 @@ # frozen_string_literal: true # rubocop:disable Metrics/ClassLength # rubocop:disable Metrics/MethodLength -class CreateThredded < ActiveRecord::Migration +class CreateThredded < ActiveRecord::Migration[5.2] def change unless table_exists?(:friendly_id_slugs) # The user might have installed FriendlyId separately already. diff --git a/db/migrate/20160817021354_remove_name_from_user.rb b/db/migrate/20160817021354_remove_name_from_user.rb index 4a57936d23..12f9bf6bb4 100644 --- a/db/migrate/20160817021354_remove_name_from_user.rb +++ b/db/migrate/20160817021354_remove_name_from_user.rb @@ -1,4 +1,4 @@ -class RemoveNameFromUser < ActiveRecord::Migration +class RemoveNameFromUser < ActiveRecord::Migration[5.2] def change remove_column :users, :name, :string end diff --git a/db/migrate/20160817075800_create_survey.rb b/db/migrate/20160817075800_create_survey.rb index 747df486fd..9a302165c0 100644 --- a/db/migrate/20160817075800_create_survey.rb +++ b/db/migrate/20160817075800_create_survey.rb @@ -1,4 +1,4 @@ -class CreateSurvey < ActiveRecord::Migration +class CreateSurvey < ActiveRecord::Migration[5.2] def change create_table :surveys do |t| t.references :client, index: true, foreign_key: true diff --git a/db/migrate/20160908074157_create_changelog.rb b/db/migrate/20160908074157_create_changelog.rb index 8ea52852a6..b060efe31e 100644 --- a/db/migrate/20160908074157_create_changelog.rb +++ b/db/migrate/20160908074157_create_changelog.rb @@ -1,4 +1,4 @@ -class CreateChangelog < ActiveRecord::Migration +class CreateChangelog < ActiveRecord::Migration[5.2] def change create_table :changelogs do |t| t.string :version, default: '' diff --git a/db/migrate/20160919040653_create_material.rb b/db/migrate/20160919040653_create_material.rb index e7b4756f43..5c6f401979 100644 --- a/db/migrate/20160919040653_create_material.rb +++ b/db/migrate/20160919040653_create_material.rb @@ -1,4 +1,4 @@ -class CreateMaterial < ActiveRecord::Migration +class CreateMaterial < ActiveRecord::Migration[5.2] def change create_table :materials do |t| t.string :status, default: '' diff --git a/db/migrate/20160920014557_create_location.rb b/db/migrate/20160920014557_create_location.rb index d70e921a25..43178a1252 100644 --- a/db/migrate/20160920014557_create_location.rb +++ b/db/migrate/20160920014557_create_location.rb @@ -1,4 +1,4 @@ -class CreateLocation < ActiveRecord::Migration +class CreateLocation < ActiveRecord::Migration[5.2] def change create_table :locations do |t| t.string :name, default: '' diff --git a/db/migrate/20160920023649_create_progress_note_type.rb b/db/migrate/20160920023649_create_progress_note_type.rb index 1273e74a27..05fdbe5cdf 100644 --- a/db/migrate/20160920023649_create_progress_note_type.rb +++ b/db/migrate/20160920023649_create_progress_note_type.rb @@ -1,4 +1,4 @@ -class CreateProgressNoteType < ActiveRecord::Migration +class CreateProgressNoteType < ActiveRecord::Migration[5.2] def change create_table :progress_note_types do |t| t.string :note_type, default: '' diff --git a/db/migrate/20160920041253_create_intervention.rb b/db/migrate/20160920041253_create_intervention.rb index 46a52eae76..fc23864752 100644 --- a/db/migrate/20160920041253_create_intervention.rb +++ b/db/migrate/20160920041253_create_intervention.rb @@ -1,4 +1,4 @@ -class CreateIntervention < ActiveRecord::Migration +class CreateIntervention < ActiveRecord::Migration[5.2] def change create_table :interventions do |t| t.string :action, default: '' diff --git a/db/migrate/20160920081903_create_progress_note.rb b/db/migrate/20160920081903_create_progress_note.rb index da5abca80d..784f118a2d 100644 --- a/db/migrate/20160920081903_create_progress_note.rb +++ b/db/migrate/20160920081903_create_progress_note.rb @@ -1,4 +1,4 @@ -class CreateProgressNote < ActiveRecord::Migration +class CreateProgressNote < ActiveRecord::Migration[5.2] def change create_table :progress_notes do |t| t.date :date diff --git a/db/migrate/20160920083452_create_stages.rb b/db/migrate/20160920083452_create_stages.rb index e291af998e..180c085c80 100644 --- a/db/migrate/20160920083452_create_stages.rb +++ b/db/migrate/20160920083452_create_stages.rb @@ -1,4 +1,4 @@ -class CreateStages < ActiveRecord::Migration +class CreateStages < ActiveRecord::Migration[5.2] def change create_table :stages do |t| t.float :from_age diff --git a/db/migrate/20160920083920_create_interventions_progress_notes.rb b/db/migrate/20160920083920_create_interventions_progress_notes.rb index 3804f9633d..0365198752 100644 --- a/db/migrate/20160920083920_create_interventions_progress_notes.rb +++ b/db/migrate/20160920083920_create_interventions_progress_notes.rb @@ -1,4 +1,4 @@ -class CreateInterventionsProgressNotes < ActiveRecord::Migration +class CreateInterventionsProgressNotes < ActiveRecord::Migration[5.2] def change create_table :interventions_progress_notes do |t| t.references :progress_note, index: true, foreign_key: true diff --git a/db/migrate/20160920085515_create_able_screening_questions.rb b/db/migrate/20160920085515_create_able_screening_questions.rb index 8ef5fd5d66..a9390e4e19 100644 --- a/db/migrate/20160920085515_create_able_screening_questions.rb +++ b/db/migrate/20160920085515_create_able_screening_questions.rb @@ -1,4 +1,4 @@ -class CreateAbleScreeningQuestions < ActiveRecord::Migration +class CreateAbleScreeningQuestions < ActiveRecord::Migration[5.2] def change create_table :able_screening_questions do |t| t.string :question diff --git a/db/migrate/20160920091650_create_answers.rb b/db/migrate/20160920091650_create_answers.rb index ec15e17e53..6eca5ed625 100644 --- a/db/migrate/20160920091650_create_answers.rb +++ b/db/migrate/20160920091650_create_answers.rb @@ -1,4 +1,4 @@ -class CreateAnswers < ActiveRecord::Migration +class CreateAnswers < ActiveRecord::Migration[5.2] def change create_table :answers do |t| t.string :description diff --git a/db/migrate/20160921031639_add_user_association_to_progress_note.rb b/db/migrate/20160921031639_add_user_association_to_progress_note.rb index 7498504398..8724b18ce5 100644 --- a/db/migrate/20160921031639_add_user_association_to_progress_note.rb +++ b/db/migrate/20160921031639_add_user_association_to_progress_note.rb @@ -1,4 +1,4 @@ -class AddUserAssociationToProgressNote < ActiveRecord::Migration +class AddUserAssociationToProgressNote < ActiveRecord::Migration[5.2] def change add_reference :progress_notes, :user, index: true, foreign_key: true end diff --git a/db/migrate/20160921065318_create_assessment_domains_progress_notes.rb b/db/migrate/20160921065318_create_assessment_domains_progress_notes.rb index f3841d08d7..a8ca34c40a 100644 --- a/db/migrate/20160921065318_create_assessment_domains_progress_notes.rb +++ b/db/migrate/20160921065318_create_assessment_domains_progress_notes.rb @@ -1,4 +1,4 @@ -class CreateAssessmentDomainsProgressNotes < ActiveRecord::Migration +class CreateAssessmentDomainsProgressNotes < ActiveRecord::Migration[5.2] def change create_table :assessment_domains_progress_notes do |t| t.references :assessment_domain, index: true, foreign_key: true diff --git a/db/migrate/20160921065554_add_alert_manager_field_to_able_screening_question.rb b/db/migrate/20160921065554_add_alert_manager_field_to_able_screening_question.rb index faa5f62485..d4695470a5 100644 --- a/db/migrate/20160921065554_add_alert_manager_field_to_able_screening_question.rb +++ b/db/migrate/20160921065554_add_alert_manager_field_to_able_screening_question.rb @@ -1,4 +1,4 @@ -class AddAlertManagerFieldToAbleScreeningQuestion < ActiveRecord::Migration +class AddAlertManagerFieldToAbleScreeningQuestion < ActiveRecord::Migration[5.2] def change add_column :able_screening_questions, :alert_manager, :boolean end diff --git a/db/migrate/20160922092536_create_attachments.rb b/db/migrate/20160922092536_create_attachments.rb index fc4b8aedf5..755af6c32f 100644 --- a/db/migrate/20160922092536_create_attachments.rb +++ b/db/migrate/20160922092536_create_attachments.rb @@ -1,4 +1,4 @@ -class CreateAttachments < ActiveRecord::Migration +class CreateAttachments < ActiveRecord::Migration[5.2] def change create_table :attachments do |t| t.string :image diff --git a/db/migrate/20160923043225_add_non_stage_field_to_stage.rb b/db/migrate/20160923043225_add_non_stage_field_to_stage.rb index a6133fc1c0..4f67fecce6 100644 --- a/db/migrate/20160923043225_add_non_stage_field_to_stage.rb +++ b/db/migrate/20160923043225_add_non_stage_field_to_stage.rb @@ -1,4 +1,4 @@ -class AddNonStageFieldToStage < ActiveRecord::Migration +class AddNonStageFieldToStage < ActiveRecord::Migration[5.2] def change add_column :stages, :non_stage, :boolean, default: false end diff --git a/db/migrate/20160923072931_add_order_option_to_location.rb b/db/migrate/20160923072931_add_order_option_to_location.rb index e114159fb2..96a88ffc87 100644 --- a/db/migrate/20160923072931_add_order_option_to_location.rb +++ b/db/migrate/20160923072931_add_order_option_to_location.rb @@ -1,4 +1,4 @@ -class AddOrderOptionToLocation < ActiveRecord::Migration +class AddOrderOptionToLocation < ActiveRecord::Migration[5.2] def change add_column :locations, :order_option, :integer, default: 0 end diff --git a/db/migrate/20160923084811_add_client_able_state_to_client.rb b/db/migrate/20160923084811_add_client_able_state_to_client.rb index a12ae7adf2..04aaff9339 100644 --- a/db/migrate/20160923084811_add_client_able_state_to_client.rb +++ b/db/migrate/20160923084811_add_client_able_state_to_client.rb @@ -1,4 +1,4 @@ -class AddClientAbleStateToClient < ActiveRecord::Migration +class AddClientAbleStateToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :able_state, :string end diff --git a/db/migrate/20160926042656_create_changelog_types.rb b/db/migrate/20160926042656_create_changelog_types.rb index dde8777be2..8719324ef3 100644 --- a/db/migrate/20160926042656_create_changelog_types.rb +++ b/db/migrate/20160926042656_create_changelog_types.rb @@ -1,4 +1,4 @@ -class CreateChangelogTypes < ActiveRecord::Migration +class CreateChangelogTypes < ActiveRecord::Migration[5.2] def change create_table :changelog_types do |t| t.references :changelog, index: true, foreign_key: true diff --git a/db/migrate/20160926074038_create_question_groups.rb b/db/migrate/20160926074038_create_question_groups.rb index 59c227742a..d7e356edee 100644 --- a/db/migrate/20160926074038_create_question_groups.rb +++ b/db/migrate/20160926074038_create_question_groups.rb @@ -1,4 +1,4 @@ -class CreateQuestionGroups < ActiveRecord::Migration +class CreateQuestionGroups < ActiveRecord::Migration[5.2] def change create_table :question_groups do |t| t.string :name diff --git a/db/migrate/20160926074243_add_question_group_reference_to_able_screening_question.rb b/db/migrate/20160926074243_add_question_group_reference_to_able_screening_question.rb index 57a2b028ac..957083152a 100644 --- a/db/migrate/20160926074243_add_question_group_reference_to_able_screening_question.rb +++ b/db/migrate/20160926074243_add_question_group_reference_to_able_screening_question.rb @@ -1,4 +1,4 @@ -class AddQuestionGroupReferenceToAbleScreeningQuestion < ActiveRecord::Migration +class AddQuestionGroupReferenceToAbleScreeningQuestion < ActiveRecord::Migration[5.2] def change add_reference :able_screening_questions, :question_group, index: true, foreign_key: true end diff --git a/db/migrate/20160927032508_remove_group_from_able_screening_question.rb b/db/migrate/20160927032508_remove_group_from_able_screening_question.rb index 5083096465..e18545ef01 100644 --- a/db/migrate/20160927032508_remove_group_from_able_screening_question.rb +++ b/db/migrate/20160927032508_remove_group_from_able_screening_question.rb @@ -1,4 +1,4 @@ -class RemoveGroupFromAbleScreeningQuestion < ActiveRecord::Migration +class RemoveGroupFromAbleScreeningQuestion < ActiveRecord::Migration[5.2] def change remove_column :able_screening_questions, :group, :string end diff --git a/db/migrate/20161005095556_create_versions.rb b/db/migrate/20161005095556_create_versions.rb index 47301d569e..64043744c4 100644 --- a/db/migrate/20161005095556_create_versions.rb +++ b/db/migrate/20161005095556_create_versions.rb @@ -1,6 +1,6 @@ # This migration creates the `versions` table, the only schema PT requires. # All other migrations PT provides are optional. -class CreateVersions < ActiveRecord::Migration +class CreateVersions < ActiveRecord::Migration[5.2] # Class names of MySQL adapters. # - `MysqlAdapter` - Used by gems: `mysql`, `activerecord-jdbcmysql-adapter`. # - `Mysql2Adapter` - Used by `mysql2` gem. diff --git a/db/migrate/20161005095557_add_object_changes_to_versions.rb b/db/migrate/20161005095557_add_object_changes_to_versions.rb index b8df5ffc3a..b5f2fb4b66 100644 --- a/db/migrate/20161005095557_add_object_changes_to_versions.rb +++ b/db/migrate/20161005095557_add_object_changes_to_versions.rb @@ -1,7 +1,7 @@ # This migration adds the optional `object_changes` column, in which PaperTrail # will store the `changes` diff for each update event. See the readme for # details. -class AddObjectChangesToVersions < ActiveRecord::Migration +class AddObjectChangesToVersions < ActiveRecord::Migration[5.2] # The largest text column available in all supported RDBMS. # See `create_versions.rb` for details. TEXT_BYTES = 1_073_741_823 diff --git a/db/migrate/20161006020147_remove_non_stage_field_from_stage.rb b/db/migrate/20161006020147_remove_non_stage_field_from_stage.rb index a8915dc447..610de851ed 100644 --- a/db/migrate/20161006020147_remove_non_stage_field_from_stage.rb +++ b/db/migrate/20161006020147_remove_non_stage_field_from_stage.rb @@ -1,4 +1,4 @@ -class RemoveNonStageFieldFromStage < ActiveRecord::Migration +class RemoveNonStageFieldFromStage < ActiveRecord::Migration[5.2] def change remove_column :stages, :non_stage, :string end diff --git a/db/migrate/20161006020906_create_version_associations.rb b/db/migrate/20161006020906_create_version_associations.rb index e15132c393..50290a1c3f 100644 --- a/db/migrate/20161006020906_create_version_associations.rb +++ b/db/migrate/20161006020906_create_version_associations.rb @@ -1,6 +1,6 @@ # This migration and AddTransactionIdColumnToVersions provide the necessary # schema for tracking associations. -class CreateVersionAssociations < ActiveRecord::Migration +class CreateVersionAssociations < ActiveRecord::Migration[5.2] def self.up create_table :version_associations do |t| t.integer :version_id diff --git a/db/migrate/20161006020907_add_transaction_id_column_to_versions.rb b/db/migrate/20161006020907_add_transaction_id_column_to_versions.rb index 1ece8f40ed..7ba12075c5 100644 --- a/db/migrate/20161006020907_add_transaction_id_column_to_versions.rb +++ b/db/migrate/20161006020907_add_transaction_id_column_to_versions.rb @@ -1,6 +1,6 @@ # This migration and CreateVersionAssociations provide the necessary # schema for tracking associations. -class AddTransactionIdColumnToVersions < ActiveRecord::Migration +class AddTransactionIdColumnToVersions < ActiveRecord::Migration[5.2] def self.up add_column :versions, :transaction_id, :integer add_index :versions, [:transaction_id] diff --git a/db/migrate/20161007045746_add_question_type_to_answer.rb b/db/migrate/20161007045746_add_question_type_to_answer.rb index 4a2682dda3..73f0dd3737 100644 --- a/db/migrate/20161007045746_add_question_type_to_answer.rb +++ b/db/migrate/20161007045746_add_question_type_to_answer.rb @@ -1,4 +1,4 @@ -class AddQuestionTypeToAnswer < ActiveRecord::Migration +class AddQuestionTypeToAnswer < ActiveRecord::Migration[5.2] def change add_column :answers, :question_type, :string, default: '' end diff --git a/db/migrate/20161010071854_update_able_state_of_able_client.rb b/db/migrate/20161010071854_update_able_state_of_able_client.rb index 2967bf5379..521131e639 100644 --- a/db/migrate/20161010071854_update_able_state_of_able_client.rb +++ b/db/migrate/20161010071854_update_able_state_of_able_client.rb @@ -1,4 +1,4 @@ -class UpdateAbleStateOfAbleClient < ActiveRecord::Migration +class UpdateAbleStateOfAbleClient < ActiveRecord::Migration[5.2] def change unprocessable_clients = [] diff --git a/db/migrate/20161018070113_rename_changelog_version_column.rb b/db/migrate/20161018070113_rename_changelog_version_column.rb index eeab020d33..5803d07207 100644 --- a/db/migrate/20161018070113_rename_changelog_version_column.rb +++ b/db/migrate/20161018070113_rename_changelog_version_column.rb @@ -1,4 +1,4 @@ -class RenameChangelogVersionColumn < ActiveRecord::Migration +class RenameChangelogVersionColumn < ActiveRecord::Migration[5.2] def change rename_column :changelogs, :version, :change_version end diff --git a/db/migrate/20161128035346_create_agency_clients.rb b/db/migrate/20161128035346_create_agency_clients.rb index ec63212835..78ee72d981 100644 --- a/db/migrate/20161128035346_create_agency_clients.rb +++ b/db/migrate/20161128035346_create_agency_clients.rb @@ -1,4 +1,4 @@ -class CreateAgencyClients < ActiveRecord::Migration +class CreateAgencyClients < ActiveRecord::Migration[5.2] def change create_table :agency_clients do |t| t.references :agency diff --git a/db/migrate/20161128064447_create_client_quantitative_cases.rb b/db/migrate/20161128064447_create_client_quantitative_cases.rb index 938e0b4e5d..48cff5e7a3 100644 --- a/db/migrate/20161128064447_create_client_quantitative_cases.rb +++ b/db/migrate/20161128064447_create_client_quantitative_cases.rb @@ -1,4 +1,4 @@ -class CreateClientQuantitativeCases < ActiveRecord::Migration +class CreateClientQuantitativeCases < ActiveRecord::Migration[5.2] def change create_table :client_quantitative_cases do |t| t.references :quantitative_case diff --git a/db/migrate/20161205040355_create_organizations.rb b/db/migrate/20161205040355_create_organizations.rb index dd4e787d02..a8f74a1687 100644 --- a/db/migrate/20161205040355_create_organizations.rb +++ b/db/migrate/20161205040355_create_organizations.rb @@ -1,4 +1,4 @@ -class CreateOrganizations < ActiveRecord::Migration +class CreateOrganizations < ActiveRecord::Migration[5.2] def change create_table :organizations do |t| t.string :full_name diff --git a/db/migrate/20161207075009_add_reference_orignaztion_id_to_user.rb b/db/migrate/20161207075009_add_reference_orignaztion_id_to_user.rb index d08daf381f..36d00c9644 100644 --- a/db/migrate/20161207075009_add_reference_orignaztion_id_to_user.rb +++ b/db/migrate/20161207075009_add_reference_orignaztion_id_to_user.rb @@ -1,4 +1,4 @@ -class AddReferenceOrignaztionIdToUser < ActiveRecord::Migration +class AddReferenceOrignaztionIdToUser < ActiveRecord::Migration[5.2] def change add_reference :users, :organization, index: true, foreign_key: true end diff --git a/db/migrate/20161207093338_fix_apartment_contraint_user_organization.rb b/db/migrate/20161207093338_fix_apartment_contraint_user_organization.rb index a9dc6a3b89..8f296d7230 100644 --- a/db/migrate/20161207093338_fix_apartment_contraint_user_organization.rb +++ b/db/migrate/20161207093338_fix_apartment_contraint_user_organization.rb @@ -1,4 +1,4 @@ -class FixApartmentContraintUserOrganization < ActiveRecord::Migration +class FixApartmentContraintUserOrganization < ActiveRecord::Migration[5.2] def self.up remove_foreign_key :users, column: :organization_id diff --git a/db/migrate/20161215033551_add_file_to_attachment.rb b/db/migrate/20161215033551_add_file_to_attachment.rb index e462ac6caf..cbf8498838 100644 --- a/db/migrate/20161215033551_add_file_to_attachment.rb +++ b/db/migrate/20161215033551_add_file_to_attachment.rb @@ -1,4 +1,4 @@ -class AddFileToAttachment < ActiveRecord::Migration +class AddFileToAttachment < ActiveRecord::Migration[5.2] def change add_column :attachments, :file, :string, default: '' add_reference :attachments, :progress_note, index: true, foreign_key: true diff --git a/db/migrate/20161215070129_add_assessments_count_field_to_client.rb b/db/migrate/20161215070129_add_assessments_count_field_to_client.rb index 7b2b08edc4..8d64bfc935 100644 --- a/db/migrate/20161215070129_add_assessments_count_field_to_client.rb +++ b/db/migrate/20161215070129_add_assessments_count_field_to_client.rb @@ -1,4 +1,4 @@ -class AddAssessmentsCountFieldToClient < ActiveRecord::Migration +class AddAssessmentsCountFieldToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :assessments_count, :integer end diff --git a/db/migrate/20161220064910_add_current_field_to_case.rb b/db/migrate/20161220064910_add_current_field_to_case.rb index 486e15e323..8fa0fb3862 100644 --- a/db/migrate/20161220064910_add_current_field_to_case.rb +++ b/db/migrate/20161220064910_add_current_field_to_case.rb @@ -1,4 +1,4 @@ -class AddCurrentFieldToCase < ActiveRecord::Migration +class AddCurrentFieldToCase < ActiveRecord::Migration[5.2] def change add_column :cases, :current, :boolean, default: true end diff --git a/db/migrate/20170106020143_change_default_value_of_domain_four_score.rb b/db/migrate/20170106020143_change_default_value_of_domain_four_score.rb index e2d219d715..c4ca1f98c3 100644 --- a/db/migrate/20170106020143_change_default_value_of_domain_four_score.rb +++ b/db/migrate/20170106020143_change_default_value_of_domain_four_score.rb @@ -1,4 +1,4 @@ -class ChangeDefaultValueOfDomainFourScore < ActiveRecord::Migration +class ChangeDefaultValueOfDomainFourScore < ActiveRecord::Migration[5.2] def change change_column :domains, :score_4_color, :string, default: 'primary' end diff --git a/db/migrate/20170113100759_add_disable_to_users.rb b/db/migrate/20170113100759_add_disable_to_users.rb index 7e35a32361..6204a726a5 100644 --- a/db/migrate/20170113100759_add_disable_to_users.rb +++ b/db/migrate/20170113100759_add_disable_to_users.rb @@ -1,4 +1,4 @@ -class AddDisableToUsers < ActiveRecord::Migration +class AddDisableToUsers < ActiveRecord::Migration[5.2] def change add_column :users, :disable, :boolean, default: false end diff --git a/db/migrate/20170118021235_create_custom_fields.rb b/db/migrate/20170118021235_create_custom_fields.rb index 861e94092f..2cf9dd7954 100644 --- a/db/migrate/20170118021235_create_custom_fields.rb +++ b/db/migrate/20170118021235_create_custom_fields.rb @@ -1,4 +1,4 @@ -class CreateCustomFields < ActiveRecord::Migration +class CreateCustomFields < ActiveRecord::Migration[5.2] def change create_table :custom_fields do |t| t.string :entity_name, default: '' diff --git a/db/migrate/20170202041655_create_client_custom_fields.rb b/db/migrate/20170202041655_create_client_custom_fields.rb index e0eb8dc6e1..c2f90e90ee 100644 --- a/db/migrate/20170202041655_create_client_custom_fields.rb +++ b/db/migrate/20170202041655_create_client_custom_fields.rb @@ -1,4 +1,4 @@ -class CreateClientCustomFields < ActiveRecord::Migration +class CreateClientCustomFields < ActiveRecord::Migration[5.2] def change create_table :client_custom_fields do |t| t.text :properties diff --git a/db/migrate/20170202042709_add_form_type_field_to_custom_field.rb b/db/migrate/20170202042709_add_form_type_field_to_custom_field.rb index 0d720f27fa..32ea7f8c1f 100644 --- a/db/migrate/20170202042709_add_form_type_field_to_custom_field.rb +++ b/db/migrate/20170202042709_add_form_type_field_to_custom_field.rb @@ -1,4 +1,4 @@ -class AddFormTypeFieldToCustomField < ActiveRecord::Migration +class AddFormTypeFieldToCustomField < ActiveRecord::Migration[5.2] def change add_column :custom_fields, :form_type, :string end diff --git a/db/migrate/20170202091136_create_family_custom_fields.rb b/db/migrate/20170202091136_create_family_custom_fields.rb index 10170b6861..eda7926a1e 100644 --- a/db/migrate/20170202091136_create_family_custom_fields.rb +++ b/db/migrate/20170202091136_create_family_custom_fields.rb @@ -1,4 +1,4 @@ -class CreateFamilyCustomFields < ActiveRecord::Migration +class CreateFamilyCustomFields < ActiveRecord::Migration[5.2] def change create_table :family_custom_fields do |t| t.text :properties diff --git a/db/migrate/20170206041958_create_partner_custom_fields.rb b/db/migrate/20170206041958_create_partner_custom_fields.rb index 493bf51110..b8addf5fe4 100644 --- a/db/migrate/20170206041958_create_partner_custom_fields.rb +++ b/db/migrate/20170206041958_create_partner_custom_fields.rb @@ -1,4 +1,4 @@ -class CreatePartnerCustomFields < ActiveRecord::Migration +class CreatePartnerCustomFields < ActiveRecord::Migration[5.2] def change create_table :partner_custom_fields do |t| t.text :properties diff --git a/db/migrate/20170206070346_create_user_custom_fields.rb b/db/migrate/20170206070346_create_user_custom_fields.rb index 1b6f5ea387..98cd339574 100644 --- a/db/migrate/20170206070346_create_user_custom_fields.rb +++ b/db/migrate/20170206070346_create_user_custom_fields.rb @@ -1,4 +1,4 @@ -class CreateUserCustomFields < ActiveRecord::Migration +class CreateUserCustomFields < ActiveRecord::Migration[5.2] def change create_table :user_custom_fields do |t| t.text :properties diff --git a/db/migrate/20170220064405_create_donors.rb b/db/migrate/20170220064405_create_donors.rb index 7c00c3a829..24301971c5 100644 --- a/db/migrate/20170220064405_create_donors.rb +++ b/db/migrate/20170220064405_create_donors.rb @@ -1,4 +1,4 @@ -class CreateDonors < ActiveRecord::Migration +class CreateDonors < ActiveRecord::Migration[5.2] def change create_table :donors do |t| t.string :name, default: '' diff --git a/db/migrate/20170220064819_add_donor_association_to_clients.rb b/db/migrate/20170220064819_add_donor_association_to_clients.rb index b91a72acc0..c2c1be739e 100644 --- a/db/migrate/20170220064819_add_donor_association_to_clients.rb +++ b/db/migrate/20170220064819_add_donor_association_to_clients.rb @@ -1,4 +1,4 @@ -class AddDonorAssociationToClients < ActiveRecord::Migration +class AddDonorAssociationToClients < ActiveRecord::Migration[5.2] def change add_reference :clients, :donor, index: true, foreign_key: true end diff --git a/db/migrate/20170223064232_change_entity_name_to_entity_type_in_custom_fields.rb b/db/migrate/20170223064232_change_entity_name_to_entity_type_in_custom_fields.rb index 0e15098f6d..0ce48dcef7 100644 --- a/db/migrate/20170223064232_change_entity_name_to_entity_type_in_custom_fields.rb +++ b/db/migrate/20170223064232_change_entity_name_to_entity_type_in_custom_fields.rb @@ -1,4 +1,4 @@ -class ChangeEntityNameToEntityTypeInCustomFields < ActiveRecord::Migration +class ChangeEntityNameToEntityTypeInCustomFields < ActiveRecord::Migration[5.2] def change rename_column :custom_fields, :entity_name, :entity_type end diff --git a/db/migrate/20170223064532_change_form_type_to_forom_title_in_custom_fields.rb b/db/migrate/20170223064532_change_form_type_to_forom_title_in_custom_fields.rb index 69a0658670..7ed14c097e 100644 --- a/db/migrate/20170223064532_change_form_type_to_forom_title_in_custom_fields.rb +++ b/db/migrate/20170223064532_change_form_type_to_forom_title_in_custom_fields.rb @@ -1,4 +1,4 @@ -class ChangeFormTypeToForomTitleInCustomFields < ActiveRecord::Migration +class ChangeFormTypeToForomTitleInCustomFields < ActiveRecord::Migration[5.2] def change rename_column :custom_fields, :form_type, :form_title change_column :custom_fields, :form_title, :string, default: '' diff --git a/db/migrate/20170302041000_add_frequency_to_custom_field.rb b/db/migrate/20170302041000_add_frequency_to_custom_field.rb index bf0aec991b..0b12ba9995 100644 --- a/db/migrate/20170302041000_add_frequency_to_custom_field.rb +++ b/db/migrate/20170302041000_add_frequency_to_custom_field.rb @@ -1,4 +1,4 @@ -class AddFrequencyToCustomField < ActiveRecord::Migration +class AddFrequencyToCustomField < ActiveRecord::Migration[5.2] def change add_column :custom_fields, :frequency, :string, default: '' add_column :custom_fields, :time_of_frequency, :integer, default: 0 diff --git a/db/migrate/20170310043816_set_deafult_to_client_able_state.rb b/db/migrate/20170310043816_set_deafult_to_client_able_state.rb index 7be5600601..c1af825bfd 100644 --- a/db/migrate/20170310043816_set_deafult_to_client_able_state.rb +++ b/db/migrate/20170310043816_set_deafult_to_client_able_state.rb @@ -1,4 +1,4 @@ -class SetDeafultToClientAbleState < ActiveRecord::Migration +class SetDeafultToClientAbleState < ActiveRecord::Migration[5.2] def up change_column_default :clients, :able_state, '' diff --git a/db/migrate/20170313031128_update_visitor_role_to_strategic_overviewer.rb b/db/migrate/20170313031128_update_visitor_role_to_strategic_overviewer.rb index 3ec4dfdc10..58953a7f83 100644 --- a/db/migrate/20170313031128_update_visitor_role_to_strategic_overviewer.rb +++ b/db/migrate/20170313031128_update_visitor_role_to_strategic_overviewer.rb @@ -1,4 +1,4 @@ -class UpdateVisitorRoleToStrategicOverviewer < ActiveRecord::Migration +class UpdateVisitorRoleToStrategicOverviewer < ActiveRecord::Migration[5.2] def change unprocessable_users = [] diff --git a/db/migrate/20170317094205_add_client_first_name_and_last_name_local.rb b/db/migrate/20170317094205_add_client_first_name_and_last_name_local.rb index 25b0f66d10..0903221b5d 100644 --- a/db/migrate/20170317094205_add_client_first_name_and_last_name_local.rb +++ b/db/migrate/20170317094205_add_client_first_name_and_last_name_local.rb @@ -1,4 +1,4 @@ -class AddClientFirstNameAndLastNameLocal < ActiveRecord::Migration +class AddClientFirstNameAndLastNameLocal < ActiveRecord::Migration[5.2] def change add_column :clients, :local_first_name, :string, default: '' add_column :clients, :local_last_name, :string, default: '' diff --git a/db/migrate/20170317094317_split_client_name_to_first_name_and_last_name.rb b/db/migrate/20170317094317_split_client_name_to_first_name_and_last_name.rb index a9c692f085..9f505ccfc8 100644 --- a/db/migrate/20170317094317_split_client_name_to_first_name_and_last_name.rb +++ b/db/migrate/20170317094317_split_client_name_to_first_name_and_last_name.rb @@ -1,4 +1,4 @@ -class SplitClientNameToFirstNameAndLastName < ActiveRecord::Migration +class SplitClientNameToFirstNameAndLastName < ActiveRecord::Migration[5.2] def change unprocessable_clients = [] diff --git a/db/migrate/20170322045636_add_organization_name_to_custom_field.rb b/db/migrate/20170322045636_add_organization_name_to_custom_field.rb index d393e96735..81260f4cee 100644 --- a/db/migrate/20170322045636_add_organization_name_to_custom_field.rb +++ b/db/migrate/20170322045636_add_organization_name_to_custom_field.rb @@ -1,4 +1,4 @@ -class AddOrganizationNameToCustomField < ActiveRecord::Migration +class AddOrganizationNameToCustomField < ActiveRecord::Migration[5.2] def up if column_exists? :custom_fields, :ngo_name remove_column :custom_fields, :ngo_name diff --git a/db/migrate/20170322074147_update_organization_name_in_custom_field.rb b/db/migrate/20170322074147_update_organization_name_in_custom_field.rb index ba3b7f5804..368dfc8774 100644 --- a/db/migrate/20170322074147_update_organization_name_in_custom_field.rb +++ b/db/migrate/20170322074147_update_organization_name_in_custom_field.rb @@ -1,4 +1,4 @@ -class UpdateOrganizationNameInCustomField < ActiveRecord::Migration +class UpdateOrganizationNameInCustomField < ActiveRecord::Migration[5.2] def change unprocessable_custom_fields = [] @@ -8,7 +8,7 @@ def change begin if custom_field.ngo_name.blank? custom_field.update_attributes!(ngo_name: Organization.current.full_name) - end + end rescue unprocessable_custom_fields << custom_field.id end diff --git a/db/migrate/20170327015408_add_columns_for_icf_data_import.rb b/db/migrate/20170327015408_add_columns_for_icf_data_import.rb index 568e11c4c9..33d6aa90f9 100644 --- a/db/migrate/20170327015408_add_columns_for_icf_data_import.rb +++ b/db/migrate/20170327015408_add_columns_for_icf_data_import.rb @@ -1,4 +1,4 @@ -class AddColumnsForIcfDataImport < ActiveRecord::Migration +class AddColumnsForIcfDataImport < ActiveRecord::Migration[5.2] def change add_column :clients, :kid_id, :string, default: '' add_column :donors, :code, :string, default: '' diff --git a/db/migrate/20170419023745_rename_client_name_fields.rb b/db/migrate/20170419023745_rename_client_name_fields.rb index 4348d8d7de..9e55e89eaf 100644 --- a/db/migrate/20170419023745_rename_client_name_fields.rb +++ b/db/migrate/20170419023745_rename_client_name_fields.rb @@ -1,4 +1,4 @@ -class RenameClientNameFields < ActiveRecord::Migration +class RenameClientNameFields < ActiveRecord::Migration[5.2] def change rename_column :clients, :first_name, :given_name rename_column :clients, :last_name, :family_name diff --git a/db/migrate/20170419032405_create_custom_field_properties.rb b/db/migrate/20170419032405_create_custom_field_properties.rb index 8b8025db8d..f24c5dfc3e 100644 --- a/db/migrate/20170419032405_create_custom_field_properties.rb +++ b/db/migrate/20170419032405_create_custom_field_properties.rb @@ -1,4 +1,4 @@ -class CreateCustomFieldProperties < ActiveRecord::Migration +class CreateCustomFieldProperties < ActiveRecord::Migration[5.2] def change create_table :custom_field_properties do |t| t.jsonb :properties, default: {} diff --git a/db/migrate/20170426033705_move_client_custom_field_to_custom_field_property.rb b/db/migrate/20170426033705_move_client_custom_field_to_custom_field_property.rb index 0452498015..9c23b895e4 100644 --- a/db/migrate/20170426033705_move_client_custom_field_to_custom_field_property.rb +++ b/db/migrate/20170426033705_move_client_custom_field_to_custom_field_property.rb @@ -1,4 +1,4 @@ -class MoveClientCustomFieldToCustomFieldProperty < ActiveRecord::Migration +class MoveClientCustomFieldToCustomFieldProperty < ActiveRecord::Migration[5.2] def change # unused table drop_table :client_custom_fields diff --git a/db/migrate/20170426035751_move_family_custom_field_to_custom_field_property.rb b/db/migrate/20170426035751_move_family_custom_field_to_custom_field_property.rb index 3f60a00a3a..82d6ba447e 100644 --- a/db/migrate/20170426035751_move_family_custom_field_to_custom_field_property.rb +++ b/db/migrate/20170426035751_move_family_custom_field_to_custom_field_property.rb @@ -1,4 +1,4 @@ -class MoveFamilyCustomFieldToCustomFieldProperty < ActiveRecord::Migration +class MoveFamilyCustomFieldToCustomFieldProperty < ActiveRecord::Migration[5.2] def change # unused table drop_table :family_custom_fields diff --git a/db/migrate/20170426041455_move_partner_custom_field_to_custom_field_property.rb b/db/migrate/20170426041455_move_partner_custom_field_to_custom_field_property.rb index 42d71cdb92..53761ad001 100644 --- a/db/migrate/20170426041455_move_partner_custom_field_to_custom_field_property.rb +++ b/db/migrate/20170426041455_move_partner_custom_field_to_custom_field_property.rb @@ -1,4 +1,4 @@ -class MovePartnerCustomFieldToCustomFieldProperty < ActiveRecord::Migration +class MovePartnerCustomFieldToCustomFieldProperty < ActiveRecord::Migration[5.2] def change # unused table drop_table :partner_custom_fields diff --git a/db/migrate/20170426041718_move_user_custom_field_to_custom_field_property.rb b/db/migrate/20170426041718_move_user_custom_field_to_custom_field_property.rb index 7040fe0d19..2444aa9c45 100644 --- a/db/migrate/20170426041718_move_user_custom_field_to_custom_field_property.rb +++ b/db/migrate/20170426041718_move_user_custom_field_to_custom_field_property.rb @@ -1,4 +1,4 @@ -class MoveUserCustomFieldToCustomFieldProperty < ActiveRecord::Migration +class MoveUserCustomFieldToCustomFieldProperty < ActiveRecord::Migration[5.2] def change # unused table drop_table :user_custom_fields diff --git a/db/migrate/20170504065720_add_expires_at_field_to_user.rb b/db/migrate/20170504065720_add_expires_at_field_to_user.rb index 897181d1d4..b932be4aa8 100644 --- a/db/migrate/20170504065720_add_expires_at_field_to_user.rb +++ b/db/migrate/20170504065720_add_expires_at_field_to_user.rb @@ -1,4 +1,4 @@ -class AddExpiresAtFieldToUser < ActiveRecord::Migration +class AddExpiresAtFieldToUser < ActiveRecord::Migration[5.2] def change add_column :users, :expires_at, :datetime end diff --git a/db/migrate/20170505025525_add_task_notify_field_to_user.rb b/db/migrate/20170505025525_add_task_notify_field_to_user.rb index 7d9dc0e08f..ba571502b9 100644 --- a/db/migrate/20170505025525_add_task_notify_field_to_user.rb +++ b/db/migrate/20170505025525_add_task_notify_field_to_user.rb @@ -1,4 +1,4 @@ -class AddTaskNotifyFieldToUser < ActiveRecord::Migration +class AddTaskNotifyFieldToUser < ActiveRecord::Migration[5.2] def change add_column :users, :task_notify, :boolean, default: true end diff --git a/db/migrate/20170505074210_add_manager_id_field_to_user.rb b/db/migrate/20170505074210_add_manager_id_field_to_user.rb index 66c1eba1aa..79c0cdd9f3 100644 --- a/db/migrate/20170505074210_add_manager_id_field_to_user.rb +++ b/db/migrate/20170505074210_add_manager_id_field_to_user.rb @@ -1,4 +1,4 @@ -class AddManagerIdFieldToUser < ActiveRecord::Migration +class AddManagerIdFieldToUser < ActiveRecord::Migration[5.2] def change add_column :users, :manager_id, :integer end diff --git a/db/migrate/20170505074620_add_fields_to_client.rb b/db/migrate/20170505074620_add_fields_to_client.rb index e0f7205fb3..0b953a0055 100644 --- a/db/migrate/20170505074620_add_fields_to_client.rb +++ b/db/migrate/20170505074620_add_fields_to_client.rb @@ -1,4 +1,4 @@ -class AddFieldsToClient < ActiveRecord::Migration +class AddFieldsToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :house_number, :string, default: '' add_column :clients, :street_number, :string, default: '' diff --git a/db/migrate/20170505081953_add_calendar_integration_field_to_user.rb b/db/migrate/20170505081953_add_calendar_integration_field_to_user.rb index 3a653de9f4..0149cc64f2 100644 --- a/db/migrate/20170505081953_add_calendar_integration_field_to_user.rb +++ b/db/migrate/20170505081953_add_calendar_integration_field_to_user.rb @@ -1,4 +1,4 @@ -class AddCalendarIntegrationFieldToUser < ActiveRecord::Migration +class AddCalendarIntegrationFieldToUser < ActiveRecord::Migration[5.2] def change add_column :users, :calendar_integration, :boolean, default: false end diff --git a/db/migrate/20170516023913_rename_field_in_custom_field_to_property.rb b/db/migrate/20170516023913_rename_field_in_custom_field_to_property.rb index 0371c764b1..07ada539ce 100644 --- a/db/migrate/20170516023913_rename_field_in_custom_field_to_property.rb +++ b/db/migrate/20170516023913_rename_field_in_custom_field_to_property.rb @@ -1,4 +1,4 @@ -class RenameFieldInCustomFieldToProperty < ActiveRecord::Migration +class RenameFieldInCustomFieldToProperty < ActiveRecord::Migration[5.2] def change rename_column :custom_fields, :fields, :properties end diff --git a/db/migrate/20170516034013_add_field_to_custom_field.rb b/db/migrate/20170516034013_add_field_to_custom_field.rb index 84819ccf53..2e81344fd0 100644 --- a/db/migrate/20170516034013_add_field_to_custom_field.rb +++ b/db/migrate/20170516034013_add_field_to_custom_field.rb @@ -1,4 +1,4 @@ -class AddFieldToCustomField < ActiveRecord::Migration +class AddFieldToCustomField < ActiveRecord::Migration[5.2] def change add_column :custom_fields, :fields, :jsonb end diff --git a/db/migrate/20170516034242_move_property_to_field_in_custom_field.rb b/db/migrate/20170516034242_move_property_to_field_in_custom_field.rb index 1cdca00c0b..12bccab779 100644 --- a/db/migrate/20170516034242_move_property_to_field_in_custom_field.rb +++ b/db/migrate/20170516034242_move_property_to_field_in_custom_field.rb @@ -1,9 +1,9 @@ -class MovePropertyToFieldInCustomField < ActiveRecord::Migration +class MovePropertyToFieldInCustomField < ActiveRecord::Migration[5.2] def change puts '==========Processing==========' CustomField.all.each do |custom_field| - property = custom_field.properties.present? ? custom_field.properties : '[]' + property = custom_field.properties.present? ? custom_field.properties : '[]' custom_field.update_columns(fields: eval(property)) end diff --git a/db/migrate/20170516082144_add_fields_to_client_for_cfi.rb b/db/migrate/20170516082144_add_fields_to_client_for_cfi.rb index 1025a1e96d..3195215173 100644 --- a/db/migrate/20170516082144_add_fields_to_client_for_cfi.rb +++ b/db/migrate/20170516082144_add_fields_to_client_for_cfi.rb @@ -1,4 +1,4 @@ -class AddFieldsToClientForCfi < ActiveRecord::Migration +class AddFieldsToClientForCfi < ActiveRecord::Migration[5.2] def change add_column :clients, :live_with, :string, default: '' add_column :clients, :poverty_certificate, :integer, default: 0 diff --git a/db/migrate/20170517031807_add_pin_number_to_user.rb b/db/migrate/20170517031807_add_pin_number_to_user.rb index b9c4e4333d..cc9f786b73 100644 --- a/db/migrate/20170517031807_add_pin_number_to_user.rb +++ b/db/migrate/20170517031807_add_pin_number_to_user.rb @@ -1,4 +1,4 @@ -class AddPinNumberToUser < ActiveRecord::Migration +class AddPinNumberToUser < ActiveRecord::Migration[5.2] def change add_column :users, :pin_number, :integer end diff --git a/db/migrate/20170517043459_create_program_streams.rb b/db/migrate/20170517043459_create_program_streams.rb index 631f8c609f..4bafedfdb9 100644 --- a/db/migrate/20170517043459_create_program_streams.rb +++ b/db/migrate/20170517043459_create_program_streams.rb @@ -1,4 +1,4 @@ -class CreateProgramStreams < ActiveRecord::Migration +class CreateProgramStreams < ActiveRecord::Migration[5.2] def change create_table :program_streams do |t| t.string :name diff --git a/db/migrate/20170517082509_add_fields_to_program_stream.rb b/db/migrate/20170517082509_add_fields_to_program_stream.rb index be799e6f9f..c982690089 100644 --- a/db/migrate/20170517082509_add_fields_to_program_stream.rb +++ b/db/migrate/20170517082509_add_fields_to_program_stream.rb @@ -1,4 +1,4 @@ -class AddFieldsToProgramStream < ActiveRecord::Migration +class AddFieldsToProgramStream < ActiveRecord::Migration[5.2] def change add_column :program_streams, :frequency, :string, default: '' add_column :program_streams, :time_of_frequency, :integer, default: 0 diff --git a/db/migrate/20170518031811_add_attachment_to_custom_field_property.rb b/db/migrate/20170518031811_add_attachment_to_custom_field_property.rb index 2ef3780e0e..d4e7925c66 100644 --- a/db/migrate/20170518031811_add_attachment_to_custom_field_property.rb +++ b/db/migrate/20170518031811_add_attachment_to_custom_field_property.rb @@ -1,4 +1,4 @@ -class AddAttachmentToCustomFieldProperty < ActiveRecord::Migration +class AddAttachmentToCustomFieldProperty < ActiveRecord::Migration[5.2] def change add_column :custom_field_properties, :attachments, :jsonb end diff --git a/db/migrate/20170524021751_create_domain_program_streams.rb b/db/migrate/20170524021751_create_domain_program_streams.rb index 108d6daa6a..bf8aa6dfeb 100644 --- a/db/migrate/20170524021751_create_domain_program_streams.rb +++ b/db/migrate/20170524021751_create_domain_program_streams.rb @@ -1,4 +1,4 @@ -class CreateDomainProgramStreams < ActiveRecord::Migration +class CreateDomainProgramStreams < ActiveRecord::Migration[5.2] def change create_table :domain_program_streams do |t| t.integer :program_stream_id diff --git a/db/migrate/20170524033834_add_field_fcf_ngo_to_organization.rb b/db/migrate/20170524033834_add_field_fcf_ngo_to_organization.rb index eb72af3154..37e8f02169 100644 --- a/db/migrate/20170524033834_add_field_fcf_ngo_to_organization.rb +++ b/db/migrate/20170524033834_add_field_fcf_ngo_to_organization.rb @@ -1,4 +1,4 @@ -class AddFieldFcfNgoToOrganization < ActiveRecord::Migration +class AddFieldFcfNgoToOrganization < ActiveRecord::Migration[5.2] def change add_column :organizations, :fcf_ngo, :boolean, default: false end diff --git a/db/migrate/20170524071015_add_field_quantity_to_program_stream.rb b/db/migrate/20170524071015_add_field_quantity_to_program_stream.rb index 86afdb40a3..72686d6c66 100644 --- a/db/migrate/20170524071015_add_field_quantity_to_program_stream.rb +++ b/db/migrate/20170524071015_add_field_quantity_to_program_stream.rb @@ -1,4 +1,4 @@ -class AddFieldQuantityToProgramStream < ActiveRecord::Migration +class AddFieldQuantityToProgramStream < ActiveRecord::Migration[5.2] def change add_column :program_streams, :quantity, :integer end diff --git a/db/migrate/20170525081727_create_visits.rb b/db/migrate/20170525081727_create_visits.rb index 980b0d0239..4e4fbc59b4 100644 --- a/db/migrate/20170525081727_create_visits.rb +++ b/db/migrate/20170525081727_create_visits.rb @@ -1,4 +1,4 @@ -class CreateVisits < ActiveRecord::Migration +class CreateVisits < ActiveRecord::Migration[5.2] def change create_table :visits do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20170529024845_create_client_enrollments.rb b/db/migrate/20170529024845_create_client_enrollments.rb index ca88158412..8274415b5c 100644 --- a/db/migrate/20170529024845_create_client_enrollments.rb +++ b/db/migrate/20170529024845_create_client_enrollments.rb @@ -1,4 +1,4 @@ -class CreateClientEnrollments < ActiveRecord::Migration +class CreateClientEnrollments < ActiveRecord::Migration[5.2] def change create_table :client_enrollments do |t| t.jsonb :properties diff --git a/db/migrate/20170529025228_create_trackings.rb b/db/migrate/20170529025228_create_trackings.rb index 48ad15659b..32f47982e8 100644 --- a/db/migrate/20170529025228_create_trackings.rb +++ b/db/migrate/20170529025228_create_trackings.rb @@ -1,4 +1,4 @@ -class CreateTrackings < ActiveRecord::Migration +class CreateTrackings < ActiveRecord::Migration[5.2] def change create_table :trackings do |t| t.jsonb :properties diff --git a/db/migrate/20170529025247_create_leave_programs.rb b/db/migrate/20170529025247_create_leave_programs.rb index c723630f18..75b97458c2 100644 --- a/db/migrate/20170529025247_create_leave_programs.rb +++ b/db/migrate/20170529025247_create_leave_programs.rb @@ -1,4 +1,4 @@ -class CreateLeavePrograms < ActiveRecord::Migration +class CreateLeavePrograms < ActiveRecord::Migration[5.2] def change create_table :leave_programs do |t| t.jsonb :properties diff --git a/db/migrate/20170601025628_add_field_program_stream_id_to_leave_program.rb b/db/migrate/20170601025628_add_field_program_stream_id_to_leave_program.rb index 8de761b5a9..824d47cc11 100644 --- a/db/migrate/20170601025628_add_field_program_stream_id_to_leave_program.rb +++ b/db/migrate/20170601025628_add_field_program_stream_id_to_leave_program.rb @@ -1,4 +1,4 @@ -class AddFieldProgramStreamIdToLeaveProgram < ActiveRecord::Migration +class AddFieldProgramStreamIdToLeaveProgram < ActiveRecord::Migration[5.2] def change add_column :leave_programs, :program_stream_id, :integer end diff --git a/db/migrate/20170601025654_add_field_program_stream_id_to_tracking.rb b/db/migrate/20170601025654_add_field_program_stream_id_to_tracking.rb index 0fe764deb3..2419104d19 100644 --- a/db/migrate/20170601025654_add_field_program_stream_id_to_tracking.rb +++ b/db/migrate/20170601025654_add_field_program_stream_id_to_tracking.rb @@ -1,4 +1,4 @@ -class AddFieldProgramStreamIdToTracking < ActiveRecord::Migration +class AddFieldProgramStreamIdToTracking < ActiveRecord::Migration[5.2] def change add_column :trackings, :program_stream_id, :integer end diff --git a/db/migrate/20170607085522_add_field_ngo_name_to_program_stream.rb b/db/migrate/20170607085522_add_field_ngo_name_to_program_stream.rb index fccfd747af..f3870eb1a4 100644 --- a/db/migrate/20170607085522_add_field_ngo_name_to_program_stream.rb +++ b/db/migrate/20170607085522_add_field_ngo_name_to_program_stream.rb @@ -1,4 +1,4 @@ -class AddFieldNgoNameToProgramStream < ActiveRecord::Migration +class AddFieldNgoNameToProgramStream < ActiveRecord::Migration[5.2] def change add_column :program_streams, :ngo_name, :string, default: '' end diff --git a/db/migrate/20170608035858_rename_tracking_table_to_client_tracking.rb b/db/migrate/20170608035858_rename_tracking_table_to_client_tracking.rb index 594e9baa9e..fd8b6bae8d 100644 --- a/db/migrate/20170608035858_rename_tracking_table_to_client_tracking.rb +++ b/db/migrate/20170608035858_rename_tracking_table_to_client_tracking.rb @@ -1,4 +1,4 @@ -class RenameTrackingTableToClientTracking < ActiveRecord::Migration +class RenameTrackingTableToClientTracking < ActiveRecord::Migration[5.2] def change rename_table :trackings, :client_enrollment_trackings end diff --git a/db/migrate/20170608043550_tracking.rb b/db/migrate/20170608043550_tracking.rb index 67d0da055f..2f96e00ca6 100644 --- a/db/migrate/20170608043550_tracking.rb +++ b/db/migrate/20170608043550_tracking.rb @@ -1,4 +1,4 @@ -class Tracking < ActiveRecord::Migration +class Tracking < ActiveRecord::Migration[5.2] def change create_table :trackings do |t| t.string :name, default: '' diff --git a/db/migrate/20170608044102_add_tracking_id_to_client_enrollment_tracking.rb b/db/migrate/20170608044102_add_tracking_id_to_client_enrollment_tracking.rb index 06a330a066..9402543408 100644 --- a/db/migrate/20170608044102_add_tracking_id_to_client_enrollment_tracking.rb +++ b/db/migrate/20170608044102_add_tracking_id_to_client_enrollment_tracking.rb @@ -1,4 +1,4 @@ -class AddTrackingIdToClientEnrollmentTracking < ActiveRecord::Migration +class AddTrackingIdToClientEnrollmentTracking < ActiveRecord::Migration[5.2] def change add_column :client_enrollment_trackings, :tracking_id, :integer end diff --git a/db/migrate/20170613025900_add_manager_ids_to_user.rb b/db/migrate/20170613025900_add_manager_ids_to_user.rb index ef768c254e..5824aa16a6 100644 --- a/db/migrate/20170613025900_add_manager_ids_to_user.rb +++ b/db/migrate/20170613025900_add_manager_ids_to_user.rb @@ -1,4 +1,4 @@ -class AddManagerIdsToUser < ActiveRecord::Migration +class AddManagerIdsToUser < ActiveRecord::Migration[5.2] def change add_column :users, :manager_ids, :integer, array: true, default: [] end diff --git a/db/migrate/20170613030148_move_manager_id_to_manager_ids.rb b/db/migrate/20170613030148_move_manager_id_to_manager_ids.rb index fa68d788e8..75dd1b7aac 100644 --- a/db/migrate/20170613030148_move_manager_id_to_manager_ids.rb +++ b/db/migrate/20170613030148_move_manager_id_to_manager_ids.rb @@ -1,4 +1,4 @@ -class MoveManagerIdToManagerIds < ActiveRecord::Migration +class MoveManagerIdToManagerIds < ActiveRecord::Migration[5.2] def up unprocessable_users = [] diff --git a/db/migrate/20170614085443_add_unique_index_to_tracking.rb b/db/migrate/20170614085443_add_unique_index_to_tracking.rb index 4d1dfb2da4..78e573e3ef 100644 --- a/db/migrate/20170614085443_add_unique_index_to_tracking.rb +++ b/db/migrate/20170614085443_add_unique_index_to_tracking.rb @@ -1,4 +1,4 @@ -class AddUniqueIndexToTracking < ActiveRecord::Migration +class AddUniqueIndexToTracking < ActiveRecord::Migration[5.2] def change add_index :trackings, [:name, :program_stream_id], unique: true end diff --git a/db/migrate/20170619073859_rename_field_poverty_certificate_in_client.rb b/db/migrate/20170619073859_rename_field_poverty_certificate_in_client.rb index 0255ae544d..e373ebb43c 100644 --- a/db/migrate/20170619073859_rename_field_poverty_certificate_in_client.rb +++ b/db/migrate/20170619073859_rename_field_poverty_certificate_in_client.rb @@ -1,4 +1,4 @@ -class RenameFieldPovertyCertificateInClient < ActiveRecord::Migration +class RenameFieldPovertyCertificateInClient < ActiveRecord::Migration[5.2] def change rename_column :clients, :poverty_certificate, :id_poor end diff --git a/db/migrate/20170620035801_add_attachment_to_case_note_domain_group.rb b/db/migrate/20170620035801_add_attachment_to_case_note_domain_group.rb index f52df62d2d..6155433ddd 100644 --- a/db/migrate/20170620035801_add_attachment_to_case_note_domain_group.rb +++ b/db/migrate/20170620035801_add_attachment_to_case_note_domain_group.rb @@ -1,4 +1,4 @@ -class AddAttachmentToCaseNoteDomainGroup < ActiveRecord::Migration +class AddAttachmentToCaseNoteDomainGroup < ActiveRecord::Migration[5.2] def change add_column :case_note_domain_groups , :attachments, :string, array: true, default: [] end diff --git a/db/migrate/20170620092900_add_rule_default_value_to_program_stream.rb b/db/migrate/20170620092900_add_rule_default_value_to_program_stream.rb index cfb2fcf5ec..fe0a52df5b 100644 --- a/db/migrate/20170620092900_add_rule_default_value_to_program_stream.rb +++ b/db/migrate/20170620092900_add_rule_default_value_to_program_stream.rb @@ -1,4 +1,4 @@ -class AddRuleDefaultValueToProgramStream < ActiveRecord::Migration +class AddRuleDefaultValueToProgramStream < ActiveRecord::Migration[5.2] def up change_column :program_streams, :rules, :jsonb, default: {} end diff --git a/db/migrate/20170620092913_add_enrollment_default_value_to_program_stream.rb b/db/migrate/20170620092913_add_enrollment_default_value_to_program_stream.rb index f3526a3fe6..34f0abdd64 100644 --- a/db/migrate/20170620092913_add_enrollment_default_value_to_program_stream.rb +++ b/db/migrate/20170620092913_add_enrollment_default_value_to_program_stream.rb @@ -1,4 +1,4 @@ -class AddEnrollmentDefaultValueToProgramStream < ActiveRecord::Migration +class AddEnrollmentDefaultValueToProgramStream < ActiveRecord::Migration[5.2] def up change_column :program_streams, :enrollment, :jsonb, default: {} end diff --git a/db/migrate/20170620092926_add_leave_program_default_value_to_program_stream.rb b/db/migrate/20170620092926_add_leave_program_default_value_to_program_stream.rb index 23910acaea..5c8983468e 100644 --- a/db/migrate/20170620092926_add_leave_program_default_value_to_program_stream.rb +++ b/db/migrate/20170620092926_add_leave_program_default_value_to_program_stream.rb @@ -1,4 +1,4 @@ -class AddLeaveProgramDefaultValueToProgramStream < ActiveRecord::Migration +class AddLeaveProgramDefaultValueToProgramStream < ActiveRecord::Migration[5.2] def up change_column :program_streams, :exit_program, :jsonb, default: {} end diff --git a/db/migrate/20170621072056_add_attachments_to_assessment_domain.rb b/db/migrate/20170621072056_add_attachments_to_assessment_domain.rb index c2e4ba3fac..18494b1944 100644 --- a/db/migrate/20170621072056_add_attachments_to_assessment_domain.rb +++ b/db/migrate/20170621072056_add_attachments_to_assessment_domain.rb @@ -1,4 +1,4 @@ -class AddAttachmentsToAssessmentDomain < ActiveRecord::Migration +class AddAttachmentsToAssessmentDomain < ActiveRecord::Migration[5.2] def change add_column :assessment_domains, :attachments, :string, array: true, default: [] end diff --git a/db/migrate/20170621084646_add_fields_default_value_to_tracking.rb b/db/migrate/20170621084646_add_fields_default_value_to_tracking.rb index 003bdb05f7..b2890f1dfd 100644 --- a/db/migrate/20170621084646_add_fields_default_value_to_tracking.rb +++ b/db/migrate/20170621084646_add_fields_default_value_to_tracking.rb @@ -1,4 +1,4 @@ -class AddFieldsDefaultValueToTracking < ActiveRecord::Migration +class AddFieldsDefaultValueToTracking < ActiveRecord::Migration[5.2] def up change_column :trackings, :fields, :jsonb, default: {} end diff --git a/db/migrate/20170622041205_add_completed_field_to_program_stream.rb b/db/migrate/20170622041205_add_completed_field_to_program_stream.rb index 63948e5ac6..4b2eac893b 100644 --- a/db/migrate/20170622041205_add_completed_field_to_program_stream.rb +++ b/db/migrate/20170622041205_add_completed_field_to_program_stream.rb @@ -1,4 +1,4 @@ -class AddCompletedFieldToProgramStream < ActiveRecord::Migration +class AddCompletedFieldToProgramStream < ActiveRecord::Migration[5.2] def change add_column :program_streams, :completed, :boolean, default: false end diff --git a/db/migrate/20170703034520_remove_fields_from_program_stream.rb b/db/migrate/20170703034520_remove_fields_from_program_stream.rb index 814cc460a0..145f6ebf84 100644 --- a/db/migrate/20170703034520_remove_fields_from_program_stream.rb +++ b/db/migrate/20170703034520_remove_fields_from_program_stream.rb @@ -1,4 +1,4 @@ -class RemoveFieldsFromProgramStream < ActiveRecord::Migration +class RemoveFieldsFromProgramStream < ActiveRecord::Migration[5.2] def change remove_column :program_streams, :tracking, :jsonb remove_column :program_streams, :frequency, :string diff --git a/db/migrate/20170703035138_remove_field_program_stream_id_from_client_enrollment_tracking.rb b/db/migrate/20170703035138_remove_field_program_stream_id_from_client_enrollment_tracking.rb index 37b5315fee..00136d10ed 100644 --- a/db/migrate/20170703035138_remove_field_program_stream_id_from_client_enrollment_tracking.rb +++ b/db/migrate/20170703035138_remove_field_program_stream_id_from_client_enrollment_tracking.rb @@ -1,4 +1,4 @@ -class RemoveFieldProgramStreamIdFromClientEnrollmentTracking < ActiveRecord::Migration +class RemoveFieldProgramStreamIdFromClientEnrollmentTracking < ActiveRecord::Migration[5.2] def change remove_column :client_enrollment_trackings, :program_stream_id, :integer end diff --git a/db/migrate/20170704070624_create_calendars.rb b/db/migrate/20170704070624_create_calendars.rb index 0cb65901ee..ddf5959029 100644 --- a/db/migrate/20170704070624_create_calendars.rb +++ b/db/migrate/20170704070624_create_calendars.rb @@ -1,4 +1,4 @@ -class CreateCalendars < ActiveRecord::Migration +class CreateCalendars < ActiveRecord::Migration[5.2] def change create_table :calendars do |t| t.string :title diff --git a/db/migrate/20170706083521_add_exit_note_and_exit_date_to_client.rb b/db/migrate/20170706083521_add_exit_note_and_exit_date_to_client.rb index 891a26ae98..0d639de46a 100644 --- a/db/migrate/20170706083521_add_exit_note_and_exit_date_to_client.rb +++ b/db/migrate/20170706083521_add_exit_note_and_exit_date_to_client.rb @@ -1,4 +1,4 @@ -class AddExitNoteAndExitDateToClient < ActiveRecord::Migration +class AddExitNoteAndExitDateToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :exit_note, :text, default: '' add_column :clients, :exit_date, :date diff --git a/db/migrate/20170710030328_create_case_worker_client.rb b/db/migrate/20170710030328_create_case_worker_client.rb index cfd1d63e99..88e9314e05 100644 --- a/db/migrate/20170710030328_create_case_worker_client.rb +++ b/db/migrate/20170710030328_create_case_worker_client.rb @@ -1,4 +1,4 @@ -class CreateCaseWorkerClient < ActiveRecord::Migration +class CreateCaseWorkerClient < ActiveRecord::Migration[5.2] def change create_table :case_worker_clients do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20170714025348_add_program_exclusive_and_mutual_dependence_to_program_stream.rb b/db/migrate/20170714025348_add_program_exclusive_and_mutual_dependence_to_program_stream.rb index 6effa622e2..c714966c25 100644 --- a/db/migrate/20170714025348_add_program_exclusive_and_mutual_dependence_to_program_stream.rb +++ b/db/migrate/20170714025348_add_program_exclusive_and_mutual_dependence_to_program_stream.rb @@ -1,4 +1,4 @@ -class AddProgramExclusiveAndMutualDependenceToProgramStream < ActiveRecord::Migration +class AddProgramExclusiveAndMutualDependenceToProgramStream < ActiveRecord::Migration[5.2] def change add_column :program_streams, :program_exclusive, :integer, array: true, default: [] add_column :program_streams, :mutual_dependence, :integer, array: true, default: [] diff --git a/db/migrate/20170718034828_add_enrollment_date_to_client_enrollment_form.rb b/db/migrate/20170718034828_add_enrollment_date_to_client_enrollment_form.rb index 385fe4947c..bb839aabf8 100644 --- a/db/migrate/20170718034828_add_enrollment_date_to_client_enrollment_form.rb +++ b/db/migrate/20170718034828_add_enrollment_date_to_client_enrollment_form.rb @@ -1,4 +1,4 @@ -class AddEnrollmentDateToClientEnrollmentForm < ActiveRecord::Migration +class AddEnrollmentDateToClientEnrollmentForm < ActiveRecord::Migration[5.2] def change add_column :client_enrollments, :enrollment_date, :date end diff --git a/db/migrate/20170718090148_add_exit_date_to_leave_program.rb b/db/migrate/20170718090148_add_exit_date_to_leave_program.rb index e72439d162..b0db623e88 100644 --- a/db/migrate/20170718090148_add_exit_date_to_leave_program.rb +++ b/db/migrate/20170718090148_add_exit_date_to_leave_program.rb @@ -1,4 +1,4 @@ -class AddExitDateToLeaveProgram < ActiveRecord::Migration +class AddExitDateToLeaveProgram < ActiveRecord::Migration[5.2] def change add_column :leave_programs, :exit_date, :date end diff --git a/db/migrate/20170721064826_create_case_worker_task.rb b/db/migrate/20170721064826_create_case_worker_task.rb index 4c78e97e90..6b307a77d7 100644 --- a/db/migrate/20170721064826_create_case_worker_task.rb +++ b/db/migrate/20170721064826_create_case_worker_task.rb @@ -1,4 +1,4 @@ -class CreateCaseWorkerTask < ActiveRecord::Migration +class CreateCaseWorkerTask < ActiveRecord::Migration[5.2] def change create_table :case_worker_tasks do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20170727032556_add_field_accepted_date_to_client.rb b/db/migrate/20170727032556_add_field_accepted_date_to_client.rb index 4d5644856f..9d1e412830 100644 --- a/db/migrate/20170727032556_add_field_accepted_date_to_client.rb +++ b/db/migrate/20170727032556_add_field_accepted_date_to_client.rb @@ -1,4 +1,4 @@ -class AddFieldAcceptedDateToClient < ActiveRecord::Migration +class AddFieldAcceptedDateToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :accepted_date, :date end diff --git a/db/migrate/20170801072754_add_tracking_to_program_stream.rb b/db/migrate/20170801072754_add_tracking_to_program_stream.rb index 4c298dcdec..77541c477c 100644 --- a/db/migrate/20170801072754_add_tracking_to_program_stream.rb +++ b/db/migrate/20170801072754_add_tracking_to_program_stream.rb @@ -1,4 +1,4 @@ -class AddTrackingToProgramStream < ActiveRecord::Migration +class AddTrackingToProgramStream < ActiveRecord::Migration[5.2] def change add_column :program_streams, :tracking_required, :boolean, default: false end diff --git a/db/migrate/20170802065632_add_field_program_warning_to_user.rb b/db/migrate/20170802065632_add_field_program_warning_to_user.rb index 1dc6e6d140..5373f18596 100644 --- a/db/migrate/20170802065632_add_field_program_warning_to_user.rb +++ b/db/migrate/20170802065632_add_field_program_warning_to_user.rb @@ -1,4 +1,4 @@ -class AddFieldProgramWarningToUser < ActiveRecord::Migration +class AddFieldProgramWarningToUser < ActiveRecord::Migration[5.2] def change add_column :users, :program_warning, :boolean, default: false end diff --git a/db/migrate/20170802093802_create_form_builder_attachments.rb b/db/migrate/20170802093802_create_form_builder_attachments.rb index 58e6d7d09a..11c8a1a2b6 100644 --- a/db/migrate/20170802093802_create_form_builder_attachments.rb +++ b/db/migrate/20170802093802_create_form_builder_attachments.rb @@ -1,4 +1,4 @@ -class CreateFormBuilderAttachments < ActiveRecord::Migration +class CreateFormBuilderAttachments < ActiveRecord::Migration[5.2] def change create_table :form_builder_attachments do |t| t.string :name, default: '' diff --git a/db/migrate/20170804045709_add_default_field_to_client_enrollment.rb b/db/migrate/20170804045709_add_default_field_to_client_enrollment.rb index 49244134fc..9d194e717a 100644 --- a/db/migrate/20170804045709_add_default_field_to_client_enrollment.rb +++ b/db/migrate/20170804045709_add_default_field_to_client_enrollment.rb @@ -1,4 +1,4 @@ -class AddDefaultFieldToClientEnrollment < ActiveRecord::Migration +class AddDefaultFieldToClientEnrollment < ActiveRecord::Migration[5.2] def up change_column :client_enrollments, :properties, :jsonb, default: {} end diff --git a/db/migrate/20170804045725_add_default_field_to_leave_program.rb b/db/migrate/20170804045725_add_default_field_to_leave_program.rb index ac6977fcf2..32b1d8389d 100644 --- a/db/migrate/20170804045725_add_default_field_to_leave_program.rb +++ b/db/migrate/20170804045725_add_default_field_to_leave_program.rb @@ -1,4 +1,4 @@ -class AddDefaultFieldToLeaveProgram < ActiveRecord::Migration +class AddDefaultFieldToLeaveProgram < ActiveRecord::Migration[5.2] def up change_column :leave_programs, :properties, :jsonb, default: {} end diff --git a/db/migrate/20170804045738_add_default_field_to_client_enrollment_tracking.rb b/db/migrate/20170804045738_add_default_field_to_client_enrollment_tracking.rb index b6aa21a8d5..31caa0fb8e 100644 --- a/db/migrate/20170804045738_add_default_field_to_client_enrollment_tracking.rb +++ b/db/migrate/20170804045738_add_default_field_to_client_enrollment_tracking.rb @@ -1,4 +1,4 @@ -class AddDefaultFieldToClientEnrollmentTracking < ActiveRecord::Migration +class AddDefaultFieldToClientEnrollmentTracking < ActiveRecord::Migration[5.2] def up change_column :client_enrollment_trackings, :properties, :jsonb, default: {} end diff --git a/db/migrate/20170823044532_add_staff_performance_notification_to_user.rb b/db/migrate/20170823044532_add_staff_performance_notification_to_user.rb index 26be3f8497..1597d15acc 100644 --- a/db/migrate/20170823044532_add_staff_performance_notification_to_user.rb +++ b/db/migrate/20170823044532_add_staff_performance_notification_to_user.rb @@ -1,4 +1,4 @@ -class AddStaffPerformanceNotificationToUser < ActiveRecord::Migration +class AddStaffPerformanceNotificationToUser < ActiveRecord::Migration[5.2] def change add_column :users, :staff_performance_notification, :boolean, default: true end diff --git a/db/migrate/20170824021544_create_visit_client.rb b/db/migrate/20170824021544_create_visit_client.rb index 51b3cc7949..7bc0f9c9b3 100644 --- a/db/migrate/20170824021544_create_visit_client.rb +++ b/db/migrate/20170824021544_create_visit_client.rb @@ -1,4 +1,4 @@ -class CreateVisitClient < ActiveRecord::Migration +class CreateVisitClient < ActiveRecord::Migration[5.2] def change create_table :visit_clients do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20170913025014_add_field_interaction_type_to_case_note.rb b/db/migrate/20170913025014_add_field_interaction_type_to_case_note.rb index 2c0641f796..f6c46f06ec 100644 --- a/db/migrate/20170913025014_add_field_interaction_type_to_case_note.rb +++ b/db/migrate/20170913025014_add_field_interaction_type_to_case_note.rb @@ -1,4 +1,4 @@ -class AddFieldInteractionTypeToCaseNote < ActiveRecord::Migration +class AddFieldInteractionTypeToCaseNote < ActiveRecord::Migration[5.2] def change add_column :case_notes, :interaction_type, :string, default: '' end diff --git a/db/migrate/20170926021212_remove_default_value_id_poor_and_grade_in_client.rb b/db/migrate/20170926021212_remove_default_value_id_poor_and_grade_in_client.rb index 1c20ea6b4a..dbe4409028 100644 --- a/db/migrate/20170926021212_remove_default_value_id_poor_and_grade_in_client.rb +++ b/db/migrate/20170926021212_remove_default_value_id_poor_and_grade_in_client.rb @@ -1,4 +1,4 @@ -class RemoveDefaultValueIdPoorAndGradeInClient < ActiveRecord::Migration +class RemoveDefaultValueIdPoorAndGradeInClient < ActiveRecord::Migration[5.2] def up change_column_default :clients, :id_poor, nil change_column_default :clients, :grade, nil diff --git a/db/migrate/20170927071506_add_clients_field_to_family.rb b/db/migrate/20170927071506_add_clients_field_to_family.rb index 31dd138da1..3d5ef66088 100644 --- a/db/migrate/20170927071506_add_clients_field_to_family.rb +++ b/db/migrate/20170927071506_add_clients_field_to_family.rb @@ -1,4 +1,4 @@ -class AddClientsFieldToFamily < ActiveRecord::Migration +class AddClientsFieldToFamily < ActiveRecord::Migration[5.2] def up add_column :families, :children, :integer, array: true, default: [] # Ignore scope, because this migration added before deleted_at field added diff --git a/db/migrate/20170927092118_create_advanced_searches.rb b/db/migrate/20170927092118_create_advanced_searches.rb index 689f683784..dc97aec85b 100644 --- a/db/migrate/20170927092118_create_advanced_searches.rb +++ b/db/migrate/20170927092118_create_advanced_searches.rb @@ -1,4 +1,4 @@ -class CreateAdvancedSearches < ActiveRecord::Migration +class CreateAdvancedSearches < ActiveRecord::Migration[5.2] def change create_table :advanced_searches do |t| t.string :name diff --git a/db/migrate/20171001033957_create_interviewee.rb b/db/migrate/20171001033957_create_interviewee.rb index d19307d8b4..791e4aa992 100644 --- a/db/migrate/20171001033957_create_interviewee.rb +++ b/db/migrate/20171001033957_create_interviewee.rb @@ -1,4 +1,4 @@ -class CreateInterviewee < ActiveRecord::Migration +class CreateInterviewee < ActiveRecord::Migration[5.2] def change create_table :interviewees do |t| t.string :name, default: '' diff --git a/db/migrate/20171001034252_create_client_interviewee.rb b/db/migrate/20171001034252_create_client_interviewee.rb index e725df3a4b..56df30f3a5 100644 --- a/db/migrate/20171001034252_create_client_interviewee.rb +++ b/db/migrate/20171001034252_create_client_interviewee.rb @@ -1,4 +1,4 @@ -class CreateClientInterviewee < ActiveRecord::Migration +class CreateClientInterviewee < ActiveRecord::Migration[5.2] def change create_table :client_interviewees do |t| t.references :client, index: true, foreign_key: true diff --git a/db/migrate/20171001034328_create_client_type.rb b/db/migrate/20171001034328_create_client_type.rb index 6b16714f59..5d496e8e1f 100644 --- a/db/migrate/20171001034328_create_client_type.rb +++ b/db/migrate/20171001034328_create_client_type.rb @@ -1,4 +1,4 @@ -class CreateClientType < ActiveRecord::Migration +class CreateClientType < ActiveRecord::Migration[5.2] def change create_table :client_types do |t| t.string :name, default: '' diff --git a/db/migrate/20171001034536_create_client_client_type.rb b/db/migrate/20171001034536_create_client_client_type.rb index 0b8cb536fd..e2b5b01374 100644 --- a/db/migrate/20171001034536_create_client_client_type.rb +++ b/db/migrate/20171001034536_create_client_client_type.rb @@ -1,4 +1,4 @@ -class CreateClientClientType < ActiveRecord::Migration +class CreateClientClientType < ActiveRecord::Migration[5.2] def change create_table :client_client_types do |t| t.references :client, index: true, foreign_key: true diff --git a/db/migrate/20171001034640_create_need.rb b/db/migrate/20171001034640_create_need.rb index 85f21ad461..d3d8b7c26c 100644 --- a/db/migrate/20171001034640_create_need.rb +++ b/db/migrate/20171001034640_create_need.rb @@ -1,4 +1,4 @@ -class CreateNeed < ActiveRecord::Migration +class CreateNeed < ActiveRecord::Migration[5.2] def change create_table :needs do |t| t.string :name, default: '' diff --git a/db/migrate/20171001034708_create_client_need.rb b/db/migrate/20171001034708_create_client_need.rb index 4757b097fd..e972b40628 100644 --- a/db/migrate/20171001034708_create_client_need.rb +++ b/db/migrate/20171001034708_create_client_need.rb @@ -1,4 +1,4 @@ -class CreateClientNeed < ActiveRecord::Migration +class CreateClientNeed < ActiveRecord::Migration[5.2] def change create_table :client_needs do |t| t.integer :rank diff --git a/db/migrate/20171001034726_create_problem.rb b/db/migrate/20171001034726_create_problem.rb index c181c7c5b1..cb8cb816ba 100644 --- a/db/migrate/20171001034726_create_problem.rb +++ b/db/migrate/20171001034726_create_problem.rb @@ -1,4 +1,4 @@ -class CreateProblem < ActiveRecord::Migration +class CreateProblem < ActiveRecord::Migration[5.2] def change create_table :problems do |t| t.string :name, default: '' diff --git a/db/migrate/20171001034756_create_client_problem.rb b/db/migrate/20171001034756_create_client_problem.rb index 22e31166bc..0615c18843 100644 --- a/db/migrate/20171001034756_create_client_problem.rb +++ b/db/migrate/20171001034756_create_client_problem.rb @@ -1,4 +1,4 @@ -class CreateClientProblem < ActiveRecord::Migration +class CreateClientProblem < ActiveRecord::Migration[5.2] def change create_table :client_problems do |t| t.integer :rank diff --git a/db/migrate/20171002022338_add_government_fields_to_client.rb b/db/migrate/20171002022338_add_government_fields_to_client.rb index 0c4133bacb..fc03d403ce 100644 --- a/db/migrate/20171002022338_add_government_fields_to_client.rb +++ b/db/migrate/20171002022338_add_government_fields_to_client.rb @@ -1,4 +1,4 @@ -class AddGovernmentFieldsToClient < ActiveRecord::Migration +class AddGovernmentFieldsToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :gov_city, :string, default: '' add_column :clients, :gov_commune, :string, default: '' diff --git a/db/migrate/20171009024810_create_permissions.rb b/db/migrate/20171009024810_create_permissions.rb index d14b81b2aa..8945809502 100644 --- a/db/migrate/20171009024810_create_permissions.rb +++ b/db/migrate/20171009024810_create_permissions.rb @@ -1,4 +1,4 @@ -class CreatePermissions < ActiveRecord::Migration +class CreatePermissions < ActiveRecord::Migration[5.2] def change create_table :permissions do |t| t.belongs_to :user, index: true diff --git a/db/migrate/20171009034120_add_user_id_to_advanced_search.rb b/db/migrate/20171009034120_add_user_id_to_advanced_search.rb index d987ab75f0..61e4d1d8be 100644 --- a/db/migrate/20171009034120_add_user_id_to_advanced_search.rb +++ b/db/migrate/20171009034120_add_user_id_to_advanced_search.rb @@ -1,4 +1,4 @@ -class AddUserIdToAdvancedSearch < ActiveRecord::Migration +class AddUserIdToAdvancedSearch < ActiveRecord::Migration[5.2] def change add_reference :advanced_searches, :user, index: true, foreign_key: true end diff --git a/db/migrate/20171009083951_create_custom_field_permissions.rb b/db/migrate/20171009083951_create_custom_field_permissions.rb index c7fd5bd0df..b3a65ab825 100644 --- a/db/migrate/20171009083951_create_custom_field_permissions.rb +++ b/db/migrate/20171009083951_create_custom_field_permissions.rb @@ -1,4 +1,4 @@ -class CreateCustomFieldPermissions < ActiveRecord::Migration +class CreateCustomFieldPermissions < ActiveRecord::Migration[5.2] def change create_table :custom_field_permissions do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20171011040334_create_program_stream_permissions.rb b/db/migrate/20171011040334_create_program_stream_permissions.rb index c36645946f..6327beb001 100644 --- a/db/migrate/20171011040334_create_program_stream_permissions.rb +++ b/db/migrate/20171011040334_create_program_stream_permissions.rb @@ -1,4 +1,4 @@ -class CreateProgramStreamPermissions < ActiveRecord::Migration +class CreateProgramStreamPermissions < ActiveRecord::Migration[5.2] def change create_table :program_stream_permissions do |t| t.references :user, index: true, foreign_key: true @@ -9,4 +9,4 @@ def change t.timestamps null: false end end -end \ No newline at end of file +end diff --git a/db/migrate/20171023093833_change_permission_defalut_values.rb b/db/migrate/20171023093833_change_permission_defalut_values.rb index fc93589d3d..e1dcb6772a 100644 --- a/db/migrate/20171023093833_change_permission_defalut_values.rb +++ b/db/migrate/20171023093833_change_permission_defalut_values.rb @@ -1,4 +1,4 @@ -class ChangePermissionDefalutValues < ActiveRecord::Migration +class ChangePermissionDefalutValues < ActiveRecord::Migration[5.2] def change change_column_default :permissions, :case_notes_readable, true change_column_default :permissions, :case_notes_editable, true diff --git a/db/migrate/20171109080435_add_pin_code_to_user.rb b/db/migrate/20171109080435_add_pin_code_to_user.rb index 71d838ccff..ed335f6e82 100644 --- a/db/migrate/20171109080435_add_pin_code_to_user.rb +++ b/db/migrate/20171109080435_add_pin_code_to_user.rb @@ -1,4 +1,4 @@ -class AddPinCodeToUser < ActiveRecord::Migration +class AddPinCodeToUser < ActiveRecord::Migration[5.2] def up add_column :users, :pin_code, :string, default: '' diff --git a/db/migrate/20171123041647_move_grade_to_school_grade.rb b/db/migrate/20171123041647_move_grade_to_school_grade.rb index d2637b4f96..ba779f506e 100644 --- a/db/migrate/20171123041647_move_grade_to_school_grade.rb +++ b/db/migrate/20171123041647_move_grade_to_school_grade.rb @@ -1,4 +1,4 @@ -class MoveGradeToSchoolGrade < ActiveRecord::Migration +class MoveGradeToSchoolGrade < ActiveRecord::Migration[5.2] def up Client.all.each do |c| school_grade = c.grade.nil? ? '' : c.grade diff --git a/db/migrate/20171124030426_add_field_domain_warning_to_user.rb b/db/migrate/20171124030426_add_field_domain_warning_to_user.rb index 8f4d47531e..6362d66d1e 100644 --- a/db/migrate/20171124030426_add_field_domain_warning_to_user.rb +++ b/db/migrate/20171124030426_add_field_domain_warning_to_user.rb @@ -1,4 +1,4 @@ -class AddFieldDomainWarningToUser < ActiveRecord::Migration +class AddFieldDomainWarningToUser < ActiveRecord::Migration[5.2] def change add_column :users, :domain_warning, :boolean, default: false end diff --git a/db/migrate/20180104030119_create_district.rb b/db/migrate/20180104030119_create_district.rb index 6345aaf097..337be69234 100644 --- a/db/migrate/20180104030119_create_district.rb +++ b/db/migrate/20180104030119_create_district.rb @@ -1,4 +1,4 @@ -class CreateDistrict < ActiveRecord::Migration +class CreateDistrict < ActiveRecord::Migration[5.2] def change create_table :districts do |t| t.string :name diff --git a/db/migrate/20180105044017_add_district_id_to_client.rb b/db/migrate/20180105044017_add_district_id_to_client.rb index a754404ab9..f85e41f0dd 100644 --- a/db/migrate/20180105044017_add_district_id_to_client.rb +++ b/db/migrate/20180105044017_add_district_id_to_client.rb @@ -1,4 +1,4 @@ -class AddDistrictIdToClient < ActiveRecord::Migration +class AddDistrictIdToClient < ActiveRecord::Migration[5.2] def change add_reference :clients, :district, index: true, foreign_key: true end diff --git a/db/migrate/20180108021555_change_field_district_to_archive_district_to_client.rb b/db/migrate/20180108021555_change_field_district_to_archive_district_to_client.rb index a242511fa6..199b0faeb5 100644 --- a/db/migrate/20180108021555_change_field_district_to_archive_district_to_client.rb +++ b/db/migrate/20180108021555_change_field_district_to_archive_district_to_client.rb @@ -1,4 +1,4 @@ -class ChangeFieldDistrictToArchiveDistrictToClient < ActiveRecord::Migration +class ChangeFieldDistrictToArchiveDistrictToClient < ActiveRecord::Migration[5.2] def change rename_column :clients, :district, :archive_district end diff --git a/db/migrate/20180116031324_add_field_telephone_number_to_client.rb b/db/migrate/20180116031324_add_field_telephone_number_to_client.rb index 4954df6f96..52da076e85 100644 --- a/db/migrate/20180116031324_add_field_telephone_number_to_client.rb +++ b/db/migrate/20180116031324_add_field_telephone_number_to_client.rb @@ -1,4 +1,4 @@ -class AddFieldTelephoneNumberToClient < ActiveRecord::Migration +class AddFieldTelephoneNumberToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :telephone_number, :string, default: '' end diff --git a/db/migrate/20180306034903_add_multi_step_form_fields_to_client.rb b/db/migrate/20180306034903_add_multi_step_form_fields_to_client.rb index c20f1f1bc1..7665db756b 100644 --- a/db/migrate/20180306034903_add_multi_step_form_fields_to_client.rb +++ b/db/migrate/20180306034903_add_multi_step_form_fields_to_client.rb @@ -1,4 +1,4 @@ -class AddMultiStepFormFieldsToClient < ActiveRecord::Migration +class AddMultiStepFormFieldsToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :name_of_referee, :string, default: '' add_column :clients, :main_school_contact, :string, default: '' diff --git a/db/migrate/20180314085911_add_fields_for_exit_ngo_to_client.rb b/db/migrate/20180314085911_add_fields_for_exit_ngo_to_client.rb index 5cdd007066..e78dc67381 100644 --- a/db/migrate/20180314085911_add_fields_for_exit_ngo_to_client.rb +++ b/db/migrate/20180314085911_add_fields_for_exit_ngo_to_client.rb @@ -1,4 +1,4 @@ -class AddFieldsForExitNgoToClient < ActiveRecord::Migration +class AddFieldsForExitNgoToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :exit_reasons, :string, array: true, default: [] add_column :clients, :exit_circumstance, :string, default: '' diff --git a/db/migrate/20180402022052_create_setting.rb b/db/migrate/20180402022052_create_setting.rb index 365dcc226a..9e1c52b6df 100644 --- a/db/migrate/20180402022052_create_setting.rb +++ b/db/migrate/20180402022052_create_setting.rb @@ -1,4 +1,4 @@ -class CreateSetting < ActiveRecord::Migration +class CreateSetting < ActiveRecord::Migration[5.2] def change create_table :settings do |t| t.string :assessment_frequency diff --git a/db/migrate/20180403085536_create_enter_ngo.rb b/db/migrate/20180403085536_create_enter_ngo.rb index 22a181bfe5..ecbb2c36e2 100644 --- a/db/migrate/20180403085536_create_enter_ngo.rb +++ b/db/migrate/20180403085536_create_enter_ngo.rb @@ -1,4 +1,4 @@ -class CreateEnterNgo < ActiveRecord::Migration +class CreateEnterNgo < ActiveRecord::Migration[5.2] def change create_table :enter_ngos do |t| t.date :accepted_date diff --git a/db/migrate/20180403085748_create_exit_ngo.rb b/db/migrate/20180403085748_create_exit_ngo.rb index f6dfdcf3bf..be054b3b50 100644 --- a/db/migrate/20180403085748_create_exit_ngo.rb +++ b/db/migrate/20180403085748_create_exit_ngo.rb @@ -1,4 +1,4 @@ -class CreateExitNgo < ActiveRecord::Migration +class CreateExitNgo < ActiveRecord::Migration[5.2] def change create_table :exit_ngos do |t| t.references :client, index: true, foreign_key: true diff --git a/db/migrate/20180406024720_create_enter_ngo_user.rb b/db/migrate/20180406024720_create_enter_ngo_user.rb index 467e69908e..485fcbe21c 100644 --- a/db/migrate/20180406024720_create_enter_ngo_user.rb +++ b/db/migrate/20180406024720_create_enter_ngo_user.rb @@ -1,4 +1,4 @@ -class CreateEnterNgoUser < ActiveRecord::Migration +class CreateEnterNgoUser < ActiveRecord::Migration[5.2] def change create_table :enter_ngo_users do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20180419021522_add_international_fields_to_client.rb b/db/migrate/20180419021522_add_international_fields_to_client.rb index 64f887b569..c8e7d6e5d9 100644 --- a/db/migrate/20180419021522_add_international_fields_to_client.rb +++ b/db/migrate/20180419021522_add_international_fields_to_client.rb @@ -1,4 +1,4 @@ -class AddInternationalFieldsToClient < ActiveRecord::Migration +class AddInternationalFieldsToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :suburb, :string, default: '' add_column :clients, :description_house_landmark, :string, default: '' diff --git a/db/migrate/20180419023155_create_states.rb b/db/migrate/20180419023155_create_states.rb index dc1e838ffb..b976e67f7e 100644 --- a/db/migrate/20180419023155_create_states.rb +++ b/db/migrate/20180419023155_create_states.rb @@ -1,4 +1,4 @@ -class CreateStates < ActiveRecord::Migration +class CreateStates < ActiveRecord::Migration[5.2] def change create_table :states do |t| t.string :name diff --git a/db/migrate/20180419023435_create_townships.rb b/db/migrate/20180419023435_create_townships.rb index 2202e5566f..800c962400 100644 --- a/db/migrate/20180419023435_create_townships.rb +++ b/db/migrate/20180419023435_create_townships.rb @@ -1,4 +1,4 @@ -class CreateTownships < ActiveRecord::Migration +class CreateTownships < ActiveRecord::Migration[5.2] def change create_table :townships do |t| t.string :name diff --git a/db/migrate/20180419025035_create_subdistricts.rb b/db/migrate/20180419025035_create_subdistricts.rb index f9087a4a4c..9d4e599e6c 100644 --- a/db/migrate/20180419025035_create_subdistricts.rb +++ b/db/migrate/20180419025035_create_subdistricts.rb @@ -1,4 +1,4 @@ -class CreateSubdistricts < ActiveRecord::Migration +class CreateSubdistricts < ActiveRecord::Migration[5.2] def change create_table :subdistricts do |t| t.string :name diff --git a/db/migrate/20180419030338_add_internatinal_adress_references_to_client.rb b/db/migrate/20180419030338_add_internatinal_adress_references_to_client.rb index 9c4e1ec11b..0e06d47501 100644 --- a/db/migrate/20180419030338_add_internatinal_adress_references_to_client.rb +++ b/db/migrate/20180419030338_add_internatinal_adress_references_to_client.rb @@ -1,4 +1,4 @@ -class AddInternatinalAdressReferencesToClient < ActiveRecord::Migration +class AddInternatinalAdressReferencesToClient < ActiveRecord::Migration[5.2] def change add_reference :clients, :subdistrict, index: true, foreign_key: true add_reference :clients, :township, index: true, foreign_key: true diff --git a/db/migrate/20180419045448_change_field_state_to_archive_state_to_client.rb b/db/migrate/20180419045448_change_field_state_to_archive_state_to_client.rb index 226b9e78a6..04599763d4 100644 --- a/db/migrate/20180419045448_change_field_state_to_archive_state_to_client.rb +++ b/db/migrate/20180419045448_change_field_state_to_archive_state_to_client.rb @@ -1,4 +1,4 @@ -class ChangeFieldStateToArchiveStateToClient < ActiveRecord::Migration +class ChangeFieldStateToArchiveStateToClient < ActiveRecord::Migration[5.2] def change rename_column :clients, :state, :archive_state end diff --git a/db/migrate/20180423014515_add_user_to_custom_field_properties.rb b/db/migrate/20180423014515_add_user_to_custom_field_properties.rb index 693a13aa92..26bfc89ccd 100644 --- a/db/migrate/20180423014515_add_user_to_custom_field_properties.rb +++ b/db/migrate/20180423014515_add_user_to_custom_field_properties.rb @@ -1,4 +1,4 @@ -class AddUserToCustomFieldProperties < ActiveRecord::Migration +class AddUserToCustomFieldProperties < ActiveRecord::Migration[5.2] def change add_column :custom_field_properties, :user_id, :integer end diff --git a/db/migrate/20180427035634_create_quantitative_type_permissions.rb b/db/migrate/20180427035634_create_quantitative_type_permissions.rb index 9bef239705..3169bd36fc 100644 --- a/db/migrate/20180427035634_create_quantitative_type_permissions.rb +++ b/db/migrate/20180427035634_create_quantitative_type_permissions.rb @@ -1,4 +1,4 @@ -class CreateQuantitativeTypePermissions < ActiveRecord::Migration +class CreateQuantitativeTypePermissions < ActiveRecord::Migration[5.2] def change create_table :quantitative_type_permissions do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20180506040228_add_timestamps_to_setting.rb b/db/migrate/20180506040228_add_timestamps_to_setting.rb index 492bfc26d5..477d54330a 100644 --- a/db/migrate/20180506040228_add_timestamps_to_setting.rb +++ b/db/migrate/20180506040228_add_timestamps_to_setting.rb @@ -1,4 +1,4 @@ -class AddTimestampsToSetting < ActiveRecord::Migration +class AddTimestampsToSetting < ActiveRecord::Migration[5.2] def change add_timestamps :settings, null: true end diff --git a/db/migrate/20180507051617_rename_organization_type_to_archive_organization_type.rb b/db/migrate/20180507051617_rename_organization_type_to_archive_organization_type.rb index 3654a0d66f..a4e4dca3f9 100644 --- a/db/migrate/20180507051617_rename_organization_type_to_archive_organization_type.rb +++ b/db/migrate/20180507051617_rename_organization_type_to_archive_organization_type.rb @@ -1,4 +1,4 @@ -class RenameOrganizationTypeToArchiveOrganizationType < ActiveRecord::Migration +class RenameOrganizationTypeToArchiveOrganizationType < ActiveRecord::Migration[5.2] def change rename_column :partners, :organisation_type, :archive_organization_type end diff --git a/db/migrate/20180507051755_create_organization_types.rb b/db/migrate/20180507051755_create_organization_types.rb index 1de4bd8ba1..ee7b721a16 100644 --- a/db/migrate/20180507051755_create_organization_types.rb +++ b/db/migrate/20180507051755_create_organization_types.rb @@ -1,4 +1,4 @@ -class CreateOrganizationTypes < ActiveRecord::Migration +class CreateOrganizationTypes < ActiveRecord::Migration[5.2] def change create_table :organization_types do |t| t.string :name diff --git a/db/migrate/20180507051830_add_organization_type_ref_to_partners.rb b/db/migrate/20180507051830_add_organization_type_ref_to_partners.rb index 348da628fb..db7946457e 100644 --- a/db/migrate/20180507051830_add_organization_type_ref_to_partners.rb +++ b/db/migrate/20180507051830_add_organization_type_ref_to_partners.rb @@ -1,4 +1,4 @@ -class AddOrganizationTypeRefToPartners < ActiveRecord::Migration +class AddOrganizationTypeRefToPartners < ActiveRecord::Migration[5.2] def change add_reference :partners, :organization_type, index: true, foreign_key: true end diff --git a/db/migrate/20180524024004_create_referrals.rb b/db/migrate/20180524024004_create_referrals.rb index 01da227617..20e61a4791 100644 --- a/db/migrate/20180524024004_create_referrals.rb +++ b/db/migrate/20180524024004_create_referrals.rb @@ -1,4 +1,4 @@ -class CreateReferrals < ActiveRecord::Migration +class CreateReferrals < ActiveRecord::Migration[5.2] def change create_table :referrals do |t| t.string :slug, default: '' diff --git a/db/migrate/20180524044456_create_shared_clients.rb b/db/migrate/20180524044456_create_shared_clients.rb index c11200683e..a611a83ed5 100644 --- a/db/migrate/20180524044456_create_shared_clients.rb +++ b/db/migrate/20180524044456_create_shared_clients.rb @@ -1,4 +1,4 @@ -class CreateSharedClients < ActiveRecord::Migration +class CreateSharedClients < ActiveRecord::Migration[5.2] def change create_table :shared_clients do |t| t.string :slug, default: '' diff --git a/db/migrate/20180530032127_add_country_to_provinces.rb b/db/migrate/20180530032127_add_country_to_provinces.rb index c6aa6b8ec8..e78cec9a01 100644 --- a/db/migrate/20180530032127_add_country_to_provinces.rb +++ b/db/migrate/20180530032127_add_country_to_provinces.rb @@ -1,4 +1,4 @@ -class AddCountryToProvinces < ActiveRecord::Migration +class AddCountryToProvinces < ActiveRecord::Migration[5.2] def change add_column :provinces, :country, :string end diff --git a/db/migrate/20180530084737_change_default_column_clients.rb b/db/migrate/20180530084737_change_default_column_clients.rb index 6c96e9b212..cf65df3ebf 100644 --- a/db/migrate/20180530084737_change_default_column_clients.rb +++ b/db/migrate/20180530084737_change_default_column_clients.rb @@ -1,4 +1,4 @@ -class ChangeDefaultColumnClients < ActiveRecord::Migration +class ChangeDefaultColumnClients < ActiveRecord::Migration[5.2] def up change_column_default :clients, :gender, '' end diff --git a/db/migrate/20180531024852_add_field_referral_notification_to_user.rb b/db/migrate/20180531024852_add_field_referral_notification_to_user.rb index e0e054fc5d..a864ec4c68 100644 --- a/db/migrate/20180531024852_add_field_referral_notification_to_user.rb +++ b/db/migrate/20180531024852_add_field_referral_notification_to_user.rb @@ -1,4 +1,4 @@ -class AddFieldReferralNotificationToUser < ActiveRecord::Migration +class AddFieldReferralNotificationToUser < ActiveRecord::Migration[5.2] def up add_column :users, :referral_notification, :boolean, default: false User.admins.update_all(referral_notification: true) diff --git a/db/migrate/20180612073433_add_country_origin_to_client.rb b/db/migrate/20180612073433_add_country_origin_to_client.rb index 2c4300d57d..fce136e1fd 100644 --- a/db/migrate/20180612073433_add_country_origin_to_client.rb +++ b/db/migrate/20180612073433_add_country_origin_to_client.rb @@ -1,4 +1,4 @@ -class AddCountryOriginToClient < ActiveRecord::Migration +class AddCountryOriginToClient < ActiveRecord::Migration[5.2] def up add_column :clients, :country_origin, :string, default: '' add_column :shared_clients, :country_origin, :string, default: '' diff --git a/db/migrate/20180620023347_change_consent_form_column_type.rb b/db/migrate/20180620023347_change_consent_form_column_type.rb index c97afcf5f0..dfbe130eaa 100644 --- a/db/migrate/20180620023347_change_consent_form_column_type.rb +++ b/db/migrate/20180620023347_change_consent_form_column_type.rb @@ -1,4 +1,4 @@ -class ChangeConsentFormColumnType < ActiveRecord::Migration +class ChangeConsentFormColumnType < ActiveRecord::Migration[5.2] def up change_column :referrals, :consent_form, :string, array: true, default: [], using: "(string_to_array(consent_form, ','))" end diff --git a/db/migrate/20180622081906_add_status_to_family.rb b/db/migrate/20180622081906_add_status_to_family.rb index 6b1146306c..e9a8234f63 100644 --- a/db/migrate/20180622081906_add_status_to_family.rb +++ b/db/migrate/20180622081906_add_status_to_family.rb @@ -1,4 +1,4 @@ -class AddStatusToFamily < ActiveRecord::Migration +class AddStatusToFamily < ActiveRecord::Migration[5.2] def change add_column :families, :status, :string, default: '' end diff --git a/db/migrate/20180703094930_create_government_form.rb b/db/migrate/20180703094930_create_government_form.rb index c388f3bec1..f19a99228d 100644 --- a/db/migrate/20180703094930_create_government_form.rb +++ b/db/migrate/20180703094930_create_government_form.rb @@ -1,4 +1,4 @@ -class CreateGovernmentForm < ActiveRecord::Migration +class CreateGovernmentForm < ActiveRecord::Migration[5.2] def change create_table :government_forms do |t| t.string :name, default: '' diff --git a/db/migrate/20180704070205_add_columns_to_families.rb b/db/migrate/20180704070205_add_columns_to_families.rb index 8d5dd62e8b..90ee95504b 100644 --- a/db/migrate/20180704070205_add_columns_to_families.rb +++ b/db/migrate/20180704070205_add_columns_to_families.rb @@ -1,4 +1,4 @@ -class AddColumnsToFamilies < ActiveRecord::Migration +class AddColumnsToFamilies < ActiveRecord::Migration[5.2] def change add_reference :families, :district, index: true, foreign_key: true add_column :families, :commune, :string, default: '' diff --git a/db/migrate/20180705082629_add_fields_to_setting.rb b/db/migrate/20180705082629_add_fields_to_setting.rb index 57f095c014..78c687c396 100644 --- a/db/migrate/20180705082629_add_fields_to_setting.rb +++ b/db/migrate/20180705082629_add_fields_to_setting.rb @@ -1,4 +1,4 @@ -class AddFieldsToSetting < ActiveRecord::Migration +class AddFieldsToSetting < ActiveRecord::Migration[5.2] def change add_column :settings, :org_name, :string, default: '' add_column :settings, :org_commune, :string, default: '' diff --git a/db/migrate/20180705093607_create_government_form_interviewee.rb b/db/migrate/20180705093607_create_government_form_interviewee.rb index 11b7cd7a5e..e13b11d56d 100644 --- a/db/migrate/20180705093607_create_government_form_interviewee.rb +++ b/db/migrate/20180705093607_create_government_form_interviewee.rb @@ -1,4 +1,4 @@ -class CreateGovernmentFormInterviewee < ActiveRecord::Migration +class CreateGovernmentFormInterviewee < ActiveRecord::Migration[5.2] def change create_table :government_form_interviewees do |t| t.references :government_form, index: true, foreign_key: true diff --git a/db/migrate/20180706083651_create_client_type_government_form.rb b/db/migrate/20180706083651_create_client_type_government_form.rb index 50450f1247..eddb7abcbc 100644 --- a/db/migrate/20180706083651_create_client_type_government_form.rb +++ b/db/migrate/20180706083651_create_client_type_government_form.rb @@ -1,4 +1,4 @@ -class CreateClientTypeGovernmentForm < ActiveRecord::Migration +class CreateClientTypeGovernmentForm < ActiveRecord::Migration[5.2] def change create_table :client_type_government_forms do |t| t.references :client_type, index: true, foreign_key: true diff --git a/db/migrate/20180706085914_create_government_form_need.rb b/db/migrate/20180706085914_create_government_form_need.rb index aede3174c6..4e514abfca 100644 --- a/db/migrate/20180706085914_create_government_form_need.rb +++ b/db/migrate/20180706085914_create_government_form_need.rb @@ -1,4 +1,4 @@ -class CreateGovernmentFormNeed < ActiveRecord::Migration +class CreateGovernmentFormNeed < ActiveRecord::Migration[5.2] def change create_table :government_form_needs do |t| t.integer :rank diff --git a/db/migrate/20180706092421_create_government_form_problem.rb b/db/migrate/20180706092421_create_government_form_problem.rb index 52bf5106d4..af896c744e 100644 --- a/db/migrate/20180706092421_create_government_form_problem.rb +++ b/db/migrate/20180706092421_create_government_form_problem.rb @@ -1,4 +1,4 @@ -class CreateGovernmentFormProblem < ActiveRecord::Migration +class CreateGovernmentFormProblem < ActiveRecord::Migration[5.2] def change create_table :government_form_problems do |t| t.integer :rank diff --git a/db/migrate/20180709021636_create_family_members.rb b/db/migrate/20180709021636_create_family_members.rb index 0d58c8b2ad..86cc50ff61 100644 --- a/db/migrate/20180709021636_create_family_members.rb +++ b/db/migrate/20180709021636_create_family_members.rb @@ -1,4 +1,4 @@ -class CreateFamilyMembers < ActiveRecord::Migration +class CreateFamilyMembers < ActiveRecord::Migration[5.2] def change create_table :family_members do |t| t.string :adult_name, default: '' diff --git a/db/migrate/20180712044911_create_children_plans.rb b/db/migrate/20180712044911_create_children_plans.rb index 7121f76d2a..cb3e5a5c38 100644 --- a/db/migrate/20180712044911_create_children_plans.rb +++ b/db/migrate/20180712044911_create_children_plans.rb @@ -1,4 +1,4 @@ -class CreateChildrenPlans < ActiveRecord::Migration +class CreateChildrenPlans < ActiveRecord::Migration[5.2] def change create_table :children_plans do |t| t.string :name, default: '' diff --git a/db/migrate/20180712045031_create_government_form_children_plans.rb b/db/migrate/20180712045031_create_government_form_children_plans.rb index d99fe45e80..b2d7517954 100644 --- a/db/migrate/20180712045031_create_government_form_children_plans.rb +++ b/db/migrate/20180712045031_create_government_form_children_plans.rb @@ -1,4 +1,4 @@ -class CreateGovernmentFormChildrenPlans < ActiveRecord::Migration +class CreateGovernmentFormChildrenPlans < ActiveRecord::Migration[5.2] def change create_table :government_form_children_plans do |t| t.string :goal, default: '' diff --git a/db/migrate/20180712092852_add_code_and_timestamp_to_district.rb b/db/migrate/20180712092852_add_code_and_timestamp_to_district.rb index 82f185d9a8..6334a18e4b 100644 --- a/db/migrate/20180712092852_add_code_and_timestamp_to_district.rb +++ b/db/migrate/20180712092852_add_code_and_timestamp_to_district.rb @@ -1,4 +1,4 @@ -class AddCodeAndTimestampToDistrict < ActiveRecord::Migration +class AddCodeAndTimestampToDistrict < ActiveRecord::Migration[5.2] def change add_column :districts, :code, :string, default: '' add_timestamps :districts diff --git a/db/migrate/20180713034135_create_family_plans.rb b/db/migrate/20180713034135_create_family_plans.rb index cbf149af1a..8d730e51dc 100644 --- a/db/migrate/20180713034135_create_family_plans.rb +++ b/db/migrate/20180713034135_create_family_plans.rb @@ -1,4 +1,4 @@ -class CreateFamilyPlans < ActiveRecord::Migration +class CreateFamilyPlans < ActiveRecord::Migration[5.2] def change create_table :family_plans do |t| t.string :name, default: '' diff --git a/db/migrate/20180713034226_create_government_form_family_plans.rb b/db/migrate/20180713034226_create_government_form_family_plans.rb index fc4be04879..e6bb88e5cf 100644 --- a/db/migrate/20180713034226_create_government_form_family_plans.rb +++ b/db/migrate/20180713034226_create_government_form_family_plans.rb @@ -1,4 +1,4 @@ -class CreateGovernmentFormFamilyPlans < ActiveRecord::Migration +class CreateGovernmentFormFamilyPlans < ActiveRecord::Migration[5.2] def change create_table :government_form_family_plans do |t| t.string :goal, default: '' diff --git a/db/migrate/20180713102936_create_commune.rb b/db/migrate/20180713102936_create_commune.rb index a670c8c192..d9d93d0b0d 100644 --- a/db/migrate/20180713102936_create_commune.rb +++ b/db/migrate/20180713102936_create_commune.rb @@ -1,4 +1,4 @@ -class CreateCommune < ActiveRecord::Migration +class CreateCommune < ActiveRecord::Migration[5.2] def change create_table :communes do |t| t.string :code, default: '' diff --git a/db/migrate/20180713105414_create_village.rb b/db/migrate/20180713105414_create_village.rb index 02cf440e90..98b954175b 100644 --- a/db/migrate/20180713105414_create_village.rb +++ b/db/migrate/20180713105414_create_village.rb @@ -1,4 +1,4 @@ -class CreateVillage < ActiveRecord::Migration +class CreateVillage < ActiveRecord::Migration[5.2] def change create_table :villages do |t| t.string :code, default: '' diff --git a/db/migrate/20180715022824_add_geography_reference_to_government_form.rb b/db/migrate/20180715022824_add_geography_reference_to_government_form.rb index c3820663dd..109c96d7e0 100644 --- a/db/migrate/20180715022824_add_geography_reference_to_government_form.rb +++ b/db/migrate/20180715022824_add_geography_reference_to_government_form.rb @@ -1,4 +1,4 @@ -class AddGeographyReferenceToGovernmentForm < ActiveRecord::Migration +class AddGeographyReferenceToGovernmentForm < ActiveRecord::Migration[5.2] def change add_reference :government_forms, :province, index: true, foreign_key: true add_reference :government_forms, :district, index: true, foreign_key: true diff --git a/db/migrate/20180717043421_add_fields_to_government_form_children_plan.rb b/db/migrate/20180717043421_add_fields_to_government_form_children_plan.rb index 1a867b4e90..8440dff572 100644 --- a/db/migrate/20180717043421_add_fields_to_government_form_children_plan.rb +++ b/db/migrate/20180717043421_add_fields_to_government_form_children_plan.rb @@ -1,4 +1,4 @@ -class AddFieldsToGovernmentFormChildrenPlan < ActiveRecord::Migration +class AddFieldsToGovernmentFormChildrenPlan < ActiveRecord::Migration[5.2] def change add_column :government_form_children_plans, :score, :integer add_column :government_form_children_plans, :comment, :text, default: '' diff --git a/db/migrate/20180717083951_add_fields_to_government_form_family_plan.rb b/db/migrate/20180717083951_add_fields_to_government_form_family_plan.rb index f45d3fef94..1e51c5f69f 100644 --- a/db/migrate/20180717083951_add_fields_to_government_form_family_plan.rb +++ b/db/migrate/20180717083951_add_fields_to_government_form_family_plan.rb @@ -1,4 +1,4 @@ -class AddFieldsToGovernmentFormFamilyPlan < ActiveRecord::Migration +class AddFieldsToGovernmentFormFamilyPlan < ActiveRecord::Migration[5.2] def change add_column :government_form_family_plans, :score, :integer add_column :government_form_family_plans, :comment, :text, default: '' diff --git a/db/migrate/20180718022910_add_fields_to_government_form.rb b/db/migrate/20180718022910_add_fields_to_government_form.rb index b07dd1e5f1..a9c114686e 100644 --- a/db/migrate/20180718022910_add_fields_to_government_form.rb +++ b/db/migrate/20180718022910_add_fields_to_government_form.rb @@ -1,4 +1,4 @@ -class AddFieldsToGovernmentForm < ActiveRecord::Migration +class AddFieldsToGovernmentForm < ActiveRecord::Migration[5.2] def change add_column :government_forms, :caseworker_assumption, :string, default: '' add_column :government_forms, :assumption_description, :text, default: '' diff --git a/db/migrate/20180718070909_create_service_types.rb b/db/migrate/20180718070909_create_service_types.rb index b45aa9e888..c80961a079 100644 --- a/db/migrate/20180718070909_create_service_types.rb +++ b/db/migrate/20180718070909_create_service_types.rb @@ -1,4 +1,4 @@ -class CreateServiceTypes < ActiveRecord::Migration +class CreateServiceTypes < ActiveRecord::Migration[5.2] def change create_table :service_types do |t| t.string :name, default: '' diff --git a/db/migrate/20180718071017_create_government_form_service_types.rb b/db/migrate/20180718071017_create_government_form_service_types.rb index d85ce7f7f2..e8275d7389 100644 --- a/db/migrate/20180718071017_create_government_form_service_types.rb +++ b/db/migrate/20180718071017_create_government_form_service_types.rb @@ -1,4 +1,4 @@ -class CreateGovernmentFormServiceTypes < ActiveRecord::Migration +class CreateGovernmentFormServiceTypes < ActiveRecord::Migration[5.2] def change create_table :government_form_service_types do |t| t.references :government_form, index: true, foreign_key: true diff --git a/db/migrate/20180718072448_add_gender_field_to_users.rb b/db/migrate/20180718072448_add_gender_field_to_users.rb index be9404ca43..919b012ec3 100644 --- a/db/migrate/20180718072448_add_gender_field_to_users.rb +++ b/db/migrate/20180718072448_add_gender_field_to_users.rb @@ -1,4 +1,4 @@ -class AddGenderFieldToUsers < ActiveRecord::Migration +class AddGenderFieldToUsers < ActiveRecord::Migration[5.2] def change add_column :users, :gender, :string, default: '' end diff --git a/db/migrate/20180718081014_create_client_rights.rb b/db/migrate/20180718081014_create_client_rights.rb index 7cc21ca925..9f0adabf72 100644 --- a/db/migrate/20180718081014_create_client_rights.rb +++ b/db/migrate/20180718081014_create_client_rights.rb @@ -1,4 +1,4 @@ -class CreateClientRights < ActiveRecord::Migration +class CreateClientRights < ActiveRecord::Migration[5.2] def change create_table :client_rights do |t| t.string :name, default: '' diff --git a/db/migrate/20180718081031_create_client_right_government_forms.rb b/db/migrate/20180718081031_create_client_right_government_forms.rb index 1efb37214e..00bd77cfff 100644 --- a/db/migrate/20180718081031_create_client_right_government_forms.rb +++ b/db/migrate/20180718081031_create_client_right_government_forms.rb @@ -1,4 +1,4 @@ -class CreateClientRightGovernmentForms < ActiveRecord::Migration +class CreateClientRightGovernmentForms < ActiveRecord::Migration[5.2] def change create_table :client_right_government_forms do |t| t.references :government_form, index: true, foreign_key: true diff --git a/db/migrate/20180726023440_add_address_fields_to_families.rb b/db/migrate/20180726023440_add_address_fields_to_families.rb index cd0bdc77b8..4e2aa49963 100644 --- a/db/migrate/20180726023440_add_address_fields_to_families.rb +++ b/db/migrate/20180726023440_add_address_fields_to_families.rb @@ -1,4 +1,4 @@ -class AddAddressFieldsToFamilies < ActiveRecord::Migration +class AddAddressFieldsToFamilies < ActiveRecord::Migration[5.2] def change add_column :families, :house, :string, default: '' add_column :families, :street, :string, default: '' diff --git a/db/migrate/20180726095407_rename_field_in_government_form_children_plan.rb b/db/migrate/20180726095407_rename_field_in_government_form_children_plan.rb index 182ab45775..5c877587e1 100644 --- a/db/migrate/20180726095407_rename_field_in_government_form_children_plan.rb +++ b/db/migrate/20180726095407_rename_field_in_government_form_children_plan.rb @@ -1,4 +1,4 @@ -class RenameFieldInGovernmentFormChildrenPlan < ActiveRecord::Migration +class RenameFieldInGovernmentFormChildrenPlan < ActiveRecord::Migration[5.2] def up remove_column :government_form_children_plans, :when add_column :government_form_children_plans, :completion_date, :date diff --git a/db/migrate/20180731014745_change_government_form_fields.rb b/db/migrate/20180731014745_change_government_form_fields.rb index b54bdf082f..0b84f071b5 100644 --- a/db/migrate/20180731014745_change_government_form_fields.rb +++ b/db/migrate/20180731014745_change_government_form_fields.rb @@ -1,4 +1,4 @@ -class ChangeGovernmentFormFields < ActiveRecord::Migration +class ChangeGovernmentFormFields < ActiveRecord::Migration[5.2] def change remove_column :government_forms, :interview_commune, :integer remove_column :government_forms, :interview_village, :integer diff --git a/db/migrate/20180808024324_add_commune_id_village_id_to_client.rb b/db/migrate/20180808024324_add_commune_id_village_id_to_client.rb index 6a32c4f664..01a6b0bb91 100644 --- a/db/migrate/20180808024324_add_commune_id_village_id_to_client.rb +++ b/db/migrate/20180808024324_add_commune_id_village_id_to_client.rb @@ -1,4 +1,4 @@ -class AddCommuneIdVillageIdToClient < ActiveRecord::Migration +class AddCommuneIdVillageIdToClient < ActiveRecord::Migration[5.2] def change add_reference :clients, :commune, index: true, foreign_key: true add_reference :clients, :village, index: true, foreign_key: true diff --git a/db/migrate/20180808033036_add_commune_id_village_id_to_family.rb b/db/migrate/20180808033036_add_commune_id_village_id_to_family.rb index ddc7934616..5f5ca6822a 100644 --- a/db/migrate/20180808033036_add_commune_id_village_id_to_family.rb +++ b/db/migrate/20180808033036_add_commune_id_village_id_to_family.rb @@ -1,4 +1,4 @@ -class AddCommuneIdVillageIdToFamily < ActiveRecord::Migration +class AddCommuneIdVillageIdToFamily < ActiveRecord::Migration[5.2] def change add_reference :families, :commune, index: true, foreign_key: true add_reference :families, :village, index: true, foreign_key: true diff --git a/db/migrate/20180808035053_remove_default_client_fields.rb b/db/migrate/20180808035053_remove_default_client_fields.rb index 5272be19c1..22a68943fc 100644 --- a/db/migrate/20180808035053_remove_default_client_fields.rb +++ b/db/migrate/20180808035053_remove_default_client_fields.rb @@ -1,4 +1,4 @@ -class RemoveDefaultClientFields < ActiveRecord::Migration +class RemoveDefaultClientFields < ActiveRecord::Migration[5.2] def up change_column_default :clients, :has_been_in_orphanage, nil change_column_default :clients, :has_been_in_government_care, nil diff --git a/db/migrate/20180808042845_change_column_name_in_client_family.rb b/db/migrate/20180808042845_change_column_name_in_client_family.rb index 117f4f566a..c7014976a4 100644 --- a/db/migrate/20180808042845_change_column_name_in_client_family.rb +++ b/db/migrate/20180808042845_change_column_name_in_client_family.rb @@ -1,4 +1,4 @@ -class ChangeColumnNameInClientFamily < ActiveRecord::Migration +class ChangeColumnNameInClientFamily < ActiveRecord::Migration[5.2] def up rename_column :clients, :commune, :old_commune rename_column :clients, :village, :old_village diff --git a/db/migrate/20180808075606_add_age_fields_to_settings.rb b/db/migrate/20180808075606_add_age_fields_to_settings.rb index 2c012aba70..d135621c4a 100644 --- a/db/migrate/20180808075606_add_age_fields_to_settings.rb +++ b/db/migrate/20180808075606_add_age_fields_to_settings.rb @@ -1,4 +1,4 @@ -class AddAgeFieldsToSettings < ActiveRecord::Migration +class AddAgeFieldsToSettings < ActiveRecord::Migration[5.2] def change add_column :settings, :age, :integer, default: 18 end diff --git a/db/migrate/20180809022059_add_commune_id_to_setting.rb b/db/migrate/20180809022059_add_commune_id_to_setting.rb index a3a844be55..393874a11c 100644 --- a/db/migrate/20180809022059_add_commune_id_to_setting.rb +++ b/db/migrate/20180809022059_add_commune_id_to_setting.rb @@ -1,4 +1,4 @@ -class AddCommuneIdToSetting < ActiveRecord::Migration +class AddCommuneIdToSetting < ActiveRecord::Migration[5.2] def change add_reference :settings, :commune, index: true, foreign_key: true end diff --git a/db/migrate/20180809083746_add_guardian_to_family_member.rb b/db/migrate/20180809083746_add_guardian_to_family_member.rb index 9816a4c58e..c98de0405b 100644 --- a/db/migrate/20180809083746_add_guardian_to_family_member.rb +++ b/db/migrate/20180809083746_add_guardian_to_family_member.rb @@ -1,4 +1,4 @@ -class AddGuardianToFamilyMember < ActiveRecord::Migration +class AddGuardianToFamilyMember < ActiveRecord::Migration[5.2] def change add_column :family_members, :guardian, :boolean, default: false end diff --git a/db/migrate/20180813030846_create_sponsors.rb b/db/migrate/20180813030846_create_sponsors.rb index be9e770675..7b56468d56 100644 --- a/db/migrate/20180813030846_create_sponsors.rb +++ b/db/migrate/20180813030846_create_sponsors.rb @@ -1,4 +1,4 @@ -class CreateSponsors < ActiveRecord::Migration +class CreateSponsors < ActiveRecord::Migration[5.2] def change create_table :sponsors do |t| t.references :client, index: true, foreign_key: true diff --git a/db/migrate/20180813072219_create_action_results.rb b/db/migrate/20180813072219_create_action_results.rb index 37279b34f5..92acf6c236 100644 --- a/db/migrate/20180813072219_create_action_results.rb +++ b/db/migrate/20180813072219_create_action_results.rb @@ -1,4 +1,4 @@ -class CreateActionResults < ActiveRecord::Migration +class CreateActionResults < ActiveRecord::Migration[5.2] def change create_table :action_results do |t| t.text :action, default: '' diff --git a/db/migrate/20180817042218_add_user_to_family.rb b/db/migrate/20180817042218_add_user_to_family.rb index b7eee11b6a..d7cc166c41 100644 --- a/db/migrate/20180817042218_add_user_to_family.rb +++ b/db/migrate/20180817042218_add_user_to_family.rb @@ -1,4 +1,4 @@ -class AddUserToFamily < ActiveRecord::Migration +class AddUserToFamily < ActiveRecord::Migration[5.2] def change add_reference :families, :user, index: true, foreign_key: true end diff --git a/db/migrate/20180827023718_add_field_relation_to_task.rb b/db/migrate/20180827023718_add_field_relation_to_task.rb index f1072c3747..b547792356 100644 --- a/db/migrate/20180827023718_add_field_relation_to_task.rb +++ b/db/migrate/20180827023718_add_field_relation_to_task.rb @@ -1,4 +1,4 @@ -class AddFieldRelationToTask < ActiveRecord::Migration +class AddFieldRelationToTask < ActiveRecord::Migration[5.2] def change add_column :tasks, :relation, :string, default: '' end diff --git a/db/migrate/20180830063914_add_recent_issues_and_progress_to_government_form.rb b/db/migrate/20180830063914_add_recent_issues_and_progress_to_government_form.rb index 3a236071e6..da40663929 100644 --- a/db/migrate/20180830063914_add_recent_issues_and_progress_to_government_form.rb +++ b/db/migrate/20180830063914_add_recent_issues_and_progress_to_government_form.rb @@ -1,4 +1,4 @@ -class AddRecentIssuesAndProgressToGovernmentForm < ActiveRecord::Migration +class AddRecentIssuesAndProgressToGovernmentForm < ActiveRecord::Migration[5.2] def change add_column :government_forms, :recent_issues_and_progress, :text, default: '' end diff --git a/db/migrate/20180906034129_create_case_closures.rb b/db/migrate/20180906034129_create_case_closures.rb index 0fdf85b037..9c423b87a7 100644 --- a/db/migrate/20180906034129_create_case_closures.rb +++ b/db/migrate/20180906034129_create_case_closures.rb @@ -1,4 +1,4 @@ -class CreateCaseClosures < ActiveRecord::Migration +class CreateCaseClosures < ActiveRecord::Migration[5.2] def change create_table :case_closures do |t| t.string :name diff --git a/db/migrate/20180906040657_add_other_case_closure_fields_to_government_forms.rb b/db/migrate/20180906040657_add_other_case_closure_fields_to_government_forms.rb index 4d91215d45..1517f19630 100644 --- a/db/migrate/20180906040657_add_other_case_closure_fields_to_government_forms.rb +++ b/db/migrate/20180906040657_add_other_case_closure_fields_to_government_forms.rb @@ -1,4 +1,4 @@ -class AddOtherCaseClosureFieldsToGovernmentForms < ActiveRecord::Migration +class AddOtherCaseClosureFieldsToGovernmentForms < ActiveRecord::Migration[5.2] def change add_column :government_forms, :other_case_closure, :string add_column :government_forms, :brief_case_history, :text diff --git a/db/migrate/20180907035927_add_country_to_organization.rb b/db/migrate/20180907035927_add_country_to_organization.rb index 97eca9dc2a..3148641b89 100644 --- a/db/migrate/20180907035927_add_country_to_organization.rb +++ b/db/migrate/20180907035927_add_country_to_organization.rb @@ -1,4 +1,4 @@ -class AddCountryToOrganization < ActiveRecord::Migration +class AddCountryToOrganization < ActiveRecord::Migration[5.2] def change add_column :organizations, :country, :string, default: '' end diff --git a/db/migrate/20180917071148_add_priority_field_to_family_plan.rb b/db/migrate/20180917071148_add_priority_field_to_family_plan.rb index 1daa2e7eb4..2aac50ad74 100644 --- a/db/migrate/20180917071148_add_priority_field_to_family_plan.rb +++ b/db/migrate/20180917071148_add_priority_field_to_family_plan.rb @@ -1,4 +1,4 @@ -class AddPriorityFieldToFamilyPlan < ActiveRecord::Migration +class AddPriorityFieldToFamilyPlan < ActiveRecord::Migration[5.2] def change add_column :family_plans, :priority, :integer end diff --git a/db/migrate/20181019021124_add_profile_to_clients.rb b/db/migrate/20181019021124_add_profile_to_clients.rb index 04146b5b3f..49b1b51e0e 100644 --- a/db/migrate/20181019021124_add_profile_to_clients.rb +++ b/db/migrate/20181019021124_add_profile_to_clients.rb @@ -1,4 +1,4 @@ -class AddProfileToClients < ActiveRecord::Migration +class AddProfileToClients < ActiveRecord::Migration[5.2] def change add_column :clients, :profile, :string end diff --git a/db/migrate/20181023071121_add_status_to_assessments.rb b/db/migrate/20181023071121_add_status_to_assessments.rb index 1863d923f7..9e2ee558ce 100644 --- a/db/migrate/20181023071121_add_status_to_assessments.rb +++ b/db/migrate/20181023071121_add_status_to_assessments.rb @@ -1,4 +1,4 @@ -class AddStatusToAssessments < ActiveRecord::Migration +class AddStatusToAssessments < ActiveRecord::Migration[5.2] def up add_column :assessments, :completed, :boolean, default: false diff --git a/db/migrate/20181030035922_add_definition_to_domain.rb b/db/migrate/20181030035922_add_definition_to_domain.rb index 491a1458e0..398509d013 100644 --- a/db/migrate/20181030035922_add_definition_to_domain.rb +++ b/db/migrate/20181030035922_add_definition_to_domain.rb @@ -1,4 +1,4 @@ -class AddDefinitionToDomain < ActiveRecord::Migration +class AddDefinitionToDomain < ActiveRecord::Migration[5.2] def change add_column :domains, :score_1_definition, :text, default: '' add_column :domains, :score_2_definition, :text, default: '' diff --git a/db/migrate/20181031030528_add_custom_domain_to_domain.rb b/db/migrate/20181031030528_add_custom_domain_to_domain.rb index ca50058171..18383cfae7 100644 --- a/db/migrate/20181031030528_add_custom_domain_to_domain.rb +++ b/db/migrate/20181031030528_add_custom_domain_to_domain.rb @@ -1,4 +1,4 @@ -class AddCustomDomainToDomain < ActiveRecord::Migration +class AddCustomDomainToDomain < ActiveRecord::Migration[5.2] def change add_column :domains, :custom_domain, :boolean, default: false end diff --git a/db/migrate/20181107032153_add_custom_csi_name_to_settings.rb b/db/migrate/20181107032153_add_custom_csi_name_to_settings.rb index cb2545ec64..73513b0d62 100644 --- a/db/migrate/20181107032153_add_custom_csi_name_to_settings.rb +++ b/db/migrate/20181107032153_add_custom_csi_name_to_settings.rb @@ -1,4 +1,4 @@ -class AddCustomCsiNameToSettings < ActiveRecord::Migration +class AddCustomCsiNameToSettings < ActiveRecord::Migration[5.2] def up add_column :settings, :custom_assessment, :string, default: 'Custom Assessment' if !column_exists? :settings, :custom_assessment add_column :settings, :enable_custom_assessment, :boolean, default: false if !column_exists? :settings, :enable_custom_assessment diff --git a/db/migrate/20181112042033_add_default_to_assessment.rb b/db/migrate/20181112042033_add_default_to_assessment.rb index 163daba29f..2ae218cb69 100644 --- a/db/migrate/20181112042033_add_default_to_assessment.rb +++ b/db/migrate/20181112042033_add_default_to_assessment.rb @@ -1,4 +1,4 @@ -class AddDefaultToAssessment < ActiveRecord::Migration +class AddDefaultToAssessment < ActiveRecord::Migration[5.2] def up add_column :assessments, :default, :boolean, default: true Assessment.update_all(default: false) if ['mho', 'fsc', 'tlc'].include?(Organization.current.try(:short_name)) diff --git a/db/migrate/20181112051352_add_fields_to_assessment_domain.rb b/db/migrate/20181112051352_add_fields_to_assessment_domain.rb index 831a961b31..3327991388 100644 --- a/db/migrate/20181112051352_add_fields_to_assessment_domain.rb +++ b/db/migrate/20181112051352_add_fields_to_assessment_domain.rb @@ -1,4 +1,4 @@ -class AddFieldsToAssessmentDomain < ActiveRecord::Migration +class AddFieldsToAssessmentDomain < ActiveRecord::Migration[5.2] def change add_column :assessment_domains, :goal_required, :boolean, default: true add_column :assessment_domains, :required_task_last, :boolean, default: false diff --git a/db/migrate/20181112082013_add_custom_case_note_to_case_note.rb b/db/migrate/20181112082013_add_custom_case_note_to_case_note.rb index f6465c63a2..93981eb22f 100644 --- a/db/migrate/20181112082013_add_custom_case_note_to_case_note.rb +++ b/db/migrate/20181112082013_add_custom_case_note_to_case_note.rb @@ -1,4 +1,4 @@ -class AddCustomCaseNoteToCaseNote < ActiveRecord::Migration +class AddCustomCaseNoteToCaseNote < ActiveRecord::Migration[5.2] def up add_column :case_notes, :custom, :boolean, default: false CaseNote.update_all(custom: true) if ['mho', 'fsc', 'tlc'].include?(Organization.current.try(:short_name)) diff --git a/db/migrate/20181218071502_add_local_fields_to_domain.rb b/db/migrate/20181218071502_add_local_fields_to_domain.rb index 43a75b3348..dc5e856fae 100644 --- a/db/migrate/20181218071502_add_local_fields_to_domain.rb +++ b/db/migrate/20181218071502_add_local_fields_to_domain.rb @@ -1,4 +1,4 @@ -class AddLocalFieldsToDomain < ActiveRecord::Migration +class AddLocalFieldsToDomain < ActiveRecord::Migration[5.2] def change add_column :domains, :local_description, :text, default: '' add_column :domains, :score_1_local_definition, :text, default: '' diff --git a/db/migrate/20190108045307_add_index_to_assessment_domain.rb b/db/migrate/20190108045307_add_index_to_assessment_domain.rb index a00b99810c..7aca292104 100644 --- a/db/migrate/20190108045307_add_index_to_assessment_domain.rb +++ b/db/migrate/20190108045307_add_index_to_assessment_domain.rb @@ -1,4 +1,4 @@ -class AddIndexToAssessmentDomain < ActiveRecord::Migration +class AddIndexToAssessmentDomain < ActiveRecord::Migration[5.2] def change add_index :assessment_domains, :score end diff --git a/db/migrate/20190123075828_add_field_shared_anonymous_to_setting.rb b/db/migrate/20190123075828_add_field_shared_anonymous_to_setting.rb index bbf6f4ad18..5c9f463cc2 100644 --- a/db/migrate/20190123075828_add_field_shared_anonymous_to_setting.rb +++ b/db/migrate/20190123075828_add_field_shared_anonymous_to_setting.rb @@ -1,4 +1,4 @@ -class AddFieldSharedAnonymousToSetting < ActiveRecord::Migration +class AddFieldSharedAnonymousToSetting < ActiveRecord::Migration[5.2] def change add_column :settings, :sharing_data, :boolean, default: false if !column_exists? :settings, :sharing_data end diff --git a/db/migrate/20190130040342_add_enable_gov_log_in_and_enable_research_log_in_to_user.rb b/db/migrate/20190130040342_add_enable_gov_log_in_and_enable_research_log_in_to_user.rb index d642232ea8..97589c4aaf 100644 --- a/db/migrate/20190130040342_add_enable_gov_log_in_and_enable_research_log_in_to_user.rb +++ b/db/migrate/20190130040342_add_enable_gov_log_in_and_enable_research_log_in_to_user.rb @@ -1,4 +1,4 @@ -class AddEnableGovLogInAndEnableResearchLogInToUser < ActiveRecord::Migration +class AddEnableGovLogInAndEnableResearchLogInToUser < ActiveRecord::Migration[5.2] def change add_column :users, :enable_gov_log_in, :boolean, default: false add_column :users, :enable_research_log_in, :boolean, default: false diff --git a/db/migrate/20190227084038_add_archived_at_to_program_streams.rb b/db/migrate/20190227084038_add_archived_at_to_program_streams.rb index 16302af3d5..c69599aef6 100644 --- a/db/migrate/20190227084038_add_archived_at_to_program_streams.rb +++ b/db/migrate/20190227084038_add_archived_at_to_program_streams.rb @@ -1,4 +1,4 @@ -class AddArchivedAtToProgramStreams < ActiveRecord::Migration +class AddArchivedAtToProgramStreams < ActiveRecord::Migration[5.2] def change add_column :program_streams, :archived_at, :datetime add_index :program_streams, :archived_at diff --git a/db/migrate/20190301032544_add_deleted_to_client_enrollment.rb b/db/migrate/20190301032544_add_deleted_to_client_enrollment.rb index f749af8888..127e9a25b3 100644 --- a/db/migrate/20190301032544_add_deleted_to_client_enrollment.rb +++ b/db/migrate/20190301032544_add_deleted_to_client_enrollment.rb @@ -1,4 +1,4 @@ -class AddDeletedToClientEnrollment < ActiveRecord::Migration +class AddDeletedToClientEnrollment < ActiveRecord::Migration[5.2] def change add_column :client_enrollments, :deleted_at, :datetime add_index :client_enrollments, :deleted_at diff --git a/db/migrate/20190301033726_add_deleted_to_tracking.rb b/db/migrate/20190301033726_add_deleted_to_tracking.rb index 5d60cec7d7..7164c55bc8 100644 --- a/db/migrate/20190301033726_add_deleted_to_tracking.rb +++ b/db/migrate/20190301033726_add_deleted_to_tracking.rb @@ -1,4 +1,4 @@ -class AddDeletedToTracking < ActiveRecord::Migration +class AddDeletedToTracking < ActiveRecord::Migration[5.2] def change add_column :trackings, :deleted_at, :datetime add_index :trackings, :deleted_at diff --git a/db/migrate/20190301034545_add_deleted_at_to_leave_program.rb b/db/migrate/20190301034545_add_deleted_at_to_leave_program.rb index de5e74fe4e..21acb2ef6b 100644 --- a/db/migrate/20190301034545_add_deleted_at_to_leave_program.rb +++ b/db/migrate/20190301034545_add_deleted_at_to_leave_program.rb @@ -1,4 +1,4 @@ -class AddDeletedAtToLeaveProgram < ActiveRecord::Migration +class AddDeletedAtToLeaveProgram < ActiveRecord::Migration[5.2] def change add_column :leave_programs, :deleted_at, :datetime add_index :leave_programs, :deleted_at diff --git a/db/migrate/20190301035300_add_deleted_at_to_domain_program_streams.rb b/db/migrate/20190301035300_add_deleted_at_to_domain_program_streams.rb index a90078503a..61f7a8dc82 100644 --- a/db/migrate/20190301035300_add_deleted_at_to_domain_program_streams.rb +++ b/db/migrate/20190301035300_add_deleted_at_to_domain_program_streams.rb @@ -1,4 +1,4 @@ -class AddDeletedAtToDomainProgramStreams < ActiveRecord::Migration +class AddDeletedAtToDomainProgramStreams < ActiveRecord::Migration[5.2] def change add_column :domain_program_streams, :deleted_at, :datetime add_index :domain_program_streams, :deleted_at diff --git a/db/migrate/20190301045414_add_deleted_at_to_program_stream_permission.rb b/db/migrate/20190301045414_add_deleted_at_to_program_stream_permission.rb index 0a249433db..b3aac11348 100644 --- a/db/migrate/20190301045414_add_deleted_at_to_program_stream_permission.rb +++ b/db/migrate/20190301045414_add_deleted_at_to_program_stream_permission.rb @@ -1,4 +1,4 @@ -class AddDeletedAtToProgramStreamPermission < ActiveRecord::Migration +class AddDeletedAtToProgramStreamPermission < ActiveRecord::Migration[5.2] def change add_column :program_stream_permissions, :deleted_at, :datetime add_index :program_stream_permissions, :deleted_at diff --git a/db/migrate/20190311025303_add_ngo_name_to_referral.rb b/db/migrate/20190311025303_add_ngo_name_to_referral.rb index 85c3a01ba8..baf968adb6 100644 --- a/db/migrate/20190311025303_add_ngo_name_to_referral.rb +++ b/db/migrate/20190311025303_add_ngo_name_to_referral.rb @@ -1,4 +1,4 @@ -class AddNgoNameToReferral < ActiveRecord::Migration +class AddNgoNameToReferral < ActiveRecord::Migration[5.2] def change add_column :referrals, :ngo_name, :string, default: '' end diff --git a/db/migrate/20190318021414_add_activate_and_deactivate_date_to_user.rb b/db/migrate/20190318021414_add_activate_and_deactivate_date_to_user.rb index 9f0419acc0..b781d25e62 100644 --- a/db/migrate/20190318021414_add_activate_and_deactivate_date_to_user.rb +++ b/db/migrate/20190318021414_add_activate_and_deactivate_date_to_user.rb @@ -1,4 +1,4 @@ -class AddActivateAndDeactivateDateToUser < ActiveRecord::Migration +class AddActivateAndDeactivateDateToUser < ActiveRecord::Migration[5.2] def change add_column :users, :activated_at, :datetime, default: nil add_column :users, :deactivated_at, :datetime, default: nil diff --git a/db/migrate/20190320030908_add_name_en_to_referral_source.rb b/db/migrate/20190320030908_add_name_en_to_referral_source.rb index 67ab6a2ead..ffcddf7612 100644 --- a/db/migrate/20190320030908_add_name_en_to_referral_source.rb +++ b/db/migrate/20190320030908_add_name_en_to_referral_source.rb @@ -1,4 +1,4 @@ -class AddNameEnToReferralSource < ActiveRecord::Migration +class AddNameEnToReferralSource < ActiveRecord::Migration[5.2] def change add_column :referral_sources, :name_en, :string, default: '' end diff --git a/db/migrate/20190321033057_add_deleted_at_to_user.rb b/db/migrate/20190321033057_add_deleted_at_to_user.rb index dc8a2ff3d6..1c5cbeb7ab 100644 --- a/db/migrate/20190321033057_add_deleted_at_to_user.rb +++ b/db/migrate/20190321033057_add_deleted_at_to_user.rb @@ -1,4 +1,4 @@ -class AddDeletedAtToUser < ActiveRecord::Migration +class AddDeletedAtToUser < ActiveRecord::Migration[5.2] def change add_column :users, :deleted_at, :datetime add_index :users, :deleted_at diff --git a/db/migrate/20190322023721_add_case_note_id_to_task.rb b/db/migrate/20190322023721_add_case_note_id_to_task.rb index a34db86167..3ea90e27f6 100644 --- a/db/migrate/20190322023721_add_case_note_id_to_task.rb +++ b/db/migrate/20190322023721_add_case_note_id_to_task.rb @@ -1,4 +1,4 @@ -class AddCaseNoteIdToTask < ActiveRecord::Migration +class AddCaseNoteIdToTask < ActiveRecord::Migration[5.2] def change add_column :tasks, :case_note_id, :string, default: '' end diff --git a/db/migrate/20190404034803_change_data_type_of_government_forms.rb b/db/migrate/20190404034803_change_data_type_of_government_forms.rb index 79282ab06e..f179f64620 100644 --- a/db/migrate/20190404034803_change_data_type_of_government_forms.rb +++ b/db/migrate/20190404034803_change_data_type_of_government_forms.rb @@ -1,4 +1,4 @@ -class ChangeDataTypeOfGovernmentForms < ActiveRecord::Migration +class ChangeDataTypeOfGovernmentForms < ActiveRecord::Migration[5.2] def up change_column :government_forms, :source_info, :text, :default => '' change_column :government_forms, :summary_info_of_referral, :text, :default => '' diff --git a/db/migrate/20190410023836_add_ancestry_to_referral_source.rb b/db/migrate/20190410023836_add_ancestry_to_referral_source.rb index 09cad761b2..3d84765a39 100644 --- a/db/migrate/20190410023836_add_ancestry_to_referral_source.rb +++ b/db/migrate/20190410023836_add_ancestry_to_referral_source.rb @@ -1,4 +1,4 @@ -class AddAncestryToReferralSource < ActiveRecord::Migration +class AddAncestryToReferralSource < ActiveRecord::Migration[5.2] def change add_column :referral_sources, :ancestry, :string add_index :referral_sources, :ancestry diff --git a/db/migrate/20190423041510_add_referral_source_category_id_to_client.rb b/db/migrate/20190423041510_add_referral_source_category_id_to_client.rb index d50d2c5a53..c360df6e93 100644 --- a/db/migrate/20190423041510_add_referral_source_category_id_to_client.rb +++ b/db/migrate/20190423041510_add_referral_source_category_id_to_client.rb @@ -1,4 +1,4 @@ -class AddReferralSourceCategoryIdToClient < ActiveRecord::Migration +class AddReferralSourceCategoryIdToClient < ActiveRecord::Migration[5.2] def change add_column :organizations, :referral_source_category_id, :integer end diff --git a/db/migrate/20190501084254_create_services.rb b/db/migrate/20190501084254_create_services.rb index e2e07bacce..918df117cb 100644 --- a/db/migrate/20190501084254_create_services.rb +++ b/db/migrate/20190501084254_create_services.rb @@ -1,4 +1,4 @@ -class CreateServices < ActiveRecord::Migration +class CreateServices < ActiveRecord::Migration[5.2] def change create_table :services do |t| t.string :name diff --git a/db/migrate/20190501085914_create_program_stream_services.rb b/db/migrate/20190501085914_create_program_stream_services.rb index 10948e1be6..993d0061f2 100644 --- a/db/migrate/20190501085914_create_program_stream_services.rb +++ b/db/migrate/20190501085914_create_program_stream_services.rb @@ -1,4 +1,4 @@ -class CreateProgramStreamServices < ActiveRecord::Migration +class CreateProgramStreamServices < ActiveRecord::Migration[5.2] def change create_table :program_stream_services do |t| t.datetime :deleted_at diff --git a/db/migrate/20190508022540_add_duplicate_checker_to_shared_client.rb b/db/migrate/20190508022540_add_duplicate_checker_to_shared_client.rb index fd130f9b10..5a6ac350a0 100644 --- a/db/migrate/20190508022540_add_duplicate_checker_to_shared_client.rb +++ b/db/migrate/20190508022540_add_duplicate_checker_to_shared_client.rb @@ -1,4 +1,4 @@ -class AddDuplicateCheckerToSharedClient < ActiveRecord::Migration +class AddDuplicateCheckerToSharedClient < ActiveRecord::Migration[5.2] def change add_column :shared_clients, :duplicate_checker, :string end diff --git a/db/migrate/20190509031724_add_index_to_duplicate_checker.rb b/db/migrate/20190509031724_add_index_to_duplicate_checker.rb index 2a4d5c5bc9..946ee163e8 100644 --- a/db/migrate/20190509031724_add_index_to_duplicate_checker.rb +++ b/db/migrate/20190509031724_add_index_to_duplicate_checker.rb @@ -1,4 +1,4 @@ -class AddIndexToDuplicateChecker < ActiveRecord::Migration +class AddIndexToDuplicateChecker < ActiveRecord::Migration[5.2] def change add_index :shared_clients, :duplicate_checker end diff --git a/db/migrate/20190529031333_add_archived_slug_to_clients.rb b/db/migrate/20190529031333_add_archived_slug_to_clients.rb index a74c400f64..7e486aa708 100644 --- a/db/migrate/20190529031333_add_archived_slug_to_clients.rb +++ b/db/migrate/20190529031333_add_archived_slug_to_clients.rb @@ -1,4 +1,4 @@ -class AddArchivedSlugToClients < ActiveRecord::Migration +class AddArchivedSlugToClients < ActiveRecord::Migration[5.2] def up add_column :clients, :archived_slug, :string, deafult: '' add_column :shared_clients, :archived_slug, :string, deafult: '' diff --git a/db/migrate/20190627063528_drop_answers_table.rb b/db/migrate/20190627063528_drop_answers_table.rb index 580cce3a59..b0b80125a3 100644 --- a/db/migrate/20190627063528_drop_answers_table.rb +++ b/db/migrate/20190627063528_drop_answers_table.rb @@ -1,4 +1,4 @@ -class DropAnswersTable < ActiveRecord::Migration +class DropAnswersTable < ActiveRecord::Migration[5.2] def up drop_table :answers end diff --git a/db/migrate/20190627065544_drop_interventions_progress_note_table.rb b/db/migrate/20190627065544_drop_interventions_progress_note_table.rb index 063b0b58d1..c9c92c8aa2 100644 --- a/db/migrate/20190627065544_drop_interventions_progress_note_table.rb +++ b/db/migrate/20190627065544_drop_interventions_progress_note_table.rb @@ -1,4 +1,4 @@ -class DropInterventionsProgressNoteTable < ActiveRecord::Migration +class DropInterventionsProgressNoteTable < ActiveRecord::Migration[5.2] def up drop_table :interventions_progress_notes end diff --git a/db/migrate/20190627071643_drop_thredded_messageboard_users_table.rb b/db/migrate/20190627071643_drop_thredded_messageboard_users_table.rb index b23f3240c4..aa44f535df 100644 --- a/db/migrate/20190627071643_drop_thredded_messageboard_users_table.rb +++ b/db/migrate/20190627071643_drop_thredded_messageboard_users_table.rb @@ -1,4 +1,4 @@ -class DropThreddedMessageboardUsersTable < ActiveRecord::Migration +class DropThreddedMessageboardUsersTable < ActiveRecord::Migration[5.2] def up drop_table :thredded_messageboard_users end diff --git a/db/migrate/20190627075723_drop_assessment_domains_progress_note_table.rb b/db/migrate/20190627075723_drop_assessment_domains_progress_note_table.rb index d9fc0e9865..5ed2671974 100644 --- a/db/migrate/20190627075723_drop_assessment_domains_progress_note_table.rb +++ b/db/migrate/20190627075723_drop_assessment_domains_progress_note_table.rb @@ -1,4 +1,4 @@ -class DropAssessmentDomainsProgressNoteTable < ActiveRecord::Migration +class DropAssessmentDomainsProgressNoteTable < ActiveRecord::Migration[5.2] def up drop_table :assessment_domains_progress_notes end diff --git a/db/migrate/20190726070312_add_custom_id_alias_to_setting.rb b/db/migrate/20190726070312_add_custom_id_alias_to_setting.rb index 228518f92e..8d0f2514de 100644 --- a/db/migrate/20190726070312_add_custom_id_alias_to_setting.rb +++ b/db/migrate/20190726070312_add_custom_id_alias_to_setting.rb @@ -1,4 +1,4 @@ -class AddCustomIdAliasToSetting < ActiveRecord::Migration +class AddCustomIdAliasToSetting < ActiveRecord::Migration[5.2] def change add_column :settings, :custom_id1_latin, :string, default: '' if !column_exists? :settings, :custom_id1_latin add_column :settings, :custom_id1_local, :string, default: '' if !column_exists? :settings, :custom_id1_local diff --git a/db/migrate/20190802065402_create_donor_organization.rb b/db/migrate/20190802065402_create_donor_organization.rb index 37333da72c..f2a4695014 100644 --- a/db/migrate/20190802065402_create_donor_organization.rb +++ b/db/migrate/20190802065402_create_donor_organization.rb @@ -1,4 +1,4 @@ -class CreateDonorOrganization < ActiveRecord::Migration +class CreateDonorOrganization < ActiveRecord::Migration[5.2] def change create_table :donor_organizations do |t| t.references :donor, index: true, foreign_key: true diff --git a/db/migrate/20190814081157_fn_oscar_dashboard_assessment_domains.rb b/db/migrate/20190814081157_fn_oscar_dashboard_assessment_domains.rb index 727f9dd7e5..cc5c758b3b 100644 --- a/db/migrate/20190814081157_fn_oscar_dashboard_assessment_domains.rb +++ b/db/migrate/20190814081157_fn_oscar_dashboard_assessment_domains.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardAssessmentDomains < ActiveRecord::Migration +class FnOscarDashboardAssessmentDomains < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190819041955_fn_oscar_dashboard_assessments.rb b/db/migrate/20190819041955_fn_oscar_dashboard_assessments.rb index 5f7d235408..677d580630 100644 --- a/db/migrate/20190819041955_fn_oscar_dashboard_assessments.rb +++ b/db/migrate/20190819041955_fn_oscar_dashboard_assessments.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardAssessments < ActiveRecord::Migration +class FnOscarDashboardAssessments < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190819042700_fn_oscar_dashboard_case_notes.rb b/db/migrate/20190819042700_fn_oscar_dashboard_case_notes.rb index 54a1904d0f..fb22ef0f52 100644 --- a/db/migrate/20190819042700_fn_oscar_dashboard_case_notes.rb +++ b/db/migrate/20190819042700_fn_oscar_dashboard_case_notes.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardCaseNotes < ActiveRecord::Migration +class FnOscarDashboardCaseNotes < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190819042947_fn_oscar_dashboard_client_enrollments.rb b/db/migrate/20190819042947_fn_oscar_dashboard_client_enrollments.rb index f34ade8c28..3388ce17c1 100644 --- a/db/migrate/20190819042947_fn_oscar_dashboard_client_enrollments.rb +++ b/db/migrate/20190819042947_fn_oscar_dashboard_client_enrollments.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardClientEnrollments < ActiveRecord::Migration +class FnOscarDashboardClientEnrollments < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190819043228_fn_oscar_dashboard_client_quantitative_cases.rb b/db/migrate/20190819043228_fn_oscar_dashboard_client_quantitative_cases.rb index 54610ef39f..beef7f37e2 100644 --- a/db/migrate/20190819043228_fn_oscar_dashboard_client_quantitative_cases.rb +++ b/db/migrate/20190819043228_fn_oscar_dashboard_client_quantitative_cases.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardClientQuantitativeCases < ActiveRecord::Migration +class FnOscarDashboardClientQuantitativeCases < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190819043419_fn_oscar_dashboard_districts.rb b/db/migrate/20190819043419_fn_oscar_dashboard_districts.rb index 7881f5a545..fa0e04b809 100644 --- a/db/migrate/20190819043419_fn_oscar_dashboard_districts.rb +++ b/db/migrate/20190819043419_fn_oscar_dashboard_districts.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardDistricts < ActiveRecord::Migration +class FnOscarDashboardDistricts < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190819043650_fn_oscar_dashboard_enter_ngos.rb b/db/migrate/20190819043650_fn_oscar_dashboard_enter_ngos.rb index e3ca47807e..fcea1e96bc 100644 --- a/db/migrate/20190819043650_fn_oscar_dashboard_enter_ngos.rb +++ b/db/migrate/20190819043650_fn_oscar_dashboard_enter_ngos.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardEnterNgos < ActiveRecord::Migration +class FnOscarDashboardEnterNgos < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190819044012_fn_oscar_dashboard_exit_ngos.rb b/db/migrate/20190819044012_fn_oscar_dashboard_exit_ngos.rb index 9f58d583c7..e7788c805b 100644 --- a/db/migrate/20190819044012_fn_oscar_dashboard_exit_ngos.rb +++ b/db/migrate/20190819044012_fn_oscar_dashboard_exit_ngos.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardExitNgos < ActiveRecord::Migration +class FnOscarDashboardExitNgos < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190819044717_fn_oscar_dashboard_provinces.rb b/db/migrate/20190819044717_fn_oscar_dashboard_provinces.rb index 9ef0752682..0d7d0e7f1b 100644 --- a/db/migrate/20190819044717_fn_oscar_dashboard_provinces.rb +++ b/db/migrate/20190819044717_fn_oscar_dashboard_provinces.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardProvinces < ActiveRecord::Migration +class FnOscarDashboardProvinces < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190819044845_fn_oscar_dashboard_quantitative_cases.rb b/db/migrate/20190819044845_fn_oscar_dashboard_quantitative_cases.rb index f1f7d9e712..b6bf93664e 100644 --- a/db/migrate/20190819044845_fn_oscar_dashboard_quantitative_cases.rb +++ b/db/migrate/20190819044845_fn_oscar_dashboard_quantitative_cases.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardQuantitativeCases < ActiveRecord::Migration +class FnOscarDashboardQuantitativeCases < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190819045147_fn_oscar_dashboard_quantitative_types.rb b/db/migrate/20190819045147_fn_oscar_dashboard_quantitative_types.rb index 3d84533c5e..4e1bf885cb 100644 --- a/db/migrate/20190819045147_fn_oscar_dashboard_quantitative_types.rb +++ b/db/migrate/20190819045147_fn_oscar_dashboard_quantitative_types.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardQuantitativeTypes < ActiveRecord::Migration +class FnOscarDashboardQuantitativeTypes < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190819045449_fn_oscar_dashboard_referrals.rb b/db/migrate/20190819045449_fn_oscar_dashboard_referrals.rb index bc77bc199f..8ca14006eb 100644 --- a/db/migrate/20190819045449_fn_oscar_dashboard_referrals.rb +++ b/db/migrate/20190819045449_fn_oscar_dashboard_referrals.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardReferrals < ActiveRecord::Migration +class FnOscarDashboardReferrals < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190820035300_fn_oscar_dashboard_domains.rb b/db/migrate/20190820035300_fn_oscar_dashboard_domains.rb index 4257cd27f4..cd54bb3aec 100644 --- a/db/migrate/20190820035300_fn_oscar_dashboard_domains.rb +++ b/db/migrate/20190820035300_fn_oscar_dashboard_domains.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardDomains < ActiveRecord::Migration +class FnOscarDashboardDomains < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190820085203_fn_oscar_dashboard_program_streams.rb b/db/migrate/20190820085203_fn_oscar_dashboard_program_streams.rb index 27e22e1940..2a11909dcc 100644 --- a/db/migrate/20190820085203_fn_oscar_dashboard_program_streams.rb +++ b/db/migrate/20190820085203_fn_oscar_dashboard_program_streams.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardProgramStreams < ActiveRecord::Migration +class FnOscarDashboardProgramStreams < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190820091522_fn_oscar_dashboard_services.rb b/db/migrate/20190820091522_fn_oscar_dashboard_services.rb index 400c04a9ae..3f8781e9e1 100644 --- a/db/migrate/20190820091522_fn_oscar_dashboard_services.rb +++ b/db/migrate/20190820091522_fn_oscar_dashboard_services.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardServices < ActiveRecord::Migration +class FnOscarDashboardServices < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190820091639_fn_oscar_dashboard_program_stream_services.rb b/db/migrate/20190820091639_fn_oscar_dashboard_program_stream_services.rb index a773cc3389..1d36e73607 100644 --- a/db/migrate/20190820091639_fn_oscar_dashboard_program_stream_services.rb +++ b/db/migrate/20190820091639_fn_oscar_dashboard_program_stream_services.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardProgramStreamServices < ActiveRecord::Migration +class FnOscarDashboardProgramStreamServices < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190827045104_add_field_case_note_domain_group_id_to_case_note.rb b/db/migrate/20190827045104_add_field_case_note_domain_group_id_to_case_note.rb index be49da5e8d..476baa839d 100644 --- a/db/migrate/20190827045104_add_field_case_note_domain_group_id_to_case_note.rb +++ b/db/migrate/20190827045104_add_field_case_note_domain_group_id_to_case_note.rb @@ -1,4 +1,4 @@ -class AddFieldCaseNoteDomainGroupIdToCaseNote < ActiveRecord::Migration +class AddFieldCaseNoteDomainGroupIdToCaseNote < ActiveRecord::Migration[5.2] def change add_column :case_notes, :selected_domain_group_ids, :string, array: true, default: [] if !column_exists? :case_notes, :selected_domain_group_ids end diff --git a/db/migrate/20190909064523_fn_oscar_dashboard_donors.rb b/db/migrate/20190909064523_fn_oscar_dashboard_donors.rb index 21c0dc81db..b1a2471a47 100644 --- a/db/migrate/20190909064523_fn_oscar_dashboard_donors.rb +++ b/db/migrate/20190909064523_fn_oscar_dashboard_donors.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardDonors < ActiveRecord::Migration +class FnOscarDashboardDonors < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20190910023646_fn_oscar_dashboard_referral_sources.rb b/db/migrate/20190910023646_fn_oscar_dashboard_referral_sources.rb index 1788fc7e10..8350407bbc 100644 --- a/db/migrate/20190910023646_fn_oscar_dashboard_referral_sources.rb +++ b/db/migrate/20190910023646_fn_oscar_dashboard_referral_sources.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardReferralSources < ActiveRecord::Migration +class FnOscarDashboardReferralSources < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20191014021122_fn_oscar_dashboard_domain_groups.rb b/db/migrate/20191014021122_fn_oscar_dashboard_domain_groups.rb index 00e4cab484..f080e56fac 100644 --- a/db/migrate/20191014021122_fn_oscar_dashboard_domain_groups.rb +++ b/db/migrate/20191014021122_fn_oscar_dashboard_domain_groups.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardDomainGroups < ActiveRecord::Migration +class FnOscarDashboardDomainGroups < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20191018044950_fn_oscar_dashboard_leave_programs.rb b/db/migrate/20191018044950_fn_oscar_dashboard_leave_programs.rb index 8220965e02..52e7ba23d4 100644 --- a/db/migrate/20191018044950_fn_oscar_dashboard_leave_programs.rb +++ b/db/migrate/20191018044950_fn_oscar_dashboard_leave_programs.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardLeavePrograms < ActiveRecord::Migration +class FnOscarDashboardLeavePrograms < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20191018071239_fn_oscar_dashboard_shared_provinces.rb b/db/migrate/20191018071239_fn_oscar_dashboard_shared_provinces.rb index ef1f66cb70..baacbb2063 100644 --- a/db/migrate/20191018071239_fn_oscar_dashboard_shared_provinces.rb +++ b/db/migrate/20191018071239_fn_oscar_dashboard_shared_provinces.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardSharedProvinces < ActiveRecord::Migration +class FnOscarDashboardSharedProvinces < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20191023050200_populate_client_assessments_count.rb b/db/migrate/20191023050200_populate_client_assessments_count.rb index 28effe5137..e3b5404a5f 100644 --- a/db/migrate/20191023050200_populate_client_assessments_count.rb +++ b/db/migrate/20191023050200_populate_client_assessments_count.rb @@ -1,4 +1,4 @@ -class PopulateClientAssessmentsCount < ActiveRecord::Migration +class PopulateClientAssessmentsCount < ActiveRecord::Migration[5.2] def change remove_column :clients, :assessments_count, :integer add_column :clients, :assessments_count, :integer, default: 0, null: false diff --git a/db/migrate/20191104023930_add_anti_human_trafficking_to_organization.rb b/db/migrate/20191104023930_add_anti_human_trafficking_to_organization.rb index 4baee59f8d..975fb6f469 100644 --- a/db/migrate/20191104023930_add_anti_human_trafficking_to_organization.rb +++ b/db/migrate/20191104023930_add_anti_human_trafficking_to_organization.rb @@ -1,4 +1,4 @@ -class AddAntiHumanTraffickingToOrganization < ActiveRecord::Migration +class AddAntiHumanTraffickingToOrganization < ActiveRecord::Migration[5.2] def up add_column :organizations, :aht, :boolean, default: false end diff --git a/db/migrate/20191104071018_add_field_deleted_at_to_visits.rb b/db/migrate/20191104071018_add_field_deleted_at_to_visits.rb index 7489ce0677..c03b64a040 100644 --- a/db/migrate/20191104071018_add_field_deleted_at_to_visits.rb +++ b/db/migrate/20191104071018_add_field_deleted_at_to_visits.rb @@ -1,4 +1,4 @@ -class AddFieldDeletedAtToVisits < ActiveRecord::Migration +class AddFieldDeletedAtToVisits < ActiveRecord::Migration[5.2] def change add_column :visits, :deleted_at, :time add_column :visit_clients, :deleted_at, :time diff --git a/db/migrate/20191104081650_change_column_provinces.rb b/db/migrate/20191104081650_change_column_provinces.rb index 5fd9fc0392..3259fe1383 100644 --- a/db/migrate/20191104081650_change_column_provinces.rb +++ b/db/migrate/20191104081650_change_column_provinces.rb @@ -1,4 +1,4 @@ -class ChangeColumnProvinces < ActiveRecord::Migration +class ChangeColumnProvinces < ActiveRecord::Migration[5.2] def change change_column_null :provinces, :users_count, false Province.find_each do |province| diff --git a/db/migrate/20191107040332_add_field_current_family_id_to_client.rb b/db/migrate/20191107040332_add_field_current_family_id_to_client.rb index 20d364773f..ee9d61c17f 100644 --- a/db/migrate/20191107040332_add_field_current_family_id_to_client.rb +++ b/db/migrate/20191107040332_add_field_current_family_id_to_client.rb @@ -1,4 +1,4 @@ -class AddFieldCurrentFamilyIdToClient < ActiveRecord::Migration +class AddFieldCurrentFamilyIdToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :current_family_id, :integer add_index :clients, :current_family_id diff --git a/db/migrate/20191107074516_migrate_current_family_id_to_client.rb b/db/migrate/20191107074516_migrate_current_family_id_to_client.rb index 1b6b88d488..a754adadde 100644 --- a/db/migrate/20191107074516_migrate_current_family_id_to_client.rb +++ b/db/migrate/20191107074516_migrate_current_family_id_to_client.rb @@ -1,4 +1,4 @@ -class MigrateCurrentFamilyIdToClient < ActiveRecord::Migration +class MigrateCurrentFamilyIdToClient < ActiveRecord::Migration[5.2] def up values = Client.joins('INNER JOIN cases ON cases.client_id = clients.id INNER JOIN families ON families.id = cases.family_id').distinct.select('clients.id, (SELECT cases.family_id FROM cases WHERE cases.client_id = clients.id ORDER BY cases.created_at DESC LIMIT 1) ORDER BY cases.created_at DESC LIMIT 1) as family_id').pluck(:id, :family_id).to_h.map do |id, family_id| "(#{id}, #{family_id || 'NULL'})" diff --git a/db/migrate/20191212031248_fn_oscar_dashboard_sponsors.rb b/db/migrate/20191212031248_fn_oscar_dashboard_sponsors.rb index 49dbe01541..56dfaf889e 100644 --- a/db/migrate/20191212031248_fn_oscar_dashboard_sponsors.rb +++ b/db/migrate/20191212031248_fn_oscar_dashboard_sponsors.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardSponsors < ActiveRecord::Migration +class FnOscarDashboardSponsors < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20191212032110_fn_oscar_dashboard_org_donors.rb b/db/migrate/20191212032110_fn_oscar_dashboard_org_donors.rb index 33fc613e5b..ee169d1a04 100644 --- a/db/migrate/20191212032110_fn_oscar_dashboard_org_donors.rb +++ b/db/migrate/20191212032110_fn_oscar_dashboard_org_donors.rb @@ -1,4 +1,4 @@ -class FnOscarDashboardOrgDonors < ActiveRecord::Migration +class FnOscarDashboardOrgDonors < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20191212083139_create_referees.rb b/db/migrate/20191212083139_create_referees.rb index 65fa9b2fff..c4f0ba11cc 100644 --- a/db/migrate/20191212083139_create_referees.rb +++ b/db/migrate/20191212083139_create_referees.rb @@ -1,4 +1,4 @@ -class CreateReferees < ActiveRecord::Migration +class CreateReferees < ActiveRecord::Migration[5.2] def change create_table :referees do |t| t.string :address_type, default: '' diff --git a/db/migrate/20191213064920_add_phone_owner_email_phone_to_client.rb b/db/migrate/20191213064920_add_phone_owner_email_phone_to_client.rb index e26b4162b5..7aca4d3918 100644 --- a/db/migrate/20191213064920_add_phone_owner_email_phone_to_client.rb +++ b/db/migrate/20191213064920_add_phone_owner_email_phone_to_client.rb @@ -1,4 +1,4 @@ -class AddPhoneOwnerEmailPhoneToClient < ActiveRecord::Migration +class AddPhoneOwnerEmailPhoneToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :outside, :boolean, default: false add_column :clients, :outside_address, :string, default: '' diff --git a/db/migrate/20191213071929_add_referee_carer_to_client.rb b/db/migrate/20191213071929_add_referee_carer_to_client.rb index e2dee03bc9..a4c3e9a874 100644 --- a/db/migrate/20191213071929_add_referee_carer_to_client.rb +++ b/db/migrate/20191213071929_add_referee_carer_to_client.rb @@ -1,4 +1,4 @@ -class AddRefereeCarerToClient < ActiveRecord::Migration +class AddRefereeCarerToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :referee_id, :integer add_column :clients, :carer_id, :integer diff --git a/db/migrate/20191213072011_create_carers.rb b/db/migrate/20191213072011_create_carers.rb index 7a1f0f4bda..a1d22b358f 100644 --- a/db/migrate/20191213072011_create_carers.rb +++ b/db/migrate/20191213072011_create_carers.rb @@ -1,4 +1,4 @@ -class CreateCarers < ActiveRecord::Migration +class CreateCarers < ActiveRecord::Migration[5.2] def change create_table :carers do |t| t.string :address_type, default: '' diff --git a/db/migrate/20191216023313_add_field_to_referee_and_carer.rb b/db/migrate/20191216023313_add_field_to_referee_and_carer.rb index e8cd3aac63..0380524cbd 100644 --- a/db/migrate/20191216023313_add_field_to_referee_and_carer.rb +++ b/db/migrate/20191216023313_add_field_to_referee_and_carer.rb @@ -1,4 +1,4 @@ -class AddFieldToRefereeAndCarer < ActiveRecord::Migration +class AddFieldToRefereeAndCarer < ActiveRecord::Migration[5.2] def change add_column :referees, :name, :string, default: '' add_column :referees, :phone, :string, default: '' diff --git a/db/migrate/20191216083413_add_same_as_client_to_carer.rb b/db/migrate/20191216083413_add_same_as_client_to_carer.rb index 00fa316242..3a17ecafed 100644 --- a/db/migrate/20191216083413_add_same_as_client_to_carer.rb +++ b/db/migrate/20191216083413_add_same_as_client_to_carer.rb @@ -1,4 +1,4 @@ -class AddSameAsClientToCarer < ActiveRecord::Migration +class AddSameAsClientToCarer < ActiveRecord::Migration[5.2] def change add_column :carers, :same_as_client, :boolean, default: false end diff --git a/db/migrate/20191224075206_add_deleted_at_to_enter_ngo.rb b/db/migrate/20191224075206_add_deleted_at_to_enter_ngo.rb index b40ff9b58f..fb67743690 100644 --- a/db/migrate/20191224075206_add_deleted_at_to_enter_ngo.rb +++ b/db/migrate/20191224075206_add_deleted_at_to_enter_ngo.rb @@ -1,4 +1,4 @@ -class AddDeletedAtToEnterNgo < ActiveRecord::Migration +class AddDeletedAtToEnterNgo < ActiveRecord::Migration[5.2] def change add_column :enter_ngos, :deleted_at, :datetime add_index :enter_ngos, :deleted_at diff --git a/db/migrate/20191224080942_add_deleted_at_to_exit_ngo.rb b/db/migrate/20191224080942_add_deleted_at_to_exit_ngo.rb index 6a796db531..32aa0517cd 100644 --- a/db/migrate/20191224080942_add_deleted_at_to_exit_ngo.rb +++ b/db/migrate/20191224080942_add_deleted_at_to_exit_ngo.rb @@ -1,4 +1,4 @@ -class AddDeletedAtToExitNgo < ActiveRecord::Migration +class AddDeletedAtToExitNgo < ActiveRecord::Migration[5.2] def change add_column :exit_ngos, :deleted_at, :datetime add_index :exit_ngos, :deleted_at diff --git a/db/migrate/20200104023629_create_calls.rb b/db/migrate/20200104023629_create_calls.rb index 0748649536..4a009c4c56 100644 --- a/db/migrate/20200104023629_create_calls.rb +++ b/db/migrate/20200104023629_create_calls.rb @@ -1,4 +1,4 @@ -class CreateCalls < ActiveRecord::Migration +class CreateCalls < ActiveRecord::Migration[5.2] def change create_table :calls do |t| t.references :referee, index: true, foreign_key: true diff --git a/db/migrate/20200104023907_add_caller_fields_to_referee.rb b/db/migrate/20200104023907_add_caller_fields_to_referee.rb index fa54208348..769ca684d0 100644 --- a/db/migrate/20200104023907_add_caller_fields_to_referee.rb +++ b/db/migrate/20200104023907_add_caller_fields_to_referee.rb @@ -1,4 +1,4 @@ -class AddCallerFieldsToReferee < ActiveRecord::Migration +class AddCallerFieldsToReferee < ActiveRecord::Migration[5.2] def change add_column :referees, :answered_call, :boolean add_column :referees, :called_before, :boolean diff --git a/db/migrate/20200104025346_add_hotline_fields_to_client.rb b/db/migrate/20200104025346_add_hotline_fields_to_client.rb index 90e2e40e08..952105dd9a 100644 --- a/db/migrate/20200104025346_add_hotline_fields_to_client.rb +++ b/db/migrate/20200104025346_add_hotline_fields_to_client.rb @@ -1,4 +1,4 @@ -class AddHotlineFieldsToClient < ActiveRecord::Migration +class AddHotlineFieldsToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :nickname, :string, default: '' # Relationship to Caller diff --git a/db/migrate/20200105064510_create_custom_assessment_settings.rb b/db/migrate/20200105064510_create_custom_assessment_settings.rb index 04a33b3f11..00482d498a 100644 --- a/db/migrate/20200105064510_create_custom_assessment_settings.rb +++ b/db/migrate/20200105064510_create_custom_assessment_settings.rb @@ -1,4 +1,4 @@ -class CreateCustomAssessmentSettings < ActiveRecord::Migration +class CreateCustomAssessmentSettings < ActiveRecord::Migration[5.2] def change create_table :custom_assessment_settings do |t| t.string :custom_assessment_name, default: "Custom Assessment" diff --git a/db/migrate/20200107044528_add_custom_assessment_setting_id_to_domains.rb b/db/migrate/20200107044528_add_custom_assessment_setting_id_to_domains.rb index 5d3ec88b50..5671ac1307 100644 --- a/db/migrate/20200107044528_add_custom_assessment_setting_id_to_domains.rb +++ b/db/migrate/20200107044528_add_custom_assessment_setting_id_to_domains.rb @@ -1,4 +1,4 @@ -class AddCustomAssessmentSettingIdToDomains < ActiveRecord::Migration +class AddCustomAssessmentSettingIdToDomains < ActiveRecord::Migration[5.2] def change add_column :domains, :custom_assessment_setting_id, :integer end diff --git a/db/migrate/20200107150040_change_concern_outside_address_column.rb b/db/migrate/20200107150040_change_concern_outside_address_column.rb index b945058999..f03cf440f9 100644 --- a/db/migrate/20200107150040_change_concern_outside_address_column.rb +++ b/db/migrate/20200107150040_change_concern_outside_address_column.rb @@ -1,4 +1,4 @@ -class ChangeConcernOutsideAddressColumn < ActiveRecord::Migration +class ChangeConcernOutsideAddressColumn < ActiveRecord::Migration[5.2] def up change_column :clients, :concern_outside_address, :string, default: "" end diff --git a/db/migrate/20200110021802_add_counselling_summary_and_info_provided_to_call.rb b/db/migrate/20200110021802_add_counselling_summary_and_info_provided_to_call.rb index 4abd6a746e..7d4b3d5876 100644 --- a/db/migrate/20200110021802_add_counselling_summary_and_info_provided_to_call.rb +++ b/db/migrate/20200110021802_add_counselling_summary_and_info_provided_to_call.rb @@ -1,4 +1,4 @@ -class AddCounsellingSummaryAndInfoProvidedToCall < ActiveRecord::Migration +class AddCounsellingSummaryAndInfoProvidedToCall < ActiveRecord::Migration[5.2] def change add_column :calls, :phone_counselling_summary, :string, default: '' add_column :calls, :information_provided, :string, default: '' diff --git a/db/migrate/20200113064723_add_date_of_call_to_call.rb b/db/migrate/20200113064723_add_date_of_call_to_call.rb index 028a97056a..5267edf447 100644 --- a/db/migrate/20200113064723_add_date_of_call_to_call.rb +++ b/db/migrate/20200113064723_add_date_of_call_to_call.rb @@ -1,4 +1,4 @@ -class AddDateOfCallToCall < ActiveRecord::Migration +class AddDateOfCallToCall < ActiveRecord::Migration[5.2] def change add_column :calls, :date_of_call, :date end diff --git a/db/migrate/20200114124333_add_locations_to_client.rb b/db/migrate/20200114124333_add_locations_to_client.rb index 5d016f1551..998fcd3322 100644 --- a/db/migrate/20200114124333_add_locations_to_client.rb +++ b/db/migrate/20200114124333_add_locations_to_client.rb @@ -1,4 +1,4 @@ -class AddLocationsToClient < ActiveRecord::Migration +class AddLocationsToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :concern_same_as_client, :boolean, default: false add_column :clients, :location_description, :string, default: '' diff --git a/db/migrate/20200116022605_create_hotline.rb b/db/migrate/20200116022605_create_hotline.rb index 5b0b308c12..9867d2b3a6 100644 --- a/db/migrate/20200116022605_create_hotline.rb +++ b/db/migrate/20200116022605_create_hotline.rb @@ -1,4 +1,4 @@ -class CreateHotline < ActiveRecord::Migration +class CreateHotline < ActiveRecord::Migration[5.2] def change create_table :hotlines do |t| t.references :client, index: true, foreign_key: true diff --git a/db/migrate/20200116041656_add_options_aht_and_calls_to_setting.rb b/db/migrate/20200116041656_add_options_aht_and_calls_to_setting.rb index 6f9100ad2d..9940190db9 100644 --- a/db/migrate/20200116041656_add_options_aht_and_calls_to_setting.rb +++ b/db/migrate/20200116041656_add_options_aht_and_calls_to_setting.rb @@ -1,4 +1,4 @@ -class AddOptionsAhtAndCallsToSetting < ActiveRecord::Migration +class AddOptionsAhtAndCallsToSetting < ActiveRecord::Migration[5.2] def change add_column :settings, :enable_hotline, :boolean, default: false if !column_exists? :settings, :enable_hotline add_column :settings, :enable_client_form, :boolean, default: true if !column_exists? :settings, :enable_client_form diff --git a/db/migrate/20200120083908_add_enable_custom_assessment_to_custom_assessment_setting.rb b/db/migrate/20200120083908_add_enable_custom_assessment_to_custom_assessment_setting.rb index fda5a9dbd0..d871bbc8dc 100644 --- a/db/migrate/20200120083908_add_enable_custom_assessment_to_custom_assessment_setting.rb +++ b/db/migrate/20200120083908_add_enable_custom_assessment_to_custom_assessment_setting.rb @@ -1,4 +1,4 @@ -class AddEnableCustomAssessmentToCustomAssessmentSetting < ActiveRecord::Migration +class AddEnableCustomAssessmentToCustomAssessmentSetting < ActiveRecord::Migration[5.2] def change add_column :custom_assessment_settings, :enable_custom_assessment, :boolean, default: false end diff --git a/db/migrate/20200121040853_add_field_hotline_check_to_advanced_search.rb b/db/migrate/20200121040853_add_field_hotline_check_to_advanced_search.rb index c1e60d9adf..7cc2f60936 100644 --- a/db/migrate/20200121040853_add_field_hotline_check_to_advanced_search.rb +++ b/db/migrate/20200121040853_add_field_hotline_check_to_advanced_search.rb @@ -1,4 +1,4 @@ -class AddFieldHotlineCheckToAdvancedSearch < ActiveRecord::Migration +class AddFieldHotlineCheckToAdvancedSearch < ActiveRecord::Migration[5.2] def change add_column :advanced_searches, :hotline_check, :string, default: '' end diff --git a/db/migrate/20200121101537_create_necessities.rb b/db/migrate/20200121101537_create_necessities.rb index 39db46ef93..7405512938 100644 --- a/db/migrate/20200121101537_create_necessities.rb +++ b/db/migrate/20200121101537_create_necessities.rb @@ -1,4 +1,4 @@ -class CreateNecessities < ActiveRecord::Migration +class CreateNecessities < ActiveRecord::Migration[5.2] def change create_table :necessities do |t| t.string :content, default: '' diff --git a/db/migrate/20200121101841_create_client_necessities.rb b/db/migrate/20200121101841_create_client_necessities.rb index 8df1f812c6..f01ff35174 100644 --- a/db/migrate/20200121101841_create_client_necessities.rb +++ b/db/migrate/20200121101841_create_client_necessities.rb @@ -1,4 +1,4 @@ -class CreateClientNecessities < ActiveRecord::Migration +class CreateClientNecessities < ActiveRecord::Migration[5.2] def change create_table :client_necessities do |t| t.references :client, index: true, foreign_key: true diff --git a/db/migrate/20200121101945_create_protection_concerns.rb b/db/migrate/20200121101945_create_protection_concerns.rb index caee9ad642..ee0a137786 100644 --- a/db/migrate/20200121101945_create_protection_concerns.rb +++ b/db/migrate/20200121101945_create_protection_concerns.rb @@ -1,4 +1,4 @@ -class CreateProtectionConcerns < ActiveRecord::Migration +class CreateProtectionConcerns < ActiveRecord::Migration[5.2] def change create_table :protection_concerns do |t| t.string :content, default: '' diff --git a/db/migrate/20200121102335_create_client_protection_concerns.rb b/db/migrate/20200121102335_create_client_protection_concerns.rb index b1c967c022..58b044f2e2 100644 --- a/db/migrate/20200121102335_create_client_protection_concerns.rb +++ b/db/migrate/20200121102335_create_client_protection_concerns.rb @@ -1,4 +1,4 @@ -class CreateClientProtectionConcerns < ActiveRecord::Migration +class CreateClientProtectionConcerns < ActiveRecord::Migration[5.2] def change create_table :client_protection_concerns do |t| t.references :client, index: true, foreign_key: true diff --git a/db/migrate/20200123013924_add_brief_note_summary_to_client.rb b/db/migrate/20200123013924_add_brief_note_summary_to_client.rb index 3448bf08d3..65cc8f105c 100644 --- a/db/migrate/20200123013924_add_brief_note_summary_to_client.rb +++ b/db/migrate/20200123013924_add_brief_note_summary_to_client.rb @@ -1,4 +1,4 @@ -class AddBriefNoteSummaryToClient < ActiveRecord::Migration +class AddBriefNoteSummaryToClient < ActiveRecord::Migration[5.2] def change # find this field in hotline form add_column :clients, :brief_note_summary, :string, default: '' diff --git a/db/migrate/20200123113423_move_phone_counselling_summary_from_call_to_client.rb b/db/migrate/20200123113423_move_phone_counselling_summary_from_call_to_client.rb index efa23dc360..7f4f9f6bd8 100644 --- a/db/migrate/20200123113423_move_phone_counselling_summary_from_call_to_client.rb +++ b/db/migrate/20200123113423_move_phone_counselling_summary_from_call_to_client.rb @@ -1,4 +1,4 @@ -class MovePhoneCounsellingSummaryFromCallToClient < ActiveRecord::Migration +class MovePhoneCounsellingSummaryFromCallToClient < ActiveRecord::Migration[5.2] def change remove_column :calls, :phone_counselling_summary, :string add_column :clients, :phone_counselling_summary, :string, default: '' diff --git a/db/migrate/20200129160216_move_hotline_columns_from_referee_to_call.rb b/db/migrate/20200129160216_move_hotline_columns_from_referee_to_call.rb index 8d9a21d53f..915938a7c1 100644 --- a/db/migrate/20200129160216_move_hotline_columns_from_referee_to_call.rb +++ b/db/migrate/20200129160216_move_hotline_columns_from_referee_to_call.rb @@ -1,4 +1,4 @@ -class MoveHotlineColumnsFromRefereeToCall < ActiveRecord::Migration +class MoveHotlineColumnsFromRefereeToCall < ActiveRecord::Migration[5.2] def change remove_column :referees, :answered_call, :boolean remove_column :referees, :called_before, :boolean diff --git a/db/migrate/20200208013259_drop_client_necessities_and_client_protection_concerns.rb b/db/migrate/20200208013259_drop_client_necessities_and_client_protection_concerns.rb index e7563df8f0..3e3a2f86db 100644 --- a/db/migrate/20200208013259_drop_client_necessities_and_client_protection_concerns.rb +++ b/db/migrate/20200208013259_drop_client_necessities_and_client_protection_concerns.rb @@ -1,4 +1,4 @@ -class DropClientNecessitiesAndClientProtectionConcerns < ActiveRecord::Migration +class DropClientNecessitiesAndClientProtectionConcerns < ActiveRecord::Migration[5.2] def change drop_table :client_necessities do |t| t.references :client, index: true, foreign_key: true diff --git a/db/migrate/20200208014349_create_call_necessities.rb b/db/migrate/20200208014349_create_call_necessities.rb index cc9ac6751f..7ba9e8498a 100644 --- a/db/migrate/20200208014349_create_call_necessities.rb +++ b/db/migrate/20200208014349_create_call_necessities.rb @@ -1,4 +1,4 @@ -class CreateCallNecessities < ActiveRecord::Migration +class CreateCallNecessities < ActiveRecord::Migration[5.2] def change create_table :call_necessities do |t| t.references :call, index: true, foreign_key: true diff --git a/db/migrate/20200208014523_create_call_protection_concerns.rb b/db/migrate/20200208014523_create_call_protection_concerns.rb index 6c8d64e2b5..12ddcce1c5 100644 --- a/db/migrate/20200208014523_create_call_protection_concerns.rb +++ b/db/migrate/20200208014523_create_call_protection_concerns.rb @@ -1,4 +1,4 @@ -class CreateCallProtectionConcerns < ActiveRecord::Migration +class CreateCallProtectionConcerns < ActiveRecord::Migration[5.2] def change create_table :call_protection_concerns do |t| t.references :call, index: true, foreign_key: true diff --git a/db/migrate/20200208020035_add_other_more_information_to_client.rb b/db/migrate/20200208020035_add_other_more_information_to_client.rb index 91f18724d7..d33e1d9eba 100644 --- a/db/migrate/20200208020035_add_other_more_information_to_client.rb +++ b/db/migrate/20200208020035_add_other_more_information_to_client.rb @@ -1,4 +1,4 @@ -class AddOtherMoreInformationToClient < ActiveRecord::Migration +class AddOtherMoreInformationToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :other_more_information, :string, default: '' end diff --git a/db/migrate/20200209064139_add_not_a_phone_call_to_call.rb b/db/migrate/20200209064139_add_not_a_phone_call_to_call.rb index 67980baada..7f286a36a1 100644 --- a/db/migrate/20200209064139_add_not_a_phone_call_to_call.rb +++ b/db/migrate/20200209064139_add_not_a_phone_call_to_call.rb @@ -1,4 +1,4 @@ -class AddNotAPhoneCallToCall < ActiveRecord::Migration +class AddNotAPhoneCallToCall < ActiveRecord::Migration[5.2] def change add_column :calls, :not_a_phone_call, :boolean, default: false end diff --git a/db/migrate/20200210020427_remove_end_datetime_from_calls.rb b/db/migrate/20200210020427_remove_end_datetime_from_calls.rb index 8820d8ba13..aa07be3fed 100644 --- a/db/migrate/20200210020427_remove_end_datetime_from_calls.rb +++ b/db/migrate/20200210020427_remove_end_datetime_from_calls.rb @@ -1,4 +1,4 @@ -class RemoveEndDatetimeFromCalls < ActiveRecord::Migration +class RemoveEndDatetimeFromCalls < ActiveRecord::Migration[5.2] def change remove_column :calls, :end_datetime, :datetime end diff --git a/db/migrate/20200210102631_add_childsafe_agent_to_calls.rb b/db/migrate/20200210102631_add_childsafe_agent_to_calls.rb index f9b18b8265..e8d1ce2369 100644 --- a/db/migrate/20200210102631_add_childsafe_agent_to_calls.rb +++ b/db/migrate/20200210102631_add_childsafe_agent_to_calls.rb @@ -1,4 +1,4 @@ -class AddChildsafeAgentToCalls < ActiveRecord::Migration +class AddChildsafeAgentToCalls < ActiveRecord::Migration[5.2] def change add_column :calls, :childsafe_agent, :boolean end diff --git a/db/migrate/20200213062650_move_other_more_information_from_client_to_call.rb b/db/migrate/20200213062650_move_other_more_information_from_client_to_call.rb index a2e1dcfa3d..6125b0322c 100644 --- a/db/migrate/20200213062650_move_other_more_information_from_client_to_call.rb +++ b/db/migrate/20200213062650_move_other_more_information_from_client_to_call.rb @@ -1,4 +1,4 @@ -class MoveOtherMoreInformationFromClientToCall < ActiveRecord::Migration +class MoveOtherMoreInformationFromClientToCall < ActiveRecord::Migration[5.2] def change remove_column :clients, :other_more_information, :string diff --git a/db/migrate/20200213071301_move_brief_note_summary_from_client_to_call.rb b/db/migrate/20200213071301_move_brief_note_summary_from_client_to_call.rb index c8e1094f32..fc3beeae37 100644 --- a/db/migrate/20200213071301_move_brief_note_summary_from_client_to_call.rb +++ b/db/migrate/20200213071301_move_brief_note_summary_from_client_to_call.rb @@ -1,4 +1,4 @@ -class MoveBriefNoteSummaryFromClientToCall < ActiveRecord::Migration +class MoveBriefNoteSummaryFromClientToCall < ActiveRecord::Migration[5.2] def change remove_column :clients, :brief_note_summary, :string diff --git a/db/migrate/20200221033504_add_field_note_to_case_note.rb b/db/migrate/20200221033504_add_field_note_to_case_note.rb index e313259489..91676d1929 100644 --- a/db/migrate/20200221033504_add_field_note_to_case_note.rb +++ b/db/migrate/20200221033504_add_field_note_to_case_note.rb @@ -1,4 +1,4 @@ -class AddFieldNoteToCaseNote < ActiveRecord::Migration +class AddFieldNoteToCaseNote < ActiveRecord::Migration[5.2] def change add_column :case_notes, :note, :text, default: '' end diff --git a/db/migrate/20200224030525_change_column_meeting_date_of_case_note.rb b/db/migrate/20200224030525_change_column_meeting_date_of_case_note.rb index 9216ea0739..744ea17ce0 100644 --- a/db/migrate/20200224030525_change_column_meeting_date_of_case_note.rb +++ b/db/migrate/20200224030525_change_column_meeting_date_of_case_note.rb @@ -1,4 +1,4 @@ -class ChangeColumnMeetingDateOfCaseNote < ActiveRecord::Migration +class ChangeColumnMeetingDateOfCaseNote < ActiveRecord::Migration[5.2] def up change_column :case_notes, :meeting_date, :datetime diff --git a/db/migrate/20200228124341_create_field_settings.rb b/db/migrate/20200228124341_create_field_settings.rb index d2edf174b1..e3177a48bf 100644 --- a/db/migrate/20200228124341_create_field_settings.rb +++ b/db/migrate/20200228124341_create_field_settings.rb @@ -1,4 +1,4 @@ -class CreateFieldSettings < ActiveRecord::Migration +class CreateFieldSettings < ActiveRecord::Migration[5.2] def change create_table :field_settings do |t| t.string :name, null: false diff --git a/db/migrate/20200228125553_translate_field_setting.rb b/db/migrate/20200228125553_translate_field_setting.rb index 71f7019df7..b0cb0fc7b1 100644 --- a/db/migrate/20200228125553_translate_field_setting.rb +++ b/db/migrate/20200228125553_translate_field_setting.rb @@ -1,4 +1,4 @@ -class TranslateFieldSetting < ActiveRecord::Migration +class TranslateFieldSetting < ActiveRecord::Migration[5.2] def change reversible do |dir| dir.up do diff --git a/db/migrate/20200229100125_remove_label_from_field_setting.rb b/db/migrate/20200229100125_remove_label_from_field_setting.rb index d0fef33c5e..74c9837a56 100644 --- a/db/migrate/20200229100125_remove_label_from_field_setting.rb +++ b/db/migrate/20200229100125_remove_label_from_field_setting.rb @@ -1,4 +1,4 @@ -class RemoveLabelFromFieldSetting < ActiveRecord::Migration +class RemoveLabelFromFieldSetting < ActiveRecord::Migration[5.2] def change remove_column :field_settings, :label end diff --git a/db/migrate/20200301073436_add_type_to_field_settings.rb b/db/migrate/20200301073436_add_type_to_field_settings.rb index 7a27ee3964..f673cd5f32 100644 --- a/db/migrate/20200301073436_add_type_to_field_settings.rb +++ b/db/migrate/20200301073436_add_type_to_field_settings.rb @@ -1,4 +1,4 @@ -class AddTypeToFieldSettings < ActiveRecord::Migration +class AddTypeToFieldSettings < ActiveRecord::Migration[5.2] def change add_column :field_settings, :type, :string, default: :field, null: false end diff --git a/db/migrate/20200302053723_rename_column_in_field_settings.rb b/db/migrate/20200302053723_rename_column_in_field_settings.rb index 918d490491..61bfb1e4c6 100644 --- a/db/migrate/20200302053723_rename_column_in_field_settings.rb +++ b/db/migrate/20200302053723_rename_column_in_field_settings.rb @@ -1,4 +1,4 @@ -class RenameColumnInFieldSettings < ActiveRecord::Migration +class RenameColumnInFieldSettings < ActiveRecord::Migration[5.2] def change add_column :field_settings, :visible, :boolean, default: true, null: false remove_column :field_settings, :hidden diff --git a/db/migrate/20200304044337_add_association_to_case_note.rb b/db/migrate/20200304044337_add_association_to_case_note.rb index 36b2f7cfc2..3efe22d238 100644 --- a/db/migrate/20200304044337_add_association_to_case_note.rb +++ b/db/migrate/20200304044337_add_association_to_case_note.rb @@ -1,4 +1,4 @@ -class AddAssociationToCaseNote < ActiveRecord::Migration +class AddAssociationToCaseNote < ActiveRecord::Migration[5.2] def change add_reference :case_notes, :custom_assessment_setting, index: true, foreign_key: true end diff --git a/db/migrate/20200306062433_add_fiels_to_field_settings.rb b/db/migrate/20200306062433_add_fiels_to_field_settings.rb index 83c108dc2c..568b839925 100644 --- a/db/migrate/20200306062433_add_fiels_to_field_settings.rb +++ b/db/migrate/20200306062433_add_fiels_to_field_settings.rb @@ -1,4 +1,4 @@ -class AddFielsToFieldSettings < ActiveRecord::Migration +class AddFielsToFieldSettings < ActiveRecord::Migration[5.2] def change add_column :field_settings, :current_label, :string add_column :field_settings, :required, :boolean, default: false diff --git a/db/migrate/20200306064650_rename_field_settings.rb b/db/migrate/20200306064650_rename_field_settings.rb index 2da15cf578..a02a39696c 100644 --- a/db/migrate/20200306064650_rename_field_settings.rb +++ b/db/migrate/20200306064650_rename_field_settings.rb @@ -1,4 +1,4 @@ -class RenameFieldSettings < ActiveRecord::Migration +class RenameFieldSettings < ActiveRecord::Migration[5.2] def change rename_column :field_settings, :model_name, :klass_name end diff --git a/db/migrate/20200311075911_add_field_to_family.rb b/db/migrate/20200311075911_add_field_to_family.rb index da6ffa81e9..a47a5326b5 100644 --- a/db/migrate/20200311075911_add_field_to_family.rb +++ b/db/migrate/20200311075911_add_field_to_family.rb @@ -1,4 +1,4 @@ -class AddFieldToFamily < ActiveRecord::Migration +class AddFieldToFamily < ActiveRecord::Migration[5.2] def change add_column :families, :deleted_at, :datetime add_index :families, :deleted_at diff --git a/db/migrate/20200311092201_add_field_to_case.rb b/db/migrate/20200311092201_add_field_to_case.rb index bc89e579fd..e8957137f2 100644 --- a/db/migrate/20200311092201_add_field_to_case.rb +++ b/db/migrate/20200311092201_add_field_to_case.rb @@ -1,4 +1,4 @@ -class AddFieldToCase < ActiveRecord::Migration +class AddFieldToCase < ActiveRecord::Migration[5.2] def change add_column :cases, :deleted_at, :datetime add_index :cases, :deleted_at diff --git a/db/migrate/20200316043514_add_brc_fields_to_client.rb b/db/migrate/20200316043514_add_brc_fields_to_client.rb index 820f6985f2..5989b4ed8e 100644 --- a/db/migrate/20200316043514_add_brc_fields_to_client.rb +++ b/db/migrate/20200316043514_add_brc_fields_to_client.rb @@ -1,4 +1,4 @@ -class AddBrcFieldsToClient < ActiveRecord::Migration +class AddBrcFieldsToClient < ActiveRecord::Migration[5.2] def change add_column :clients, :difficulties, :text add_column :clients, :household_members, :text diff --git a/db/migrate/20200319040152_add_more_fields_to_clients.rb b/db/migrate/20200319040152_add_more_fields_to_clients.rb index a966ac42c6..4ea5ed5ac8 100644 --- a/db/migrate/20200319040152_add_more_fields_to_clients.rb +++ b/db/migrate/20200319040152_add_more_fields_to_clients.rb @@ -1,4 +1,4 @@ -class AddMoreFieldsToClients < ActiveRecord::Migration +class AddMoreFieldsToClients < ActiveRecord::Migration[5.2] def change add_column :clients, :presented_id, :string add_column :clients, :id_number, :string diff --git a/db/migrate/20200320030958_remove_some_columns_from_clients.rb b/db/migrate/20200320030958_remove_some_columns_from_clients.rb index e3e042c581..3bdfd57aed 100644 --- a/db/migrate/20200320030958_remove_some_columns_from_clients.rb +++ b/db/migrate/20200320030958_remove_some_columns_from_clients.rb @@ -1,4 +1,4 @@ -class RemoveSomeColumnsFromClients < ActiveRecord::Migration +class RemoveSomeColumnsFromClients < ActiveRecord::Migration[5.2] def change remove_column :clients, :difficulties remove_column :clients, :household_members diff --git a/db/migrate/20200328004830_add_only_instances_to_field_settings.rb b/db/migrate/20200328004830_add_only_instances_to_field_settings.rb index a842592dd0..97e682fd40 100644 --- a/db/migrate/20200328004830_add_only_instances_to_field_settings.rb +++ b/db/migrate/20200328004830_add_only_instances_to_field_settings.rb @@ -1,4 +1,4 @@ -class AddOnlyInstancesToFieldSettings < ActiveRecord::Migration +class AddOnlyInstancesToFieldSettings < ActiveRecord::Migration[5.2] def change add_column :field_settings, :for_instances, :string end diff --git a/db/migrate/20200330090123_add_legacy_brcs_id_to_field_settings.rb b/db/migrate/20200330090123_add_legacy_brcs_id_to_field_settings.rb index 53dee462db..87837c91a3 100644 --- a/db/migrate/20200330090123_add_legacy_brcs_id_to_field_settings.rb +++ b/db/migrate/20200330090123_add_legacy_brcs_id_to_field_settings.rb @@ -1,4 +1,4 @@ -class AddLegacyBrcsIdToFieldSettings < ActiveRecord::Migration +class AddLegacyBrcsIdToFieldSettings < ActiveRecord::Migration[5.2] def change add_column :field_settings, :legacy_brcs_id, :string end diff --git a/db/migrate/20200330110449_add_legacy_brcs_id_to_clients.rb b/db/migrate/20200330110449_add_legacy_brcs_id_to_clients.rb index d8695703fc..8ae07e9ccf 100644 --- a/db/migrate/20200330110449_add_legacy_brcs_id_to_clients.rb +++ b/db/migrate/20200330110449_add_legacy_brcs_id_to_clients.rb @@ -1,4 +1,4 @@ -class AddLegacyBrcsIdToClients < ActiveRecord::Migration +class AddLegacyBrcsIdToClients < ActiveRecord::Migration[5.2] def change remove_column :field_settings, :legacy_brcs_id, :string add_column :clients, :legacy_brcs_id, :string diff --git a/db/migrate/20200331152552_change_whatsapp_type.rb b/db/migrate/20200331152552_change_whatsapp_type.rb index 1374fd97d2..41bb896073 100644 --- a/db/migrate/20200331152552_change_whatsapp_type.rb +++ b/db/migrate/20200331152552_change_whatsapp_type.rb @@ -1,4 +1,4 @@ -class ChangeWhatsappType < ActiveRecord::Migration +class ChangeWhatsappType < ActiveRecord::Migration[5.2] def change remove_column :clients, :whatsapp, :string add_column :clients, :whatsapp, :boolean, default: false diff --git a/db/migrate/20200331161800_remove_v_score.rb b/db/migrate/20200331161800_remove_v_score.rb index 22ed5f5c86..dcad44a7a9 100644 --- a/db/migrate/20200331161800_remove_v_score.rb +++ b/db/migrate/20200331161800_remove_v_score.rb @@ -1,4 +1,4 @@ -class RemoveVScore < ActiveRecord::Migration +class RemoveVScore < ActiveRecord::Migration[5.2] def change remove_column :clients, :v_score end diff --git a/db/migrate/20200402005626_add_preferred_lan_to_users.rb b/db/migrate/20200402005626_add_preferred_lan_to_users.rb index 90cf93141c..1631cae379 100644 --- a/db/migrate/20200402005626_add_preferred_lan_to_users.rb +++ b/db/migrate/20200402005626_add_preferred_lan_to_users.rb @@ -1,4 +1,4 @@ -class AddPreferredLanToUsers < ActiveRecord::Migration +class AddPreferredLanToUsers < ActiveRecord::Migration[5.2] def change remove_column :clients, :preferred_language, :string add_column :users, :preferred_language, :string, default: :en diff --git a/db/migrate/20200403033722_add_relationship_to_referee.rb b/db/migrate/20200403033722_add_relationship_to_referee.rb index 68eb509411..7013906135 100644 --- a/db/migrate/20200403033722_add_relationship_to_referee.rb +++ b/db/migrate/20200403033722_add_relationship_to_referee.rb @@ -1,4 +1,4 @@ -class AddRelationshipToReferee < ActiveRecord::Migration +class AddRelationshipToReferee < ActiveRecord::Migration[5.2] def change add_column :referees, :suburb, :string, default: '' add_column :referees, :description_house_landmark, :string, default: '' diff --git a/db/migrate/20200403033746_add_relationship_to_carer.rb b/db/migrate/20200403033746_add_relationship_to_carer.rb index 1f0dcb494c..caed2774e4 100644 --- a/db/migrate/20200403033746_add_relationship_to_carer.rb +++ b/db/migrate/20200403033746_add_relationship_to_carer.rb @@ -1,4 +1,4 @@ -class AddRelationshipToCarer < ActiveRecord::Migration +class AddRelationshipToCarer < ActiveRecord::Migration[5.2] def change add_column :carers, :suburb, :string, default: '' add_column :carers, :description_house_landmark, :string, default: '' diff --git a/db/migrate/20200404192532_add_gender_to_family_members.rb b/db/migrate/20200404192532_add_gender_to_family_members.rb index 40fe6fe1c1..4b9bf27f07 100644 --- a/db/migrate/20200404192532_add_gender_to_family_members.rb +++ b/db/migrate/20200404192532_add_gender_to_family_members.rb @@ -1,4 +1,4 @@ -class AddGenderToFamilyMembers < ActiveRecord::Migration +class AddGenderToFamilyMembers < ActiveRecord::Migration[5.2] def change add_column :family_members, :gender, :string end diff --git a/db/migrate/20200408083757_create_global_identities.rb b/db/migrate/20200408083757_create_global_identities.rb index bd85f318b6..134bf02b17 100644 --- a/db/migrate/20200408083757_create_global_identities.rb +++ b/db/migrate/20200408083757_create_global_identities.rb @@ -1,4 +1,4 @@ -class CreateGlobalIdentities < ActiveRecord::Migration +class CreateGlobalIdentities < ActiveRecord::Migration[5.2] def up # drop_table :global_identities, force: :cascade if table_exists? :global_identities diff --git a/db/migrate/20200408084848_add_global_id_to_clients.rb b/db/migrate/20200408084848_add_global_id_to_clients.rb index 72e8f21090..c9bf2aa9a8 100644 --- a/db/migrate/20200408084848_add_global_id_to_clients.rb +++ b/db/migrate/20200408084848_add_global_id_to_clients.rb @@ -1,4 +1,4 @@ -class AddGlobalIdToClients < ActiveRecord::Migration +class AddGlobalIdToClients < ActiveRecord::Migration[5.2] def up if column_exists?(:clients, :global_id) change_column :clients, :global_id, :string diff --git a/db/migrate/20200408093230_add_client_global_id_to_referrals.rb b/db/migrate/20200408093230_add_client_global_id_to_referrals.rb index 0c142fb64d..baa6da6d4d 100644 --- a/db/migrate/20200408093230_add_client_global_id_to_referrals.rb +++ b/db/migrate/20200408093230_add_client_global_id_to_referrals.rb @@ -1,9 +1,9 @@ -class AddClientGlobalIdToReferrals < ActiveRecord::Migration +class AddClientGlobalIdToReferrals < ActiveRecord::Migration[5.2] def up add_column :referrals, :client_global_id, :string unless column_exists?(:referrals, :client_global_id) change_column :referrals, :client_global_id, :string if Referral.columns_hash["client_global_id"]&.type == :integer add_index :referrals, :client_global_id if !index_exists?(:referrals, :client_global_id) - + if schema_search_path == "\"mrs\"" if column_exists?(:referrals, :client_global_id) execute <<-SQL.squish diff --git a/db/migrate/20200408093320_add_client_global_id_to_shared_clients.rb b/db/migrate/20200408093320_add_client_global_id_to_shared_clients.rb index c6f3e72794..8b63e334f6 100644 --- a/db/migrate/20200408093320_add_client_global_id_to_shared_clients.rb +++ b/db/migrate/20200408093320_add_client_global_id_to_shared_clients.rb @@ -1,4 +1,4 @@ -class AddClientGlobalIdToSharedClients < ActiveRecord::Migration +class AddClientGlobalIdToSharedClients < ActiveRecord::Migration[5.2] def up add_column :shared_clients, :global_id, :string unless column_exists?(:shared_clients, :global_id) change_column :shared_clients, :global_id, :string diff --git a/db/migrate/20200410042355_add_integrated_field_to_organizations.rb b/db/migrate/20200410042355_add_integrated_field_to_organizations.rb index 8ed745a5aa..55e816de31 100644 --- a/db/migrate/20200410042355_add_integrated_field_to_organizations.rb +++ b/db/migrate/20200410042355_add_integrated_field_to_organizations.rb @@ -1,4 +1,4 @@ -class AddIntegratedFieldToOrganizations < ActiveRecord::Migration +class AddIntegratedFieldToOrganizations < ActiveRecord::Migration[5.2] def change add_column :organizations, :integrated, :boolean, default: false end diff --git a/db/migrate/20200410054110_add_integrated_fields_to_clients.rb b/db/migrate/20200410054110_add_integrated_fields_to_clients.rb index 5fa0bee5ad..99b16e7722 100644 --- a/db/migrate/20200410054110_add_integrated_fields_to_clients.rb +++ b/db/migrate/20200410054110_add_integrated_fields_to_clients.rb @@ -1,4 +1,4 @@ -class AddIntegratedFieldsToClients < ActiveRecord::Migration +class AddIntegratedFieldsToClients < ActiveRecord::Migration[5.2] def change add_column :clients, :external_id, :string add_index :clients, :external_id diff --git a/db/migrate/20200412091835_remove_foreign_key_from_client.rb b/db/migrate/20200412091835_remove_foreign_key_from_client.rb index 5a6c3397d2..630b8c5afd 100644 --- a/db/migrate/20200412091835_remove_foreign_key_from_client.rb +++ b/db/migrate/20200412091835_remove_foreign_key_from_client.rb @@ -1,4 +1,4 @@ -class RemoveForeignKeyFromClient < ActiveRecord::Migration +class RemoveForeignKeyFromClient < ActiveRecord::Migration[5.2] def change remove_foreign_key :clients, column: :global_id if foreign_keys(:clients).map(&:column).include?("global_id") end diff --git a/db/migrate/20200412101201_add_other_phone_whatsapp_to_clients.rb b/db/migrate/20200412101201_add_other_phone_whatsapp_to_clients.rb index 4b222306df..4cd1153a53 100644 --- a/db/migrate/20200412101201_add_other_phone_whatsapp_to_clients.rb +++ b/db/migrate/20200412101201_add_other_phone_whatsapp_to_clients.rb @@ -1,4 +1,4 @@ -class AddOtherPhoneWhatsappToClients < ActiveRecord::Migration +class AddOtherPhoneWhatsappToClients < ActiveRecord::Migration[5.2] def change add_column :clients, :other_phone_whatsapp, :boolean, default: false end diff --git a/db/migrate/20200413025327_add_note_to_family_members.rb b/db/migrate/20200413025327_add_note_to_family_members.rb index cc4cc18534..3eeca12bbe 100644 --- a/db/migrate/20200413025327_add_note_to_family_members.rb +++ b/db/migrate/20200413025327_add_note_to_family_members.rb @@ -1,4 +1,4 @@ -class AddNoteToFamilyMembers < ActiveRecord::Migration +class AddNoteToFamilyMembers < ActiveRecord::Migration[5.2] def change add_column :family_members, :note, :text end diff --git a/db/migrate/20200414054443_add_preferred_language_to_clients.rb b/db/migrate/20200414054443_add_preferred_language_to_clients.rb index 356e346d31..a79a25df9a 100644 --- a/db/migrate/20200414054443_add_preferred_language_to_clients.rb +++ b/db/migrate/20200414054443_add_preferred_language_to_clients.rb @@ -1,4 +1,4 @@ -class AddPreferredLanguageToClients < ActiveRecord::Migration +class AddPreferredLanguageToClients < ActiveRecord::Migration[5.2] def change add_column :clients, :preferred_language, :string end diff --git a/db/migrate/20200417074727_add_multiple_to_quantitative_types.rb b/db/migrate/20200417074727_add_multiple_to_quantitative_types.rb index 99e3cc752b..2673385007 100644 --- a/db/migrate/20200417074727_add_multiple_to_quantitative_types.rb +++ b/db/migrate/20200417074727_add_multiple_to_quantitative_types.rb @@ -1,4 +1,4 @@ -class AddMultipleToQuantitativeTypes < ActiveRecord::Migration +class AddMultipleToQuantitativeTypes < ActiveRecord::Migration[5.2] def change add_column :quantitative_types, :multiple, :boolean, default: true end diff --git a/db/migrate/20200417145348_add_integrated_fields_to_referrals.rb b/db/migrate/20200417145348_add_integrated_fields_to_referrals.rb index ab9c709844..09cca825ea 100644 --- a/db/migrate/20200417145348_add_integrated_fields_to_referrals.rb +++ b/db/migrate/20200417145348_add_integrated_fields_to_referrals.rb @@ -1,4 +1,4 @@ -class AddIntegratedFieldsToReferrals < ActiveRecord::Migration +class AddIntegratedFieldsToReferrals < ActiveRecord::Migration[5.2] def change add_column :referrals, :external_id, :string add_index :referrals, :external_id diff --git a/db/migrate/20200418095200_change_preferred_language_default_value.rb b/db/migrate/20200418095200_change_preferred_language_default_value.rb index dee2decde1..93ac84efec 100644 --- a/db/migrate/20200418095200_change_preferred_language_default_value.rb +++ b/db/migrate/20200418095200_change_preferred_language_default_value.rb @@ -1,4 +1,4 @@ -class ChangePreferredLanguageDefaultValue < ActiveRecord::Migration +class ChangePreferredLanguageDefaultValue < ActiveRecord::Migration[5.2] def up change_column :clients, :preferred_language, :string, default: 'English' end diff --git a/db/migrate/20200419053051_create_global_identity_organizations.rb b/db/migrate/20200419053051_create_global_identity_organizations.rb index 922b736617..844cdd52db 100644 --- a/db/migrate/20200419053051_create_global_identity_organizations.rb +++ b/db/migrate/20200419053051_create_global_identity_organizations.rb @@ -1,4 +1,4 @@ -class CreateGlobalIdentityOrganizations < ActiveRecord::Migration +class CreateGlobalIdentityOrganizations < ActiveRecord::Migration[5.2] def change create_table :global_identity_organizations do |t| t.string :global_id diff --git a/db/migrate/20200420035055_create_external_systems.rb b/db/migrate/20200420035055_create_external_systems.rb index aebd5d994a..3a884d98b0 100644 --- a/db/migrate/20200420035055_create_external_systems.rb +++ b/db/migrate/20200420035055_create_external_systems.rb @@ -1,4 +1,4 @@ -class CreateExternalSystems < ActiveRecord::Migration +class CreateExternalSystems < ActiveRecord::Migration[5.2] def change create_table :external_systems do |t| t.string :name diff --git a/db/migrate/20200420035550_create_external_system_global_identities.rb b/db/migrate/20200420035550_create_external_system_global_identities.rb index e52ddcfbe1..87cfaf4c45 100644 --- a/db/migrate/20200420035550_create_external_system_global_identities.rb +++ b/db/migrate/20200420035550_create_external_system_global_identities.rb @@ -1,4 +1,4 @@ -class CreateExternalSystemGlobalIdentities < ActiveRecord::Migration +class CreateExternalSystemGlobalIdentities < ActiveRecord::Migration[5.2] def change create_table :external_system_global_identities do |t| t.references :external_system, index: true, foreign_key: true diff --git a/db/migrate/20200422045358_create_doorkeeper_tables.rb b/db/migrate/20200422045358_create_doorkeeper_tables.rb index eae56e3dd3..640a405def 100644 --- a/db/migrate/20200422045358_create_doorkeeper_tables.rb +++ b/db/migrate/20200422045358_create_doorkeeper_tables.rb @@ -1,4 +1,4 @@ -class CreateDoorkeeperTables < ActiveRecord::Migration +class CreateDoorkeeperTables < ActiveRecord::Migration[5.2] def change create_table :oauth_applications do |t| t.string :name, null: false diff --git a/db/migrate/20200428115250_create_global_services.rb b/db/migrate/20200428115250_create_global_services.rb index 8e487c8cef..5d930375b2 100644 --- a/db/migrate/20200428115250_create_global_services.rb +++ b/db/migrate/20200428115250_create_global_services.rb @@ -1,4 +1,4 @@ -class CreateGlobalServices < ActiveRecord::Migration +class CreateGlobalServices < ActiveRecord::Migration[5.2] def change disable_extension 'uuid-ossp' enable_extension 'uuid-ossp' diff --git a/db/migrate/20200428121016_add_field_unique_id_to_services.rb b/db/migrate/20200428121016_add_field_unique_id_to_services.rb index 39bf231703..e62b292190 100644 --- a/db/migrate/20200428121016_add_field_unique_id_to_services.rb +++ b/db/migrate/20200428121016_add_field_unique_id_to_services.rb @@ -1,4 +1,4 @@ -class AddFieldUniqueIdToServices < ActiveRecord::Migration +class AddFieldUniqueIdToServices < ActiveRecord::Migration[5.2] def change add_column :services, :uuid, :uuid diff --git a/db/migrate/20200505084319_add_integrated_fields_to_shared_clients.rb b/db/migrate/20200505084319_add_integrated_fields_to_shared_clients.rb index 8a5d24743b..62609fc80e 100644 --- a/db/migrate/20200505084319_add_integrated_fields_to_shared_clients.rb +++ b/db/migrate/20200505084319_add_integrated_fields_to_shared_clients.rb @@ -1,4 +1,4 @@ -class AddIntegratedFieldsToSharedClients < ActiveRecord::Migration +class AddIntegratedFieldsToSharedClients < ActiveRecord::Migration[5.2] def change add_column :shared_clients, :external_id, :string add_index :shared_clients, :external_id diff --git a/db/migrate/20200505091428_add_fields_to_referrals.rb b/db/migrate/20200505091428_add_fields_to_referrals.rb index 8c9d66a47e..6d88f452af 100644 --- a/db/migrate/20200505091428_add_fields_to_referrals.rb +++ b/db/migrate/20200505091428_add_fields_to_referrals.rb @@ -1,4 +1,4 @@ -class AddFieldsToReferrals < ActiveRecord::Migration +class AddFieldsToReferrals < ActiveRecord::Migration[5.2] def change add_column :referrals, :client_gender, :string, default: "" add_column :referrals, :client_date_of_birth, :date diff --git a/db/migrate/20200508071352_add_allow_services_shared_in_external_system_to_clients.rb b/db/migrate/20200508071352_add_allow_services_shared_in_external_system_to_clients.rb index 0d0120386f..08843f4390 100644 --- a/db/migrate/20200508071352_add_allow_services_shared_in_external_system_to_clients.rb +++ b/db/migrate/20200508071352_add_allow_services_shared_in_external_system_to_clients.rb @@ -1,4 +1,4 @@ -class AddAllowServicesSharedInExternalSystemToClients < ActiveRecord::Migration +class AddAllowServicesSharedInExternalSystemToClients < ActiveRecord::Migration[5.2] def change add_column :clients, :referred_external, :boolean, default: false end diff --git a/db/migrate/20200511061823_devise_create_admin_users.rb b/db/migrate/20200511061823_devise_create_admin_users.rb index 93cd7706ed..85281b209e 100644 --- a/db/migrate/20200511061823_devise_create_admin_users.rb +++ b/db/migrate/20200511061823_devise_create_admin_users.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class DeviseCreateAdminUsers < ActiveRecord::Migration +class DeviseCreateAdminUsers < ActiveRecord::Migration[5.2] def change create_table :admin_users do |t| ## Database authenticatable diff --git a/db/migrate/20200520100815_create_referrals_services.rb b/db/migrate/20200520100815_create_referrals_services.rb index 7a8fdeb03c..f64d6c4443 100644 --- a/db/migrate/20200520100815_create_referrals_services.rb +++ b/db/migrate/20200520100815_create_referrals_services.rb @@ -1,4 +1,4 @@ -class CreateReferralsServices < ActiveRecord::Migration +class CreateReferralsServices < ActiveRecord::Migration[5.2] def change create_table :referrals_services, id: false do |t| t.belongs_to :referral diff --git a/db/migrate/20200521085502_add_assessment_score_order_to_settings.rb b/db/migrate/20200521085502_add_assessment_score_order_to_settings.rb index ea8ed75ffd..0cdccf6924 100644 --- a/db/migrate/20200521085502_add_assessment_score_order_to_settings.rb +++ b/db/migrate/20200521085502_add_assessment_score_order_to_settings.rb @@ -1,4 +1,4 @@ -class AddAssessmentScoreOrderToSettings < ActiveRecord::Migration +class AddAssessmentScoreOrderToSettings < ActiveRecord::Migration[5.2] def change add_column :settings, :assessment_score_order, :string, default: 'random_order', null: false end diff --git a/db/migrate/20200521143523_add_ignore_assessment_required_to_settings.rb b/db/migrate/20200521143523_add_ignore_assessment_required_to_settings.rb index 9dcff0c5eb..fc2463e2a9 100644 --- a/db/migrate/20200521143523_add_ignore_assessment_required_to_settings.rb +++ b/db/migrate/20200521143523_add_ignore_assessment_required_to_settings.rb @@ -1,4 +1,4 @@ -class AddIgnoreAssessmentRequiredToSettings < ActiveRecord::Migration +class AddIgnoreAssessmentRequiredToSettings < ActiveRecord::Migration[5.2] def change add_column :settings, :disable_required_fields, :boolean, default: false, null: false end diff --git a/db/migrate/20200521174221_add_delete_incomplete_after_period_to_settings.rb b/db/migrate/20200521174221_add_delete_incomplete_after_period_to_settings.rb index 7ccc273ae8..30f9bf0d27 100644 --- a/db/migrate/20200521174221_add_delete_incomplete_after_period_to_settings.rb +++ b/db/migrate/20200521174221_add_delete_incomplete_after_period_to_settings.rb @@ -1,4 +1,4 @@ -class AddDeleteIncompleteAfterPeriodToSettings < ActiveRecord::Migration +class AddDeleteIncompleteAfterPeriodToSettings < ActiveRecord::Migration[5.2] def change add_column :settings, :never_delete_incomplete_assessment, :boolean, null: false, default: false add_column :settings, :delete_incomplete_after_period_value, :integer, default: 7 diff --git a/db/migrate/20200522142638_add_government_form_to_field_setting.rb b/db/migrate/20200522142638_add_government_form_to_field_setting.rb index 3cacd19012..7a3f54e7f3 100644 --- a/db/migrate/20200522142638_add_government_form_to_field_setting.rb +++ b/db/migrate/20200522142638_add_government_form_to_field_setting.rb @@ -1,6 +1,6 @@ -class AddGovernmentFormToFieldSetting < ActiveRecord::Migration +class AddGovernmentFormToFieldSetting < ActiveRecord::Migration[5.2] def up - return if Apartment::Tenant.current_tenant == 'shared' + return if Apartment::Tenant.current == 'shared' FieldSetting.create( name: :government_forms, @@ -8,7 +8,7 @@ def up current_label: 'Government Forms', klass_name: :client, required: false, - visible: %w(brc ratanak).exclude?(Apartment::Tenant.current_tenant), + visible: %w(brc ratanak).exclude?(Apartment::Tenant.current), group: :client ) end diff --git a/db/migrate/20200525030557_add_assessment_field_setting.rb b/db/migrate/20200525030557_add_assessment_field_setting.rb index b58aee55c0..0dc5d3fea4 100644 --- a/db/migrate/20200525030557_add_assessment_field_setting.rb +++ b/db/migrate/20200525030557_add_assessment_field_setting.rb @@ -1,6 +1,6 @@ -class AddAssessmentFieldSetting < ActiveRecord::Migration +class AddAssessmentFieldSetting < ActiveRecord::Migration[5.2] def up - return if Apartment::Tenant.current_tenant == 'shared' + return if Apartment::Tenant.current == 'shared' field_setting = FieldSetting.create!( name: :reason, @@ -11,7 +11,7 @@ def up group: :assessment ) - field_setting.update!(label: 'Review current need') if Apartment::Tenant.current_tenant == 'ratanak' + field_setting.update!(label: 'Review current need') if Apartment::Tenant.current == 'ratanak' end def down diff --git a/db/migrate/20200526080908_add_documents_to_clients.rb b/db/migrate/20200526080908_add_documents_to_clients.rb index bd87ea992a..7148a3dad2 100644 --- a/db/migrate/20200526080908_add_documents_to_clients.rb +++ b/db/migrate/20200526080908_add_documents_to_clients.rb @@ -1,4 +1,4 @@ -class AddDocumentsToClients < ActiveRecord::Migration +class AddDocumentsToClients < ActiveRecord::Migration[5.2] def change add_column :clients, :national_id, :boolean, default: false, null: false add_column :clients, :birth_cert, :boolean, default: false, null: false diff --git a/db/migrate/20200526082659_add_documents_to_field_settings.rb b/db/migrate/20200526082659_add_documents_to_field_settings.rb index fd4eff7767..b9e1ed1598 100644 --- a/db/migrate/20200526082659_add_documents_to_field_settings.rb +++ b/db/migrate/20200526082659_add_documents_to_field_settings.rb @@ -1,4 +1,4 @@ -class AddDocumentsToFieldSettings < ActiveRecord::Migration +class AddDocumentsToFieldSettings < ActiveRecord::Migration[5.2] FIELDS = { :national_id => 'National ID', :birth_cert => 'Birth Certificate', @@ -12,7 +12,7 @@ class AddDocumentsToFieldSettings < ActiveRecord::Migration } def up - return if Apartment::Tenant.current_tenant == 'shared' + return if Apartment::Tenant.current == 'shared' FIELDS.each do |name, label| field_setting = FieldSetting.create!( @@ -21,7 +21,7 @@ def up label: label, klass_name: :client, required: false, - visible: (Apartment::Tenant.current_tenant == 'ratanak'), + visible: (Apartment::Tenant.current == 'ratanak'), group: :client ) end diff --git a/db/migrate/20200526091702_add_taskable_to_task.rb b/db/migrate/20200526091702_add_taskable_to_task.rb index 86035252b4..3ff676c04c 100644 --- a/db/migrate/20200526091702_add_taskable_to_task.rb +++ b/db/migrate/20200526091702_add_taskable_to_task.rb @@ -1,4 +1,4 @@ -class AddTaskableToTask < ActiveRecord::Migration +class AddTaskableToTask < ActiveRecord::Migration[5.2] def change add_reference :tasks, :taskable, polymorphic: true, index: true diff --git a/db/migrate/20200528053755_update_gender_setting.rb b/db/migrate/20200528053755_update_gender_setting.rb index dd1fdf2f3f..2494a6f2fe 100644 --- a/db/migrate/20200528053755_update_gender_setting.rb +++ b/db/migrate/20200528053755_update_gender_setting.rb @@ -1,4 +1,4 @@ -class UpdateGenderSetting < ActiveRecord::Migration +class UpdateGenderSetting < ActiveRecord::Migration[5.2] def up FieldSetting.where(name: :gender, klass_name: :client).update_all(required: true) end diff --git a/db/migrate/20200603071312_add_field_to_task.rb b/db/migrate/20200603071312_add_field_to_task.rb index f128d43060..a738181b03 100644 --- a/db/migrate/20200603071312_add_field_to_task.rb +++ b/db/migrate/20200603071312_add_field_to_task.rb @@ -1,4 +1,4 @@ -class AddFieldToTask < ActiveRecord::Migration +class AddFieldToTask < ActiveRecord::Migration[5.2] def change add_column :tasks, :deleted_at, :datetime add_index :tasks, :deleted_at diff --git a/db/migrate/20200603081325_add_service_type.rb b/db/migrate/20200603081325_add_service_type.rb index 3e1104ea6c..8976080020 100644 --- a/db/migrate/20200603081325_add_service_type.rb +++ b/db/migrate/20200603081325_add_service_type.rb @@ -1,4 +1,4 @@ -class AddServiceType < ActiveRecord::Migration +class AddServiceType < ActiveRecord::Migration[5.2] def up service = Service.find_by(name: 'Training and Education') Service.find_or_create_by(name: 'Literacy Support', parent_id: service.id) if service diff --git a/db/migrate/20200609042124_added_support_languages_to_instances.rb b/db/migrate/20200609042124_added_support_languages_to_instances.rb index d2951c2661..c498f324a3 100644 --- a/db/migrate/20200609042124_added_support_languages_to_instances.rb +++ b/db/migrate/20200609042124_added_support_languages_to_instances.rb @@ -1,4 +1,4 @@ -class AddedSupportLanguagesToInstances < ActiveRecord::Migration +class AddedSupportLanguagesToInstances < ActiveRecord::Migration[5.2] def change add_column :organizations, :supported_languages, :string, default: ['km', 'en', 'my'], array: true end diff --git a/db/migrate/20200611041442_remove_field_services_from_referrals.rb b/db/migrate/20200611041442_remove_field_services_from_referrals.rb index 5b2aecbaf6..cc0fdb5efd 100644 --- a/db/migrate/20200611041442_remove_field_services_from_referrals.rb +++ b/db/migrate/20200611041442_remove_field_services_from_referrals.rb @@ -1,4 +1,4 @@ -class RemoveFieldServicesFromReferrals < ActiveRecord::Migration +class RemoveFieldServicesFromReferrals < ActiveRecord::Migration[5.2] def change remove_column :referrals, :services, :string end diff --git a/db/migrate/20200611080519_add_token_to_admin_users.rb b/db/migrate/20200611080519_add_token_to_admin_users.rb index 66351a7790..994f292da3 100644 --- a/db/migrate/20200611080519_add_token_to_admin_users.rb +++ b/db/migrate/20200611080519_add_token_to_admin_users.rb @@ -1,4 +1,4 @@ -class AddTokenToAdminUsers < ActiveRecord::Migration +class AddTokenToAdminUsers < ActiveRecord::Migration[5.2] def change add_column :admin_users, :token, :string end diff --git a/db/migrate/20200618080326_add_first_name_to_admin_users.rb b/db/migrate/20200618080326_add_first_name_to_admin_users.rb index 593ea9998a..f74559ac55 100644 --- a/db/migrate/20200618080326_add_first_name_to_admin_users.rb +++ b/db/migrate/20200618080326_add_first_name_to_admin_users.rb @@ -1,4 +1,4 @@ -class AddFirstNameToAdminUsers < ActiveRecord::Migration +class AddFirstNameToAdminUsers < ActiveRecord::Migration[5.2] def change add_column :admin_users, :first_name, :string add_column :admin_users, :last_name, :string diff --git a/db/migrate/20200625042951_alter_tasks_client_id_contrain.rb b/db/migrate/20200625042951_alter_tasks_client_id_contrain.rb index ab83974f65..34f18f9b9e 100644 --- a/db/migrate/20200625042951_alter_tasks_client_id_contrain.rb +++ b/db/migrate/20200625042951_alter_tasks_client_id_contrain.rb @@ -1,4 +1,4 @@ -class AlterTasksClientIdContrain < ActiveRecord::Migration +class AlterTasksClientIdContrain < ActiveRecord::Migration[5.2] def up if index_exists?(:tasks, :client_id, name: "index_tasks_on_client_id") execute <<-SQL.squish diff --git a/db/migrate/20200626090546_add_client_agreegation_to_organizations.rb b/db/migrate/20200626090546_add_client_agreegation_to_organizations.rb index e8d6416b34..e35a53f586 100644 --- a/db/migrate/20200626090546_add_client_agreegation_to_organizations.rb +++ b/db/migrate/20200626090546_add_client_agreegation_to_organizations.rb @@ -1,4 +1,4 @@ -class AddClientAgreegationToOrganizations < ActiveRecord::Migration +class AddClientAgreegationToOrganizations < ActiveRecord::Migration[5.2] def change add_column :organizations, :clients_count, :integer, default: 0 add_column :organizations, :active_client, :integer, default: 0 diff --git a/db/migrate/20200629053513_add_demo_to_organizations.rb b/db/migrate/20200629053513_add_demo_to_organizations.rb index 72f15820c2..460a0b308f 100644 --- a/db/migrate/20200629053513_add_demo_to_organizations.rb +++ b/db/migrate/20200629053513_add_demo_to_organizations.rb @@ -1,4 +1,4 @@ -class AddDemoToOrganizations < ActiveRecord::Migration +class AddDemoToOrganizations < ActiveRecord::Migration[5.2] def change add_column :organizations, :demo, :boolean, default: false diff --git a/db/migrate/20200702041127_remove_foreign_key_to_global_identity_organizations.rb b/db/migrate/20200702041127_remove_foreign_key_to_global_identity_organizations.rb index de3c1e6a2f..6a677d3bcb 100644 --- a/db/migrate/20200702041127_remove_foreign_key_to_global_identity_organizations.rb +++ b/db/migrate/20200702041127_remove_foreign_key_to_global_identity_organizations.rb @@ -1,4 +1,4 @@ -class RemoveForeignKeyToGlobalIdentityOrganizations < ActiveRecord::Migration +class RemoveForeignKeyToGlobalIdentityOrganizations < ActiveRecord::Migration[5.2] def up remove_foreign_key :global_identity_organizations, column: :global_id if foreign_keys(:global_identity_organizations).map(&:column).include?("global_id") end diff --git a/db/migrate/20200707035255_add_additional_fields_to_clients.rb b/db/migrate/20200707035255_add_additional_fields_to_clients.rb index 2b62ea487a..bbc1f0f5b3 100644 --- a/db/migrate/20200707035255_add_additional_fields_to_clients.rb +++ b/db/migrate/20200707035255_add_additional_fields_to_clients.rb @@ -1,4 +1,4 @@ -class AddAdditionalFieldsToClients < ActiveRecord::Migration +class AddAdditionalFieldsToClients < ActiveRecord::Migration[5.2] def change add_column :clients, :marital_status, :string add_column :clients, :nationality, :string diff --git a/db/migrate/20200707042500_add_field_setting_data.rb b/db/migrate/20200707042500_add_field_setting_data.rb index b14aa51a63..3b6647da8f 100644 --- a/db/migrate/20200707042500_add_field_setting_data.rb +++ b/db/migrate/20200707042500_add_field_setting_data.rb @@ -1,4 +1,4 @@ -class AddFieldSettingData < ActiveRecord::Migration +class AddFieldSettingData < ActiveRecord::Migration[5.2] NEW_FIELDS = { marital_status: { label: 'Marital Status' @@ -63,7 +63,7 @@ class AddFieldSettingData < ActiveRecord::Migration } def up - return if Apartment::Tenant.current_tenant == 'shared' + return if Apartment::Tenant.current == 'shared' NEW_FIELDS.each do |name, data| field_setting = FieldSetting.create!( @@ -72,7 +72,7 @@ def up label: data[:label], klass_name: :client, required: false, - visible: (Apartment::Tenant.current_tenant == 'ratanak'), + visible: (Apartment::Tenant.current == 'ratanak'), group: data[:group] || :client ) end @@ -82,7 +82,7 @@ def up name: name, klass_name: :client, required: false, - visible: (Apartment::Tenant.current_tenant != 'ratanak'), + visible: (Apartment::Tenant.current != 'ratanak'), group: data[:group] || :client, current_label: data[:current_label] ) @@ -92,7 +92,7 @@ def up field_setting = FieldSetting.create!( name: name, klass_name: data[:klass_name].presence || :client, - label: (Apartment::Tenant.current_tenant == 'ratanak' ? data[:new_label] : nil), + label: (Apartment::Tenant.current == 'ratanak' ? data[:new_label] : nil), required: false, visible: true, group: data[:group].presence || :client, diff --git a/db/migrate/20200710030444_update_data.rb b/db/migrate/20200710030444_update_data.rb index 67affbd69c..11c339ec6f 100644 --- a/db/migrate/20200710030444_update_data.rb +++ b/db/migrate/20200710030444_update_data.rb @@ -1,10 +1,10 @@ -class UpdateData < ActiveRecord::Migration +class UpdateData < ActiveRecord::Migration[5.2] def up - return if Apartment::Tenant.current_tenant == 'shared' + return if Apartment::Tenant.current == 'shared' FieldSetting.where(name: :client_school_information).delete_all - if Apartment::Tenant.current_tenant == 'brc' + if Apartment::Tenant.current == 'brc' FieldSetting.where(name: [:school_name, :school_grade, :main_school_contact, :education_background]).update_all(visible: false) end end diff --git a/db/migrate/20200710032429_add_label_only_to_field_settings.rb b/db/migrate/20200710032429_add_label_only_to_field_settings.rb index 35a452a1e3..81954fe350 100644 --- a/db/migrate/20200710032429_add_label_only_to_field_settings.rb +++ b/db/migrate/20200710032429_add_label_only_to_field_settings.rb @@ -1,4 +1,4 @@ -class AddLabelOnlyToFieldSettings < ActiveRecord::Migration +class AddLabelOnlyToFieldSettings < ActiveRecord::Migration[5.2] def change add_column :field_settings, :label_only, :boolean, default: false end diff --git a/db/migrate/20200710033402_add_label_data_to_field_settings.rb b/db/migrate/20200710033402_add_label_data_to_field_settings.rb index e4b07a58a6..3ac68faed7 100644 --- a/db/migrate/20200710033402_add_label_data_to_field_settings.rb +++ b/db/migrate/20200710033402_add_label_data_to_field_settings.rb @@ -1,4 +1,4 @@ -class AddLabelDataToFieldSettings < ActiveRecord::Migration +class AddLabelDataToFieldSettings < ActiveRecord::Migration[5.2] FIELDS = { referee_address: { group: :referee, @@ -27,13 +27,13 @@ class AddLabelDataToFieldSettings < ActiveRecord::Migration } def up - return if Apartment::Tenant.current_tenant == 'shared' + return if Apartment::Tenant.current == 'shared' FIELDS.each do |name, data| field_setting = FieldSetting.create!( name: name, current_label: data[:current_label], - label: (Apartment::Tenant.current_tenant == 'ratanak' ? data[:label] : nil), + label: (Apartment::Tenant.current == 'ratanak' ? data[:label] : nil), klass_name: data[:klass_name], required: true, label_only: true, diff --git a/db/migrate/20200710122049_add_assessment_label.rb b/db/migrate/20200710122049_add_assessment_label.rb index 8d517a1eb0..092efcfee4 100644 --- a/db/migrate/20200710122049_add_assessment_label.rb +++ b/db/migrate/20200710122049_add_assessment_label.rb @@ -1,11 +1,11 @@ -class AddAssessmentLabel < ActiveRecord::Migration +class AddAssessmentLabel < ActiveRecord::Migration[5.2] def up - return if Apartment::Tenant.current_tenant == 'shared' + return if Apartment::Tenant.current == 'shared' FieldSetting.create!( name: :assessment, current_label: 'Assessment', - label: (Apartment::Tenant.current_tenant == 'ratanak' ? 'Assessment Matrix' : nil), + label: (Apartment::Tenant.current == 'ratanak' ? 'Assessment Matrix' : nil), klass_name: :assessment, required: true, label_only: true, diff --git a/db/migrate/20200711153900_add_stack_holder_to_clients.rb b/db/migrate/20200711153900_add_stack_holder_to_clients.rb index 2720a9d103..9a48c22a5c 100644 --- a/db/migrate/20200711153900_add_stack_holder_to_clients.rb +++ b/db/migrate/20200711153900_add_stack_holder_to_clients.rb @@ -1,4 +1,4 @@ -class AddStackHolderToClients < ActiveRecord::Migration +class AddStackHolderToClients < ActiveRecord::Migration[5.2] def change add_column :clients, :neighbor_name, :string add_column :clients, :neighbor_phone, :string diff --git a/db/migrate/20200713035828_add_stack_holder_data_to_field_settings.rb b/db/migrate/20200713035828_add_stack_holder_data_to_field_settings.rb index 6a26137410..6ab3e4afc5 100644 --- a/db/migrate/20200713035828_add_stack_holder_data_to_field_settings.rb +++ b/db/migrate/20200713035828_add_stack_holder_data_to_field_settings.rb @@ -1,4 +1,4 @@ -class AddStackHolderDataToFieldSettings < ActiveRecord::Migration +class AddStackHolderDataToFieldSettings < ActiveRecord::Migration[5.2] FIELDS = [ :stakeholder_contacts, :neighbor_name, @@ -20,14 +20,14 @@ class AddStackHolderDataToFieldSettings < ActiveRecord::Migration ] def up - return if Apartment::Tenant.current_tenant == 'shared' + return if Apartment::Tenant.current == 'shared' FIELDS.each do |name| field_setting = FieldSetting.create!( name: name, current_label: I18n.t("clients.form.#{name}"), klass_name: :client, - visible: Apartment::Tenant.current_tenant == 'ratanak', + visible: Apartment::Tenant.current == 'ratanak', group: :stakeholder_contacts ) end diff --git a/db/migrate/20200714092201_add_case_notes_note_label.rb b/db/migrate/20200714092201_add_case_notes_note_label.rb index a555497b85..0ca64837a5 100644 --- a/db/migrate/20200714092201_add_case_notes_note_label.rb +++ b/db/migrate/20200714092201_add_case_notes_note_label.rb @@ -1,11 +1,11 @@ -class AddCaseNotesNoteLabel < ActiveRecord::Migration +class AddCaseNotesNoteLabel < ActiveRecord::Migration[5.2] def up - return if Apartment::Tenant.current_tenant == 'shared' + return if Apartment::Tenant.current == 'shared' FieldSetting.create!( name: :note, current_label: 'Note', - label: (Apartment::Tenant.current_tenant == 'ratanak' ? 'Progress notes and next steps' : nil), + label: (Apartment::Tenant.current == 'ratanak' ? 'Progress notes and next steps' : nil), klass_name: :case_note, required: true, visible: true, diff --git a/db/migrate/20200719232917_add_use_screening_assessment_to_settings.rb b/db/migrate/20200719232917_add_use_screening_assessment_to_settings.rb index f0529691b5..0ff707736f 100644 --- a/db/migrate/20200719232917_add_use_screening_assessment_to_settings.rb +++ b/db/migrate/20200719232917_add_use_screening_assessment_to_settings.rb @@ -1,4 +1,4 @@ -class AddUseScreeningAssessmentToSettings < ActiveRecord::Migration +class AddUseScreeningAssessmentToSettings < ActiveRecord::Migration[5.2] def change add_column :settings, :use_screening_assessment, :boolean, default: false add_column :settings, :screening_assessment_form_id, :integer diff --git a/db/migrate/20200723075102_add_fiel_to_users.rb b/db/migrate/20200723075102_add_fiel_to_users.rb index 205072bed0..e3310dbceb 100644 --- a/db/migrate/20200723075102_add_fiel_to_users.rb +++ b/db/migrate/20200723075102_add_fiel_to_users.rb @@ -1,4 +1,4 @@ -class AddFielToUsers < ActiveRecord::Migration +class AddFielToUsers < ActiveRecord::Migration[5.2] def change add_column :users, :organization_name, :string add_column :users, :profile, :string diff --git a/db/migrate/20200731034640_add_field_to_communes.rb b/db/migrate/20200731034640_add_field_to_communes.rb index 332eb12190..2f9e10cb4a 100644 --- a/db/migrate/20200731034640_add_field_to_communes.rb +++ b/db/migrate/20200731034640_add_field_to_communes.rb @@ -1,4 +1,4 @@ -class AddFieldToCommunes < ActiveRecord::Migration +class AddFieldToCommunes < ActiveRecord::Migration[5.2] def change add_column :communes, :district_type, :string end diff --git a/db/migrate/20200803082706_add_show_prev_assessment_to_settings.rb b/db/migrate/20200803082706_add_show_prev_assessment_to_settings.rb index 26d841aa21..2f450db05a 100644 --- a/db/migrate/20200803082706_add_show_prev_assessment_to_settings.rb +++ b/db/migrate/20200803082706_add_show_prev_assessment_to_settings.rb @@ -1,4 +1,4 @@ -class AddShowPrevAssessmentToSettings < ActiveRecord::Migration +class AddShowPrevAssessmentToSettings < ActiveRecord::Migration[5.2] def change add_column :settings, :show_prev_assessment, :boolean, default: false end diff --git a/db/migrate/20200805063814_add_two_weeks_assessment_reminder_to_settings.rb b/db/migrate/20200805063814_add_two_weeks_assessment_reminder_to_settings.rb index dc481c0d53..17aa851d71 100644 --- a/db/migrate/20200805063814_add_two_weeks_assessment_reminder_to_settings.rb +++ b/db/migrate/20200805063814_add_two_weeks_assessment_reminder_to_settings.rb @@ -1,4 +1,4 @@ -class AddTwoWeeksAssessmentReminderToSettings < ActiveRecord::Migration +class AddTwoWeeksAssessmentReminderToSettings < ActiveRecord::Migration[5.2] def change add_column :settings, :two_weeks_assessment_reminder, :boolean, default: false end diff --git a/db/migrate/20200810055448_add_passport_to_clients.rb b/db/migrate/20200810055448_add_passport_to_clients.rb index 1336e3aae3..9258293e8a 100644 --- a/db/migrate/20200810055448_add_passport_to_clients.rb +++ b/db/migrate/20200810055448_add_passport_to_clients.rb @@ -1,8 +1,8 @@ -class AddPassportToClients < ActiveRecord::Migration +class AddPassportToClients < ActiveRecord::Migration[5.2] FIELDS = [ :national_id_number, :passport_number - ] + ] def change add_column :clients, :national_id_number, :string @@ -11,13 +11,13 @@ def change reversible do |dir| dir.up do - if Apartment::Tenant.current_tenant != 'shared' + if Apartment::Tenant.current != 'shared' FIELDS.each do |name| field_setting = FieldSetting.create!( name: name, current_label: I18n.t("clients.form.#{name}"), klass_name: :client, - visible: Apartment::Tenant.current_tenant == 'ratanak', + visible: Apartment::Tenant.current == 'ratanak', group: :client ) end @@ -29,4 +29,4 @@ def change end end end -end \ No newline at end of file +end diff --git a/db/migrate/20200810064734_add_field_to_clients.rb b/db/migrate/20200810064734_add_field_to_clients.rb index 9fe515bf2f..8d5c3e640d 100644 --- a/db/migrate/20200810064734_add_field_to_clients.rb +++ b/db/migrate/20200810064734_add_field_to_clients.rb @@ -1,4 +1,4 @@ -class AddFieldToClients < ActiveRecord::Migration +class AddFieldToClients < ActiveRecord::Migration[5.2] def change add_column :clients, :locality, :string end diff --git a/db/migrate/20200810070640_add_caregiver_label_data.rb b/db/migrate/20200810070640_add_caregiver_label_data.rb index 35c72b522a..b2230d9fdf 100644 --- a/db/migrate/20200810070640_add_caregiver_label_data.rb +++ b/db/migrate/20200810070640_add_caregiver_label_data.rb @@ -1,11 +1,11 @@ -class AddCaregiverLabelData < ActiveRecord::Migration +class AddCaregiverLabelData < ActiveRecord::Migration[5.2] def up - return if Apartment::Tenant.current_tenant == 'shared' + return if Apartment::Tenant.current == 'shared' FieldSetting.create!( name: :email, current_label: 'Carer Email Address', - label: (Apartment::Tenant.current_tenant == 'ratanak' ? 'Caregiver Email Address' : nil), + label: (Apartment::Tenant.current == 'ratanak' ? 'Caregiver Email Address' : nil), klass_name: :carer, visible: true, group: :carer diff --git a/db/migrate/20200810071756_add_field_to_carers.rb b/db/migrate/20200810071756_add_field_to_carers.rb index 6b2819ec7d..d5cfd394de 100644 --- a/db/migrate/20200810071756_add_field_to_carers.rb +++ b/db/migrate/20200810071756_add_field_to_carers.rb @@ -1,4 +1,4 @@ -class AddFieldToCarers < ActiveRecord::Migration +class AddFieldToCarers < ActiveRecord::Migration[5.2] def change add_column :carers, :locality, :string end diff --git a/db/migrate/20200810071821_add_field_to_referees.rb b/db/migrate/20200810071821_add_field_to_referees.rb index b480bcb3a0..aefbe7f847 100644 --- a/db/migrate/20200810071821_add_field_to_referees.rb +++ b/db/migrate/20200810071821_add_field_to_referees.rb @@ -1,4 +1,4 @@ -class AddFieldToReferees < ActiveRecord::Migration +class AddFieldToReferees < ActiveRecord::Migration[5.2] def change add_column :referees, :locality, :string end diff --git a/db/migrate/20201007034425_devise_token_auth_create_admin_users.rb b/db/migrate/20201007034425_devise_token_auth_create_admin_users.rb index 89fa1a1277..409a96ade7 100644 --- a/db/migrate/20201007034425_devise_token_auth_create_admin_users.rb +++ b/db/migrate/20201007034425_devise_token_auth_create_admin_users.rb @@ -1,4 +1,4 @@ -class DeviseTokenAuthCreateAdminUsers < ActiveRecord::Migration +class DeviseTokenAuthCreateAdminUsers < ActiveRecord::Migration[5.2] def change add_column :admin_users, :provider, :string, null: false, default: 'email' add_column :admin_users, :uid, :string, null: false, default: '' diff --git a/db/migrate/20201020063259_add_referral_source_category_id_to_organizations.rb b/db/migrate/20201020063259_add_referral_source_category_id_to_organizations.rb index 3dcd136d24..63f6101614 100644 --- a/db/migrate/20201020063259_add_referral_source_category_id_to_organizations.rb +++ b/db/migrate/20201020063259_add_referral_source_category_id_to_organizations.rb @@ -1,4 +1,4 @@ -class AddReferralSourceCategoryIdToOrganizations < ActiveRecord::Migration +class AddReferralSourceCategoryIdToOrganizations < ActiveRecord::Migration[5.2] def change add_column :organizations, :referral_source_category_name, :string end diff --git a/db/migrate/20201203072103_add_referee_email_to_referrals.rb b/db/migrate/20201203072103_add_referee_email_to_referrals.rb index ee48cf4293..4ca60961db 100644 --- a/db/migrate/20201203072103_add_referee_email_to_referrals.rb +++ b/db/migrate/20201203072103_add_referee_email_to_referrals.rb @@ -1,4 +1,4 @@ -class AddRefereeEmailToReferrals < ActiveRecord::Migration +class AddRefereeEmailToReferrals < ActiveRecord::Migration[5.2] def change add_column :referrals, :referee_email, :string end diff --git a/db/migrate/20201214014711_add_foreign_type_to_version_associations.rb b/db/migrate/20201214014711_add_foreign_type_to_version_associations.rb index 8d8243d713..1ad0e8e1e5 100644 --- a/db/migrate/20201214014711_add_foreign_type_to_version_associations.rb +++ b/db/migrate/20201214014711_add_foreign_type_to_version_associations.rb @@ -6,7 +6,9 @@ def self.up remove_index :version_associations, name: "index_version_associations_on_foreign_key" if index_exists?(:version_associations, [:foreign_key_name, :foreign_key_id]) - remove_index :version_associations, column: [:foreign_key_name, :foreign_key_id] if index_exists?(:version_associations, [:foreign_key_name, :foreign_key_id]) + remove_index :version_associations, column: %i(foreign_key_name foreign_key_id foreign_type) if index_exists?(:version_associations, %i(foreign_key_name foreign_key_id foreign_type), name: "index_version_associations_on_foreign_key") + + remove_index :version_associations, column: [:foreign_key_name, :foreign_key_id] if index_exists?(:version_associations, [:foreign_key_name, :foreign_key_id]) || index_exists?(:version_associations, [:foreign_key_name, :foreign_key_id], name: "index_version_associations_on_foreign_key") add_index :version_associations, %i(foreign_key_name foreign_key_id foreign_type), diff --git a/lib/tasks/import_field_settings.rake b/lib/tasks/import_field_settings.rake index b213fa9454..0365e012e3 100644 --- a/lib/tasks/import_field_settings.rake +++ b/lib/tasks/import_field_settings.rake @@ -37,8 +37,8 @@ namespace :field_settings do create_legal_doc_settting [20200707042500, 20200710033402, 20200710122049, 20200713035828, 20200714092201, 20200810055448, 20200810070640].each do |migration_version| - ActiveRecord::Migrator.run(:down, ActiveRecord::Migrator.migrations_path, migration_version) - ActiveRecord::Migrator.run(:up, ActiveRecord::Migrator.migrations_path, migration_version) + ActiveRecord::MigrationContext.new( ActiveRecord::Tasks::DatabaseTasks.migrations_paths ).down( migration_version ) + ActiveRecord::MigrationContext.new( ActiveRecord::Tasks::DatabaseTasks.migrations_paths ).up( migration_version ) end end end @@ -52,7 +52,7 @@ namespace :field_settings do current_label: 'Government Forms', klass_name: :client, required: false, - visible: %w(brc ratanak).exclude?(Apartment::Tenant.current_tenant), + visible: %w(brc ratanak).exclude?(Apartment::Tenant.current), group: :client ) end @@ -67,7 +67,7 @@ namespace :field_settings do group: :assessment ) - field_setting.update!(label: 'Review current need') if Apartment::Tenant.current_tenant == 'ratanak' + field_setting.update!(label: 'Review current need') if Apartment::Tenant.current == 'ratanak' end def create_legal_doc_settting @@ -89,7 +89,7 @@ namespace :field_settings do current_label: label, label: label, required: false, - visible: (Apartment::Tenant.current_tenant == 'ratanak'), + visible: (Apartment::Tenant.current == 'ratanak'), group: :client ) end diff --git a/lib/tasks/tenant_data.rake b/lib/tasks/tenant_data.rake index 338ebe6ae9..1c50483194 100644 --- a/lib/tasks/tenant_data.rake +++ b/lib/tasks/tenant_data.rake @@ -8,7 +8,7 @@ namespace :tenant_data do sql = "DELETE FROM shared.shared_clients WHERE shared.shared_clients.archived_slug iLIKE '#{short_name}-%';" ActiveRecord::Base.connection.execute(sql) puts "Clean shared_clients done!" - system("PGPASSWORD=#{ENV['DATABASE_PASSWORD']} psql #{ENV['DATABASE_NAME']} -U #{ENV['DATABASE_USER']} -h #{ENV['DATABASE_HOST']} -p #{ENV['DATABASE_PORT']} < #{short_name}_development_2020_09_03.dump") + system("PGPASSWORD=#{ENV['DATABASE_PASSWORD']} psql #{ENV['DATABASE_NAME']} -U #{ENV['DATABASE_USER']} -h #{ENV['DATABASE_HOST']} -p #{ENV['DATABASE_PORT']} < #{short_name}_production_2020_12_21.dump") puts "Restore schema done!!!" Rake::Task["rake:db:migrate"].invoke() puts "Migration done!!!" From b987bf0bc045c75de4c42f456340b8ad8b50390e Mon Sep 17 00:00:00 2001 From: kirykr Date: Mon, 21 Dec 2020 16:53:10 +0700 Subject: [PATCH 14/27] fixed thredded BaseMigration --- config/application.rb | 2 +- config/database.yml | 2 +- .../20160723012349_upgrade_v0_6_to_v0_7.rb | 46 +++ .../20161019150201_upgrade_v0_7_to_v0_8.rb | 34 ++ db/schema.rb | 356 ++++++++---------- 5 files changed, 235 insertions(+), 205 deletions(-) create mode 100644 db/migrate/20160723012349_upgrade_v0_6_to_v0_7.rb create mode 100644 db/migrate/20161019150201_upgrade_v0_7_to_v0_8.rb diff --git a/config/application.rb b/config/application.rb index f23491beb5..846b903c1b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,6 @@ require_relative 'boot' -require 'rails/all' +require 'rails' # Pick the frameworks you want: require 'active_model/railtie' diff --git a/config/database.yml b/config/database.yml index db477f416b..4b717dde84 100644 --- a/config/database.yml +++ b/config/database.yml @@ -5,7 +5,7 @@ default: &default host: <%= ENV['DATABASE_HOST'] %> username: <%= ENV['DATABASE_USER'] %> password: <%= ENV['DATABASE_PASSWORD'] %> - schema_search_path: "dev,cif,newsmile,public,shared_extensions" + schema_search_path: "public,shared_extensions" development: <<: *default diff --git a/db/migrate/20160723012349_upgrade_v0_6_to_v0_7.rb b/db/migrate/20160723012349_upgrade_v0_6_to_v0_7.rb new file mode 100644 index 0000000000..197e0133e6 --- /dev/null +++ b/db/migrate/20160723012349_upgrade_v0_6_to_v0_7.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +require 'thredded/base_migration' + +class UpgradeV06ToV07 < Thredded::BaseMigration + def up + Thredded::MessageboardGroup.transaction do + Thredded::MessageboardGroup.where( + name: Thredded::MessageboardGroup.group(:name).having('count(id) > 1').select(:name) + ).group_by(&:name).each_value do |messageboard_groups| + messageboard_groups.from(1).each_with_index do |messageboard_group, i| + messageboard_group.update!(name: "#{messageboard_group.name}-#{i + 1}") + end + end + end + + add_index :thredded_messageboard_groups, + :name, + unique: true, + name: :index_thredded_messageboard_group_on_name + + add_column :thredded_topics, :last_post_at, :datetime + add_column :thredded_private_topics, :last_post_at, :datetime + # update existing values to pretty accurate match + Thredded::Topic.update_all('last_post_at = updated_at') + Thredded::PrivateTopic.update_all('last_post_at = updated_at') + + add_column :thredded_messageboards, :position, :integer + Thredded::Messageboard.reset_column_information + Thredded::Messageboard.all.each { |m| m.update_column(:position, m.created_at.to_i) } + change_column :thredded_messageboards, :position, :integer, null: false + + add_column :thredded_messageboard_groups, :position, :integer + Thredded::MessageboardGroup.reset_column_information + Thredded::MessageboardGroup.all.each { |mg| mg.update_column(:position, mg.created_at.to_i) } + change_column :thredded_messageboard_groups, :position, :integer, null: false + end + + def down + remove_index :thredded_messageboard_groups, name: :index_thredded_messageboard_group_on_name + remove_column :thredded_topics, :last_post_at + remove_column :thredded_private_topics, :last_post_at + remove_column :thredded_messageboards, :position + remove_column :thredded_messageboard_groups, :position + end +end diff --git a/db/migrate/20161019150201_upgrade_v0_7_to_v0_8.rb b/db/migrate/20161019150201_upgrade_v0_7_to_v0_8.rb new file mode 100644 index 0000000000..4d91ac79c8 --- /dev/null +++ b/db/migrate/20161019150201_upgrade_v0_7_to_v0_8.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require 'thredded/base_migration' + +class UpgradeV07ToV08 < Thredded::BaseMigration + def up + closed_messageboards = Thredded::Messageboard.unscoped.where(closed: true).to_a + if closed_messageboards.present? + fail ActiveRecord::MigrationError, <<-TEXT +There are #{closed_messageboards.length} closed Messageboards: +#{closed_messageboards.map { |m| "#{m.name} (id=#{m.id})" }.join("\n")} +Support for closed messageboards has been removed in thredded v0.8.0. +Delete or un-close these messageboards and consider using the "paranoia" gem to support soft deletion instead. + TEXT + end + remove_index :thredded_messageboards, name: :index_thredded_messageboards_on_closed if index_exists?(:thredded_messageboards, name: :index_thredded_messageboards_on_closed) + remove_column :thredded_messageboards, :closed + add_column :thredded_user_preferences, :followed_topic_emails, :boolean, default: true, null: false + add_column :thredded_user_messageboard_preferences, :followed_topic_emails, :boolean, default: true, null: false + rename_column :thredded_user_preferences, :notify_on_mention, :follow_topics_on_mention + rename_column :thredded_user_messageboard_preferences, :notify_on_mention, :follow_topics_on_mention + change_column :thredded_messageboards, :name, :string, limit: 191 + end + + def down + change_column :thredded_messageboards, :name, :string, limit: 255 + rename_column :thredded_user_messageboard_preferences, :follow_topics_on_mention, :notify_on_mention + rename_column :thredded_user_preferences, :follow_topics_on_mention, :notify_on_mention + remove_column :thredded_user_messageboard_preferences, :followed_topic_emails + remove_column :thredded_user_preferences, :followed_topic_emails + add_column :thredded_messageboards, :closed, :boolean, default: false, null: false + add_index :thredded_messageboards, :closed, name: :index_thredded_messageboards_on_closed + end +end diff --git a/db/schema.rb b/db/schema.rb index fa0fb74618..054486f800 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -18,7 +18,7 @@ enable_extension "plpgsql" enable_extension "uuid-ossp" - create_table "able_screening_questions", force: :cascade do |t| + create_table "able_screening_questions", id: :serial, force: :cascade do |t| t.string "question" t.string "mode" t.integer "stage_id" @@ -30,7 +30,7 @@ t.index ["stage_id"], name: "index_able_screening_questions_on_stage_id" end - create_table "action_results", force: :cascade do |t| + create_table "action_results", id: :serial, force: :cascade do |t| t.text "action", default: "" t.text "result", default: "" t.integer "government_form_id" @@ -39,7 +39,7 @@ t.index ["government_form_id"], name: "index_action_results_on_government_form_id" end - create_table "admin_users", force: :cascade do |t| + create_table "admin_users", id: :serial, force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" @@ -58,7 +58,7 @@ t.index ["uid", "provider"], name: "index_admin_users_on_uid_and_provider", unique: true end - create_table "advanced_searches", force: :cascade do |t| + create_table "advanced_searches", id: :serial, force: :cascade do |t| t.string "name" t.text "description" t.jsonb "queries" @@ -76,7 +76,7 @@ t.index ["user_id"], name: "index_advanced_searches_on_user_id" end - create_table "agencies", force: :cascade do |t| + create_table "agencies", id: :serial, force: :cascade do |t| t.string "name", default: "" t.text "description", default: "" t.datetime "created_at" @@ -84,21 +84,21 @@ t.integer "agencies_clients_count", default: 0 end - create_table "agencies_clients", force: :cascade do |t| + create_table "agencies_clients", id: :serial, force: :cascade do |t| t.integer "client_id" t.integer "agency_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "agency_clients", force: :cascade do |t| + create_table "agency_clients", id: :serial, force: :cascade do |t| t.integer "agency_id" t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "assessment_domains", force: :cascade do |t| + create_table "assessment_domains", id: :serial, force: :cascade do |t| t.text "note", default: "" t.integer "previous_score" t.integer "score" @@ -114,7 +114,7 @@ t.index ["score"], name: "index_assessment_domains_on_score" end - create_table "assessments", force: :cascade do |t| + create_table "assessments", id: :serial, force: :cascade do |t| t.datetime "created_at" t.datetime "updated_at" t.integer "client_id" @@ -123,7 +123,7 @@ t.index ["client_id"], name: "index_assessments_on_client_id" end - create_table "attachments", force: :cascade do |t| + create_table "attachments", id: :serial, force: :cascade do |t| t.string "image" t.integer "able_screening_question_id" t.datetime "created_at", null: false @@ -134,7 +134,7 @@ t.index ["progress_note_id"], name: "index_attachments_on_progress_note_id" end - create_table "calendars", force: :cascade do |t| + create_table "calendars", id: :serial, force: :cascade do |t| t.string "title" t.datetime "start_date" t.datetime "end_date" @@ -145,7 +145,7 @@ t.index ["user_id"], name: "index_calendars_on_user_id" end - create_table "call_necessities", force: :cascade do |t| + create_table "call_necessities", id: :serial, force: :cascade do |t| t.integer "call_id" t.integer "necessity_id" t.datetime "created_at", null: false @@ -154,7 +154,7 @@ t.index ["necessity_id"], name: "index_call_necessities_on_necessity_id" end - create_table "call_protection_concerns", force: :cascade do |t| + create_table "call_protection_concerns", id: :serial, force: :cascade do |t| t.integer "call_id" t.integer "protection_concern_id" t.datetime "created_at", null: false @@ -163,7 +163,7 @@ t.index ["protection_concern_id"], name: "index_call_protection_concerns_on_protection_concern_id" end - create_table "calls", force: :cascade do |t| + create_table "calls", id: :serial, force: :cascade do |t| t.integer "referee_id" t.string "phone_call_id", default: "" t.integer "receiving_staff_id" @@ -183,7 +183,7 @@ t.index ["referee_id"], name: "index_calls_on_referee_id" end - create_table "carers", force: :cascade do |t| + create_table "carers", id: :serial, force: :cascade do |t| t.string "address_type", default: "" t.string "current_address", default: "" t.string "email", default: "" @@ -223,13 +223,13 @@ t.index ["village_id"], name: "index_carers_on_village_id" end - create_table "case_closures", force: :cascade do |t| + create_table "case_closures", id: :serial, force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "case_contracts", force: :cascade do |t| + create_table "case_contracts", id: :serial, force: :cascade do |t| t.date "signed_on" t.integer "case_id" t.datetime "created_at" @@ -237,7 +237,7 @@ t.index ["case_id"], name: "index_case_contracts_on_case_id" end - create_table "case_note_domain_groups", force: :cascade do |t| + create_table "case_note_domain_groups", id: :serial, force: :cascade do |t| t.text "note", default: "" t.integer "case_note_id" t.integer "domain_group_id" @@ -246,7 +246,7 @@ t.string "attachments", default: [], array: true end - create_table "case_notes", force: :cascade do |t| + create_table "case_notes", id: :serial, force: :cascade do |t| t.string "attendee", default: "" t.datetime "meeting_date" t.integer "assessment_id" @@ -262,7 +262,7 @@ t.index ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id" end - create_table "case_worker_clients", force: :cascade do |t| + create_table "case_worker_clients", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "client_id" t.datetime "created_at" @@ -271,7 +271,7 @@ t.index ["user_id"], name: "index_case_worker_clients_on_user_id" end - create_table "case_worker_tasks", force: :cascade do |t| + create_table "case_worker_tasks", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "task_id" t.datetime "created_at" @@ -280,7 +280,7 @@ t.index ["user_id"], name: "index_case_worker_tasks_on_user_id" end - create_table "cases", force: :cascade do |t| + create_table "cases", id: :serial, force: :cascade do |t| t.date "start_date" t.string "carer_names", default: "" t.string "carer_address", default: "" @@ -311,7 +311,7 @@ t.index ["deleted_at"], name: "index_cases_on_deleted_at" end - create_table "changelog_types", force: :cascade do |t| + create_table "changelog_types", id: :serial, force: :cascade do |t| t.integer "changelog_id" t.string "change_type", default: "" t.string "description", default: "" @@ -320,7 +320,7 @@ t.index ["changelog_id"], name: "index_changelog_types_on_changelog_id" end - create_table "changelogs", force: :cascade do |t| + create_table "changelogs", id: :serial, force: :cascade do |t| t.string "change_version", default: "" t.string "description", default: "" t.integer "user_id" @@ -329,13 +329,13 @@ t.index ["user_id"], name: "index_changelogs_on_user_id" end - create_table "children_plans", force: :cascade do |t| + create_table "children_plans", id: :serial, force: :cascade do |t| t.string "name", default: "" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "client_client_types", force: :cascade do |t| + create_table "client_client_types", id: :serial, force: :cascade do |t| t.integer "client_id" t.integer "client_type_id" t.datetime "created_at" @@ -344,7 +344,7 @@ t.index ["client_type_id"], name: "index_client_client_types_on_client_type_id" end - create_table "client_enrollment_trackings", force: :cascade do |t| + create_table "client_enrollment_trackings", id: :serial, force: :cascade do |t| t.jsonb "properties", default: {} t.integer "client_enrollment_id" t.datetime "created_at", null: false @@ -353,7 +353,7 @@ t.index ["client_enrollment_id"], name: "index_client_enrollment_trackings_on_client_enrollment_id" end - create_table "client_enrollments", force: :cascade do |t| + create_table "client_enrollments", id: :serial, force: :cascade do |t| t.jsonb "properties", default: {} t.string "status", default: "Active" t.integer "client_id" @@ -367,7 +367,7 @@ t.index ["program_stream_id"], name: "index_client_enrollments_on_program_stream_id" end - create_table "client_interviewees", force: :cascade do |t| + create_table "client_interviewees", id: :serial, force: :cascade do |t| t.integer "client_id" t.integer "interviewee_id" t.datetime "created_at" @@ -376,7 +376,7 @@ t.index ["interviewee_id"], name: "index_client_interviewees_on_interviewee_id" end - create_table "client_needs", force: :cascade do |t| + create_table "client_needs", id: :serial, force: :cascade do |t| t.integer "rank" t.integer "client_id" t.integer "need_id" @@ -386,7 +386,7 @@ t.index ["need_id"], name: "index_client_needs_on_need_id" end - create_table "client_problems", force: :cascade do |t| + create_table "client_problems", id: :serial, force: :cascade do |t| t.integer "rank" t.integer "client_id" t.integer "problem_id" @@ -396,14 +396,14 @@ t.index ["problem_id"], name: "index_client_problems_on_problem_id" end - create_table "client_quantitative_cases", force: :cascade do |t| + create_table "client_quantitative_cases", id: :serial, force: :cascade do |t| t.integer "quantitative_case_id" t.integer "client_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "client_right_government_forms", force: :cascade do |t| + create_table "client_right_government_forms", id: :serial, force: :cascade do |t| t.integer "government_form_id" t.integer "client_right_id" t.datetime "created_at", null: false @@ -412,13 +412,13 @@ t.index ["government_form_id"], name: "index_client_right_government_forms_on_government_form_id" end - create_table "client_rights", force: :cascade do |t| + create_table "client_rights", id: :serial, force: :cascade do |t| t.string "name", default: "" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "client_type_government_forms", force: :cascade do |t| + create_table "client_type_government_forms", id: :serial, force: :cascade do |t| t.integer "client_type_id" t.integer "government_form_id" t.datetime "created_at" @@ -427,13 +427,13 @@ t.index ["government_form_id"], name: "index_client_type_government_forms_on_government_form_id" end - create_table "client_types", force: :cascade do |t| + create_table "client_types", id: :serial, force: :cascade do |t| t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" end - create_table "clients", force: :cascade do |t| + create_table "clients", id: :serial, force: :cascade do |t| t.string "code", default: "" t.string "given_name", default: "" t.string "family_name", default: "" @@ -651,14 +651,14 @@ t.index ["village_id"], name: "index_clients_on_village_id" end - create_table "clients_quantitative_cases", force: :cascade do |t| + create_table "clients_quantitative_cases", id: :serial, force: :cascade do |t| t.integer "client_id" t.integer "quantitative_case_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "communes", force: :cascade do |t| + create_table "communes", id: :serial, force: :cascade do |t| t.string "code", default: "" t.string "name_kh", default: "" t.string "name_en", default: "" @@ -669,7 +669,7 @@ t.index ["district_id"], name: "index_communes_on_district_id" end - create_table "custom_assessment_settings", force: :cascade do |t| + create_table "custom_assessment_settings", id: :serial, force: :cascade do |t| t.string "custom_assessment_name", default: "Custom Assessment" t.integer "max_custom_assessment", default: 6 t.string "custom_assessment_frequency", default: "month" @@ -680,7 +680,7 @@ t.boolean "enable_custom_assessment", default: false end - create_table "custom_field_permissions", force: :cascade do |t| + create_table "custom_field_permissions", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "custom_field_id" t.boolean "readable", default: true @@ -691,7 +691,7 @@ t.index ["user_id"], name: "index_custom_field_permissions_on_user_id" end - create_table "custom_field_properties", force: :cascade do |t| + create_table "custom_field_properties", id: :serial, force: :cascade do |t| t.jsonb "properties", default: {} t.string "custom_formable_type" t.integer "custom_formable_id" @@ -703,7 +703,7 @@ t.index ["custom_field_id"], name: "index_custom_field_properties_on_custom_field_id" end - create_table "custom_fields", force: :cascade do |t| + create_table "custom_fields", id: :serial, force: :cascade do |t| t.string "entity_type", default: "" t.text "properties", default: "" t.datetime "created_at", null: false @@ -715,7 +715,7 @@ t.jsonb "fields" end - create_table "departments", force: :cascade do |t| + create_table "departments", id: :serial, force: :cascade do |t| t.string "name", default: "" t.text "description", default: "" t.datetime "created_at" @@ -723,7 +723,7 @@ t.integer "users_count", default: 0 end - create_table "districts", force: :cascade do |t| + create_table "districts", id: :serial, force: :cascade do |t| t.string "name" t.integer "province_id" t.string "code", default: "" @@ -732,7 +732,7 @@ t.index ["province_id"], name: "index_districts_on_province_id" end - create_table "domain_groups", force: :cascade do |t| + create_table "domain_groups", id: :serial, force: :cascade do |t| t.string "name", default: "" t.text "description", default: "" t.datetime "created_at" @@ -740,7 +740,7 @@ t.integer "domains_count", default: 0 end - create_table "domain_program_streams", force: :cascade do |t| + create_table "domain_program_streams", id: :serial, force: :cascade do |t| t.integer "program_stream_id" t.integer "domain_id" t.datetime "created_at", null: false @@ -749,7 +749,7 @@ t.index ["deleted_at"], name: "index_domain_program_streams_on_deleted_at" end - create_table "domains", force: :cascade do |t| + create_table "domains", id: :serial, force: :cascade do |t| t.string "name", default: "" t.string "identity", default: "" t.text "description", default: "" @@ -775,14 +775,14 @@ t.index ["domain_group_id"], name: "index_domains_on_domain_group_id" end - create_table "donor_organizations", force: :cascade do |t| + create_table "donor_organizations", id: :serial, force: :cascade do |t| t.integer "donor_id" t.integer "organization_id" t.index ["donor_id"], name: "index_donor_organizations_on_donor_id" t.index ["organization_id"], name: "index_donor_organizations_on_organization_id" end - create_table "donors", force: :cascade do |t| + create_table "donors", id: :serial, force: :cascade do |t| t.string "name", default: "" t.text "description", default: "" t.datetime "created_at", null: false @@ -792,64 +792,14 @@ t.index ["global_id"], name: "index_donors_on_global_id" end - create_table "enrollment_trackings", force: :cascade do |t| - t.integer "enrollment_id" - t.integer "tracking_id" - t.jsonb "properties", default: {} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id" - t.index ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id" - end - - create_table "enrollments", force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "status", default: "Active" - t.date "enrollment_date" - t.datetime "deleted_at" - t.string "programmable_type" - t.integer "programmable_id" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["deleted_at"], name: "index_enrollments_on_deleted_at" - t.index ["program_stream_id"], name: "index_enrollments_on_program_stream_id" - end - - create_table "enrollment_trackings", force: :cascade do |t| - t.integer "enrollment_id" - t.integer "tracking_id" - t.jsonb "properties", default: {} - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "enrollment_trackings", ["enrollment_id"], name: "index_enrollment_trackings_on_enrollment_id", using: :btree - add_index "enrollment_trackings", ["tracking_id"], name: "index_enrollment_trackings_on_tracking_id", using: :btree - - create_table "enrollments", force: :cascade do |t| - t.jsonb "properties", default: {} - t.string "status", default: "Active" - t.date "enrollment_date" - t.datetime "deleted_at" - t.string "programmable_type" - t.integer "programmable_id" - t.integer "program_stream_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "enrollments", ["deleted_at"], name: "index_enrollments_on_deleted_at", using: :btree - add_index "enrollments", ["program_stream_id"], name: "index_enrollments_on_program_stream_id", using: :btree - - create_table "enter_ngo_users", force: :cascade do |t| + create_table "enter_ngo_users", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "enter_ngo_id" t.index ["enter_ngo_id"], name: "index_enter_ngo_users_on_enter_ngo_id" t.index ["user_id"], name: "index_enter_ngo_users_on_user_id" end - create_table "enter_ngos", force: :cascade do |t| + create_table "enter_ngos", id: :serial, force: :cascade do |t| t.date "accepted_date" t.integer "client_id" t.datetime "created_at" @@ -859,7 +809,7 @@ t.index ["deleted_at"], name: "index_enter_ngos_on_deleted_at" end - create_table "exit_ngos", force: :cascade do |t| + create_table "exit_ngos", id: :serial, force: :cascade do |t| t.integer "client_id" t.string "exit_circumstance", default: "" t.string "other_info_of_exit", default: "" @@ -873,7 +823,7 @@ t.index ["deleted_at"], name: "index_exit_ngos_on_deleted_at" end - create_table "external_system_global_identities", force: :cascade do |t| + create_table "external_system_global_identities", id: :serial, force: :cascade do |t| t.integer "external_system_id" t.string "global_id" t.string "external_id" @@ -885,7 +835,7 @@ t.index ["global_id"], name: "index_external_system_global_identities_on_global_id" end - create_table "external_systems", force: :cascade do |t| + create_table "external_systems", id: :serial, force: :cascade do |t| t.string "name" t.string "url" t.string "token" @@ -893,7 +843,7 @@ t.datetime "updated_at", null: false end - create_table "families", force: :cascade do |t| + create_table "families", id: :serial, force: :cascade do |t| t.string "code" t.string "name", default: "" t.string "address", default: "" @@ -930,7 +880,7 @@ t.index ["village_id"], name: "index_families_on_village_id" end - create_table "family_members", force: :cascade do |t| + create_table "family_members", id: :serial, force: :cascade do |t| t.string "adult_name", default: "" t.date "date_of_birth" t.string "occupation", default: "" @@ -944,14 +894,14 @@ t.index ["family_id"], name: "index_family_members_on_family_id" end - create_table "family_plans", force: :cascade do |t| + create_table "family_plans", id: :serial, force: :cascade do |t| t.string "name", default: "" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "priority" end - create_table "field_setting_translations", force: :cascade do |t| + create_table "field_setting_translations", id: :serial, force: :cascade do |t| t.integer "field_setting_id", null: false t.string "locale", null: false t.datetime "created_at", null: false @@ -961,7 +911,7 @@ t.index ["locale"], name: "index_field_setting_translations_on_locale" end - create_table "field_settings", force: :cascade do |t| + create_table "field_settings", id: :serial, force: :cascade do |t| t.string "name", null: false t.string "group", null: false t.datetime "created_at", null: false @@ -975,7 +925,7 @@ t.boolean "label_only", default: false end - create_table "form_builder_attachments", force: :cascade do |t| + create_table "form_builder_attachments", id: :serial, force: :cascade do |t| t.string "name", default: "" t.jsonb "file", default: [] t.string "form_buildable_type" @@ -984,7 +934,7 @@ t.datetime "updated_at", null: false end - create_table "friendly_id_slugs", force: :cascade do |t| + create_table "friendly_id_slugs", id: :serial, force: :cascade do |t| t.string "slug", null: false t.integer "sluggable_id", null: false t.string "sluggable_type", limit: 50 @@ -1001,7 +951,7 @@ t.index ["ulid"], name: "index_global_identities_on_ulid", unique: true end - create_table "global_identity_organizations", force: :cascade do |t| + create_table "global_identity_organizations", id: :serial, force: :cascade do |t| t.string "global_id" t.integer "organization_id" t.integer "client_id" @@ -1010,7 +960,7 @@ t.index ["organization_id"], name: "index_global_identity_organizations_on_organization_id" end - create_table "global_identity_tmp", force: :cascade do |t| + create_table "global_identity_tmp", id: :serial, force: :cascade do |t| t.binary "ulid" t.string "ngo_name" t.integer "client_id" @@ -1021,7 +971,7 @@ t.index ["uuid"], name: "index_global_services_on_uuid", unique: true end - create_table "government_form_children_plans", force: :cascade do |t| + create_table "government_form_children_plans", id: :serial, force: :cascade do |t| t.text "goal", default: "" t.text "action", default: "" t.text "who", default: "" @@ -1036,7 +986,7 @@ t.index ["government_form_id"], name: "index_government_form_children_plans_on_government_form_id" end - create_table "government_form_family_plans", force: :cascade do |t| + create_table "government_form_family_plans", id: :serial, force: :cascade do |t| t.text "goal", default: "" t.text "action", default: "" t.text "result", default: "" @@ -1050,7 +1000,7 @@ t.index ["government_form_id"], name: "index_government_form_family_plans_on_government_form_id" end - create_table "government_form_interviewees", force: :cascade do |t| + create_table "government_form_interviewees", id: :serial, force: :cascade do |t| t.integer "government_form_id" t.integer "interviewee_id" t.datetime "created_at" @@ -1059,7 +1009,7 @@ t.index ["interviewee_id"], name: "index_government_form_interviewees_on_interviewee_id" end - create_table "government_form_needs", force: :cascade do |t| + create_table "government_form_needs", id: :serial, force: :cascade do |t| t.integer "rank" t.integer "need_id" t.integer "government_form_id" @@ -1069,7 +1019,7 @@ t.index ["need_id"], name: "index_government_form_needs_on_need_id" end - create_table "government_form_problems", force: :cascade do |t| + create_table "government_form_problems", id: :serial, force: :cascade do |t| t.integer "rank" t.integer "problem_id" t.integer "government_form_id" @@ -1079,7 +1029,7 @@ t.index ["problem_id"], name: "index_government_form_problems_on_problem_id" end - create_table "government_form_service_types", force: :cascade do |t| + create_table "government_form_service_types", id: :serial, force: :cascade do |t| t.integer "government_form_id" t.integer "service_type_id" t.datetime "created_at", null: false @@ -1088,7 +1038,7 @@ t.index ["service_type_id"], name: "index_government_form_service_types_on_service_type_id" end - create_table "government_forms", force: :cascade do |t| + create_table "government_forms", id: :serial, force: :cascade do |t| t.string "name", default: "" t.date "date" t.string "client_code", default: "" @@ -1149,7 +1099,7 @@ t.index ["village_id"], name: "index_government_forms_on_village_id" end - create_table "government_reports", force: :cascade do |t| + create_table "government_reports", id: :serial, force: :cascade do |t| t.string "code", default: "" t.string "initial_capital", default: "" t.string "initial_city", default: "" @@ -1212,7 +1162,7 @@ t.datetime "updated_at" end - create_table "hotlines", force: :cascade do |t| + create_table "hotlines", id: :serial, force: :cascade do |t| t.integer "client_id" t.integer "call_id" t.datetime "created_at" @@ -1221,19 +1171,19 @@ t.index ["client_id"], name: "index_hotlines_on_client_id" end - create_table "interventions", force: :cascade do |t| + create_table "interventions", id: :serial, force: :cascade do |t| t.string "action", default: "" t.datetime "created_at" t.datetime "updated_at" end - create_table "interviewees", force: :cascade do |t| + create_table "interviewees", id: :serial, force: :cascade do |t| t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" end - create_table "leave_programs", force: :cascade do |t| + create_table "leave_programs", id: :serial, force: :cascade do |t| t.jsonb "properties", default: {} t.integer "client_enrollment_id" t.datetime "created_at", null: false @@ -1241,26 +1191,24 @@ t.integer "program_stream_id" t.date "exit_date" t.datetime "deleted_at" - t.integer "enrollment_id" t.index ["client_enrollment_id"], name: "index_leave_programs_on_client_enrollment_id" t.index ["deleted_at"], name: "index_leave_programs_on_deleted_at" - t.index ["enrollment_id"], name: "index_leave_programs_on_enrollment_id" end - create_table "locations", force: :cascade do |t| + create_table "locations", id: :serial, force: :cascade do |t| t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" t.integer "order_option", default: 0 end - create_table "materials", force: :cascade do |t| + create_table "materials", id: :serial, force: :cascade do |t| t.string "status", default: "" t.datetime "created_at" t.datetime "updated_at" end - create_table "meta_fields", force: :cascade do |t| + create_table "meta_fields", id: :serial, force: :cascade do |t| t.string "field_name" t.string "field_type" t.boolean "hidden", default: true @@ -1270,19 +1218,19 @@ t.datetime "updated_at", null: false end - create_table "necessities", force: :cascade do |t| + create_table "necessities", id: :serial, force: :cascade do |t| t.string "content", default: "" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "needs", force: :cascade do |t| + create_table "needs", id: :serial, force: :cascade do |t| t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" end - create_table "oauth_access_grants", force: :cascade do |t| + create_table "oauth_access_grants", id: :serial, force: :cascade do |t| t.integer "resource_owner_id", null: false t.integer "application_id", null: false t.string "token", null: false @@ -1294,7 +1242,7 @@ t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true end - create_table "oauth_access_tokens", force: :cascade do |t| + create_table "oauth_access_tokens", id: :serial, force: :cascade do |t| t.integer "resource_owner_id" t.integer "application_id" t.string "token", null: false @@ -1309,7 +1257,7 @@ t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true end - create_table "oauth_applications", force: :cascade do |t| + create_table "oauth_applications", id: :serial, force: :cascade do |t| t.string "name", null: false t.string "uid", null: false t.string "secret", null: false @@ -1321,13 +1269,13 @@ t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true end - create_table "organization_types", force: :cascade do |t| + create_table "organization_types", id: :serial, force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "organizations", force: :cascade do |t| + create_table "organizations", id: :serial, force: :cascade do |t| t.string "full_name" t.string "short_name" t.string "logo" @@ -1345,7 +1293,7 @@ t.string "referral_source_category_name" end - create_table "partners", force: :cascade do |t| + create_table "partners", id: :serial, force: :cascade do |t| t.string "name", default: "" t.string "address", default: "" t.date "start_date" @@ -1364,7 +1312,7 @@ t.index ["organization_type_id"], name: "index_partners_on_organization_type_id" end - create_table "permissions", force: :cascade do |t| + create_table "permissions", id: :serial, force: :cascade do |t| t.integer "user_id" t.boolean "case_notes_readable", default: true t.boolean "case_notes_editable", default: true @@ -1375,13 +1323,13 @@ t.index ["user_id"], name: "index_permissions_on_user_id" end - create_table "problems", force: :cascade do |t| + create_table "problems", id: :serial, force: :cascade do |t| t.string "name", default: "" t.datetime "created_at" t.datetime "updated_at" end - create_table "program_stream_permissions", force: :cascade do |t| + create_table "program_stream_permissions", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "program_stream_id" t.boolean "readable", default: true @@ -1394,7 +1342,7 @@ t.index ["user_id"], name: "index_program_stream_permissions_on_user_id" end - create_table "program_stream_services", force: :cascade do |t| + create_table "program_stream_services", id: :serial, force: :cascade do |t| t.datetime "deleted_at" t.integer "program_stream_id" t.integer "service_id" @@ -1405,7 +1353,7 @@ t.index ["service_id"], name: "index_program_stream_services_on_service_id" end - create_table "program_streams", force: :cascade do |t| + create_table "program_streams", id: :serial, force: :cascade do |t| t.string "name" t.text "description" t.jsonb "rules", default: {} @@ -1420,17 +1368,16 @@ t.integer "mutual_dependence", default: [], array: true t.boolean "tracking_required", default: false t.datetime "archived_at" - t.string "entity_type", default: "" t.index ["archived_at"], name: "index_program_streams_on_archived_at" end - create_table "progress_note_types", force: :cascade do |t| + create_table "progress_note_types", id: :serial, force: :cascade do |t| t.string "note_type", default: "" t.datetime "created_at" t.datetime "updated_at" end - create_table "progress_notes", force: :cascade do |t| + create_table "progress_notes", id: :serial, force: :cascade do |t| t.date "date" t.string "other_location", default: "" t.text "response", default: "" @@ -1449,13 +1396,13 @@ t.index ["user_id"], name: "index_progress_notes_on_user_id" end - create_table "protection_concerns", force: :cascade do |t| + create_table "protection_concerns", id: :serial, force: :cascade do |t| t.string "content", default: "" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "provinces", force: :cascade do |t| + create_table "provinces", id: :serial, force: :cascade do |t| t.string "name", default: "" t.text "description", default: "" t.datetime "created_at" @@ -1468,14 +1415,14 @@ t.string "country" end - create_table "quantitative_cases", force: :cascade do |t| + create_table "quantitative_cases", id: :serial, force: :cascade do |t| t.string "value", default: "" t.integer "quantitative_type_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "quantitative_type_permissions", force: :cascade do |t| + create_table "quantitative_type_permissions", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "quantitative_type_id" t.boolean "readable", default: true @@ -1486,7 +1433,7 @@ t.index ["user_id"], name: "index_quantitative_type_permissions_on_user_id" end - create_table "quantitative_types", force: :cascade do |t| + create_table "quantitative_types", id: :serial, force: :cascade do |t| t.string "name", default: "" t.text "description", default: "" t.integer "quantitative_cases_count", default: 0 @@ -1495,7 +1442,7 @@ t.boolean "multiple", default: true end - create_table "quarterly_reports", force: :cascade do |t| + create_table "quarterly_reports", id: :serial, force: :cascade do |t| t.date "visit_date" t.bigint "code" t.integer "case_id" @@ -1518,13 +1465,13 @@ t.index ["case_id"], name: "index_quarterly_reports_on_case_id" end - create_table "question_groups", force: :cascade do |t| + create_table "question_groups", id: :serial, force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "referees", force: :cascade do |t| + create_table "referees", id: :serial, force: :cascade do |t| t.string "address_type", default: "" t.string "current_address", default: "" t.string "email", default: "" @@ -1564,7 +1511,7 @@ t.index ["village_id"], name: "index_referees_on_village_id" end - create_table "referral_sources", force: :cascade do |t| + create_table "referral_sources", id: :serial, force: :cascade do |t| t.string "name", default: "" t.text "description", default: "" t.datetime "created_at" @@ -1575,7 +1522,7 @@ t.index ["ancestry"], name: "index_referral_sources_on_ancestry" end - create_table "referrals", force: :cascade do |t| + create_table "referrals", id: :serial, force: :cascade do |t| t.string "slug", default: "" t.date "date_of_referral" t.string "referred_to", default: "" @@ -1612,13 +1559,13 @@ t.integer "service_id" end - create_table "service_types", force: :cascade do |t| + create_table "service_types", id: :serial, force: :cascade do |t| t.string "name", default: "" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "services", force: :cascade do |t| + create_table "services", id: :serial, force: :cascade do |t| t.string "name" t.integer "parent_id" t.datetime "deleted_at" @@ -1631,7 +1578,7 @@ t.index ["uuid"], name: "index_services_on_uuid" end - create_table "settings", force: :cascade do |t| + create_table "settings", id: :serial, force: :cascade do |t| t.string "assessment_frequency", default: "month" t.integer "min_assessment" t.integer "max_assessment", default: 6 @@ -1678,7 +1625,7 @@ t.index ["province_id"], name: "index_settings_on_province_id" end - create_table "shared_clients", force: :cascade do |t| + create_table "shared_clients", id: :serial, force: :cascade do |t| t.string "slug", default: "" t.string "given_name", default: "" t.string "family_name", default: "" @@ -1707,7 +1654,7 @@ t.index ["slug"], name: "index_shared_clients_on_slug", unique: true end - create_table "sponsors", force: :cascade do |t| + create_table "sponsors", id: :serial, force: :cascade do |t| t.integer "client_id" t.integer "donor_id" t.datetime "created_at" @@ -1716,20 +1663,20 @@ t.index ["donor_id"], name: "index_sponsors_on_donor_id" end - create_table "stages", force: :cascade do |t| + create_table "stages", id: :serial, force: :cascade do |t| t.float "from_age" t.float "to_age" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "states", force: :cascade do |t| + create_table "states", id: :serial, force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "subdistricts", force: :cascade do |t| + create_table "subdistricts", id: :serial, force: :cascade do |t| t.string "name" t.integer "district_id" t.datetime "created_at", null: false @@ -1737,7 +1684,7 @@ t.index ["district_id"], name: "index_subdistricts_on_district_id" end - create_table "surveys", force: :cascade do |t| + create_table "surveys", id: :serial, force: :cascade do |t| t.integer "client_id" t.integer "user_id" t.integer "listening_score" @@ -1753,7 +1700,7 @@ t.index ["client_id"], name: "index_surveys_on_client_id" end - create_table "tasks", force: :cascade do |t| + create_table "tasks", id: :serial, force: :cascade do |t| t.string "name", default: "" t.date "completion_date" t.datetime "remind_at" @@ -1774,40 +1721,42 @@ t.index ["taskable_type", "taskable_id"], name: "index_tasks_on_taskable_type_and_taskable_id" end - create_table "thredded_categories", force: :cascade do |t| + create_table "thredded_categories", id: :serial, force: :cascade do |t| t.integer "messageboard_id", null: false t.string "name", limit: 191, null: false t.string "description", limit: 255 t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "slug", limit: 191, null: false + t.index "lower((name)::text) text_pattern_ops", name: "thredded_categories_name_ci" t.index ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true t.index ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id" end - create_table "thredded_messageboard_groups", force: :cascade do |t| + create_table "thredded_messageboard_groups", id: :serial, force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.integer "position", null: false + t.index ["name"], name: "index_thredded_messageboard_group_on_name", unique: true end - create_table "thredded_messageboards", force: :cascade do |t| - t.string "name", limit: 255, null: false + create_table "thredded_messageboards", id: :serial, force: :cascade do |t| + t.string "name", limit: 191, null: false t.string "slug", limit: 191 t.text "description" t.integer "topics_count", default: 0 t.integer "posts_count", default: 0 - t.boolean "closed", default: false, null: false t.integer "last_topic_id" t.integer "messageboard_group_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["closed"], name: "index_thredded_messageboards_on_closed" + t.integer "position", null: false t.index ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id" t.index ["slug"], name: "index_thredded_messageboards_on_slug" end - create_table "thredded_post_moderation_records", force: :cascade do |t| + create_table "thredded_post_moderation_records", id: :serial, force: :cascade do |t| t.integer "post_id" t.integer "messageboard_id" t.text "post_content" @@ -1820,7 +1769,7 @@ t.index ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: { created_at: :desc } end - create_table "thredded_post_notifications", force: :cascade do |t| + create_table "thredded_post_notifications", id: :serial, force: :cascade do |t| t.string "email", limit: 191, null: false t.integer "post_id", null: false t.datetime "created_at", null: false @@ -1829,7 +1778,7 @@ t.index ["post_id", "post_type"], name: "index_thredded_post_notifications_on_post" end - create_table "thredded_posts", force: :cascade do |t| + create_table "thredded_posts", id: :serial, force: :cascade do |t| t.integer "user_id" t.text "content" t.string "ip", limit: 255 @@ -1839,13 +1788,14 @@ t.integer "moderation_state", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index "to_tsvector('english'::regconfig, content)", name: "thredded_posts_content_fts", using: :gist t.index ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id" t.index ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display" t.index ["postable_id"], name: "index_thredded_posts_on_postable_id_and_postable_type" t.index ["user_id"], name: "index_thredded_posts_on_user_id" end - create_table "thredded_private_posts", force: :cascade do |t| + create_table "thredded_private_posts", id: :serial, force: :cascade do |t| t.integer "user_id" t.text "content" t.integer "postable_id", null: false @@ -1854,7 +1804,7 @@ t.datetime "updated_at", null: false end - create_table "thredded_private_topics", force: :cascade do |t| + create_table "thredded_private_topics", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "last_user_id" t.string "title", limit: 255, null: false @@ -1863,11 +1813,12 @@ t.string "hash_id", limit: 191, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.datetime "last_post_at" t.index ["hash_id"], name: "index_thredded_private_topics_on_hash_id" t.index ["slug"], name: "index_thredded_private_topics_on_slug" end - create_table "thredded_private_users", force: :cascade do |t| + create_table "thredded_private_users", id: :serial, force: :cascade do |t| t.integer "private_topic_id" t.integer "user_id" t.datetime "created_at", null: false @@ -1876,14 +1827,14 @@ t.index ["user_id"], name: "index_thredded_private_users_on_user_id" end - create_table "thredded_topic_categories", force: :cascade do |t| + create_table "thredded_topic_categories", id: :serial, force: :cascade do |t| t.integer "topic_id", null: false t.integer "category_id", null: false t.index ["category_id"], name: "index_thredded_topic_categories_on_category_id" t.index ["topic_id"], name: "index_thredded_topic_categories_on_topic_id" end - create_table "thredded_topics", force: :cascade do |t| + create_table "thredded_topics", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "last_user_id" t.string "title", limit: 255, null: false @@ -1897,6 +1848,8 @@ t.integer "moderation_state", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.datetime "last_post_at" + t.index "to_tsvector('english'::regconfig, (title)::text)", name: "thredded_topics_title_fts", using: :gist t.index ["hash_id"], name: "index_thredded_topics_on_hash_id" t.index ["messageboard_id", "slug"], name: "index_thredded_topics_on_messageboard_id_and_slug", unique: true t.index ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id" @@ -1904,7 +1857,7 @@ t.index ["user_id"], name: "index_thredded_topics_on_user_id" end - create_table "thredded_user_details", force: :cascade do |t| + create_table "thredded_user_details", id: :serial, force: :cascade do |t| t.integer "user_id", null: false t.datetime "latest_activity_at" t.integer "posts_count", default: 0 @@ -1919,25 +1872,27 @@ t.index ["user_id"], name: "index_thredded_user_details_on_user_id" end - create_table "thredded_user_messageboard_preferences", force: :cascade do |t| + create_table "thredded_user_messageboard_preferences", id: :serial, force: :cascade do |t| t.integer "user_id", null: false t.integer "messageboard_id", null: false - t.boolean "notify_on_mention", default: true, null: false + t.boolean "follow_topics_on_mention", default: true, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.boolean "followed_topic_emails", default: true, null: false t.index ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true end - create_table "thredded_user_preferences", force: :cascade do |t| + create_table "thredded_user_preferences", id: :serial, force: :cascade do |t| t.integer "user_id", null: false - t.boolean "notify_on_mention", default: true, null: false + t.boolean "follow_topics_on_mention", default: true, null: false t.boolean "notify_on_message", default: true, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.boolean "followed_topic_emails", default: true, null: false t.index ["user_id"], name: "index_thredded_user_preferences_on_user_id" end - create_table "thredded_user_private_topic_read_states", force: :cascade do |t| + create_table "thredded_user_private_topic_read_states", id: :serial, force: :cascade do |t| t.integer "user_id", null: false t.integer "postable_id", null: false t.integer "page", default: 1, null: false @@ -1945,7 +1900,7 @@ t.index ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true end - create_table "thredded_user_topic_follows", force: :cascade do |t| + create_table "thredded_user_topic_follows", id: :serial, force: :cascade do |t| t.integer "user_id", null: false t.integer "topic_id", null: false t.datetime "created_at", null: false @@ -1953,7 +1908,7 @@ t.index ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true end - create_table "thredded_user_topic_read_states", force: :cascade do |t| + create_table "thredded_user_topic_read_states", id: :serial, force: :cascade do |t| t.integer "user_id", null: false t.integer "postable_id", null: false t.integer "page", default: 1, null: false @@ -1961,7 +1916,7 @@ t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true end - create_table "townships", force: :cascade do |t| + create_table "townships", id: :serial, force: :cascade do |t| t.string "name" t.integer "state_id" t.datetime "created_at", null: false @@ -1969,7 +1924,7 @@ t.index ["state_id"], name: "index_townships_on_state_id" end - create_table "trackings", force: :cascade do |t| + create_table "trackings", id: :serial, force: :cascade do |t| t.string "name", default: "" t.jsonb "fields", default: {} t.string "frequency", default: "" @@ -1983,7 +1938,7 @@ t.index ["program_stream_id"], name: "index_trackings_on_program_stream_id" end - create_table "users", force: :cascade do |t| + create_table "users", id: :serial, force: :cascade do |t| t.string "first_name", default: "" t.string "last_name", default: "" t.string "roles", default: "case worker" @@ -2036,22 +1991,21 @@ t.string "preferred_language", default: "en" t.string "organization_name" t.string "profile" + t.index "lower((email)::text) text_pattern_ops", name: "users_email_lower", unique: true t.index ["deleted_at"], name: "index_users_on_deleted_at" t.index ["email"], name: "index_users_on_email", unique: true t.index ["organization_id"], name: "index_users_on_organization_id" t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end - create_table "version_associations", force: :cascade do |t| + create_table "version_associations", id: :serial, force: :cascade do |t| t.integer "version_id" t.string "foreign_key_name", null: false t.integer "foreign_key_id" - t.string "foreign_type" - t.index ["foreign_key_name", "foreign_key_id", "foreign_type"], name: "index_version_associations_on_foreign_key" t.index ["version_id"], name: "index_version_associations_on_version_id" end - create_table "versions", force: :cascade do |t| + create_table "versions", id: :serial, force: :cascade do |t| t.string "item_type", null: false t.integer "item_id", null: false t.string "event", null: false @@ -2064,7 +2018,7 @@ t.index ["transaction_id"], name: "index_versions_on_transaction_id" end - create_table "villages", force: :cascade do |t| + create_table "villages", id: :serial, force: :cascade do |t| t.string "code", default: "" t.string "name_kh", default: "" t.string "name_en", default: "" @@ -2074,7 +2028,7 @@ t.index ["commune_id"], name: "index_villages_on_commune_id" end - create_table "visit_clients", force: :cascade do |t| + create_table "visit_clients", id: :serial, force: :cascade do |t| t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" @@ -2082,7 +2036,7 @@ t.index ["user_id"], name: "index_visit_clients_on_user_id" end - create_table "visits", force: :cascade do |t| + create_table "visits", id: :serial, force: :cascade do |t| t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" @@ -2149,9 +2103,6 @@ add_foreign_key "domains", "domain_groups" add_foreign_key "donor_organizations", "donors" add_foreign_key "donor_organizations", "organizations" - add_foreign_key "enrollment_trackings", "enrollments" - add_foreign_key "enrollment_trackings", "trackings" - add_foreign_key "enrollments", "program_streams" add_foreign_key "enter_ngo_users", "enter_ngos" add_foreign_key "enter_ngo_users", "users" add_foreign_key "enter_ngos", "clients" @@ -2183,7 +2134,6 @@ add_foreign_key "hotlines", "calls" add_foreign_key "hotlines", "clients" add_foreign_key "leave_programs", "client_enrollments" - add_foreign_key "leave_programs", "enrollments" add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id" add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id" add_foreign_key "partners", "organization_types" From 7fef07541da5abda2a2cd1d49a7b217c38101c95 Mon Sep 17 00:00:00 2001 From: kirykr Date: Mon, 21 Dec 2020 17:05:41 +0700 Subject: [PATCH 15/27] fixed ActiveModel::ArraySerializer constant error --- app/controllers/api/communes_controller.rb | 2 +- app/controllers/api/v1/organizations_controller.rb | 6 +++--- app/controllers/api/villages_controller.rb | 2 +- app/serializers/assessment_serializer.rb | 2 +- app/serializers/case_note_serializer.rb | 4 ++-- app/serializers/client_serializer.rb | 6 +++--- app/serializers/user_serializer.rb | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/controllers/api/communes_controller.rb b/app/controllers/api/communes_controller.rb index a299e78ea9..309f9fc6ee 100644 --- a/app/controllers/api/communes_controller.rb +++ b/app/controllers/api/communes_controller.rb @@ -3,7 +3,7 @@ class CommunesController < Api::ApplicationController def index data = District.find(params[:district_id]).communes render json: { - data: ActiveModel::ArraySerializer.new(data, each_serializer: CommuneSerializer) + data: ActiveModel::Serializer::CollectionSerializer.new(data, each_serializer: CommuneSerializer) } end end diff --git a/app/controllers/api/v1/organizations_controller.rb b/app/controllers/api/v1/organizations_controller.rb index 81fa2bc5b8..3910652a3a 100644 --- a/app/controllers/api/v1/organizations_controller.rb +++ b/app/controllers/api/v1/organizations_controller.rb @@ -20,7 +20,7 @@ def clients referred_clients, sql = get_sql_and_client_data(external_system_name, date_time_param) none_referred_clients = Client.find_by_sql(sql.squish) bulk_clients << referred_clients - bulk_clients << JSON.parse(ActiveModel::ArraySerializer.new(none_referred_clients, each_serializer: ClientShareExternalSerializer, context: current_user).to_json) + bulk_clients << JSON.parse(ActiveModel::Serializer::CollectionSerializer.new(none_referred_clients, each_serializer: ClientShareExternalSerializer, context: current_user).to_json) end Organization.switch_to 'public' render json: bulk_clients.flatten, root: :data @@ -209,7 +209,7 @@ def get_sql_and_client_data(external_system_name, date_time_param) clients = [] if params.dig(:since_date).present? clients = Client.referred_external(external_system_name).where('clients.created_at >= ? OR clients.updated_at >= ?', date_time_param, date_time_param).order('clients.updated_at DESC') - referred_clients = JSON.parse ActiveModel::ArraySerializer.new(clients.distinct.to_a, each_serializer: OrganizationClientSerializer, context: current_user).to_json + referred_clients = JSON.parse ActiveModel::Serializer::CollectionSerializer.new(clients.distinct.to_a, each_serializer: OrganizationClientSerializer, context: current_user).to_json if clients.present? sql << " WHERE (DATE(clients.created_at) >= '#{date_time_param}' OR DATE(clients.updated_at) >= '#{date_time_param}') AND clients.id NOT IN (#{clients.ids.join(', ')}) ORDER BY clients.updated_at DESC" else @@ -217,7 +217,7 @@ def get_sql_and_client_data(external_system_name, date_time_param) end else clients = Client.referred_external(external_system_name).order('clients.updated_at DESC') - referred_clients = JSON.parse ActiveModel::ArraySerializer.new(clients.distinct.to_a, each_serializer: OrganizationClientSerializer, context: current_user).to_json + referred_clients = JSON.parse ActiveModel::Serializer::CollectionSerializer.new(clients.distinct.to_a, each_serializer: OrganizationClientSerializer, context: current_user).to_json if clients.present? sql << " WHERE clients.id NOT IN (#{clients.ids.join(', ')}) ORDER BY clients.updated_at DESC" else diff --git a/app/controllers/api/villages_controller.rb b/app/controllers/api/villages_controller.rb index 0deb7387ed..1d8532f3b0 100644 --- a/app/controllers/api/villages_controller.rb +++ b/app/controllers/api/villages_controller.rb @@ -3,7 +3,7 @@ class VillagesController < Api::ApplicationController def index data = Commune.find(params[:commune_id]).villages render json: { - data: ActiveModel::ArraySerializer.new(data, each_serializer: VillageSerializer) + data: ActiveModel::Serializer::CollectionSerializer.new(data, each_serializer: VillageSerializer) } end end diff --git a/app/serializers/assessment_serializer.rb b/app/serializers/assessment_serializer.rb index 3ba1fa0196..a053e8c880 100644 --- a/app/serializers/assessment_serializer.rb +++ b/app/serializers/assessment_serializer.rb @@ -2,7 +2,7 @@ class AssessmentSerializer < ActiveModel::Serializer attributes :id, :client_id, :created_at, :updated_at, :case_notes, :completed, :default, :assessment_domain def case_notes - ActiveModel::ArraySerializer.new(object.case_notes, each_serializer: CaseNoteSerializer) + ActiveModel::Serializer::CollectionSerializer.new(object.case_notes, each_serializer: CaseNoteSerializer) end def assessment_domain diff --git a/app/serializers/case_note_serializer.rb b/app/serializers/case_note_serializer.rb index a7b3b1029f..6fc7e9cd4e 100644 --- a/app/serializers/case_note_serializer.rb +++ b/app/serializers/case_note_serializer.rb @@ -2,10 +2,10 @@ class CaseNoteSerializer < ActiveModel::Serializer attributes :attendee, :meeting_date, :interaction_type, :assessment_id, :id, :case_note_domain_groups, :case_note_domain_group, :selected_domain_group_ids, :created_at, :updated_at def case_note_domain_groups - ActiveModel::ArraySerializer.new(object.case_note_domain_groups, each_serializer: CaseNoteDomainGroupSerializer) + ActiveModel::Serializer::CollectionSerializer.new(object.case_note_domain_groups, each_serializer: CaseNoteDomainGroupSerializer) end def case_note_domain_group - ActiveModel::ArraySerializer.new(object.case_note_domain_groups, each_serializer: CaseNoteDomainGroupSerializer) + ActiveModel::Serializer::CollectionSerializer.new(object.case_note_domain_groups, each_serializer: CaseNoteDomainGroupSerializer) end end diff --git a/app/serializers/client_serializer.rb b/app/serializers/client_serializer.rb index 73af48f9fb..5287499553 100644 --- a/app/serializers/client_serializer.rb +++ b/app/serializers/client_serializer.rb @@ -160,9 +160,9 @@ def additional_form end def tasks - overdue_tasks = ActiveModel::ArraySerializer.new(object.tasks.overdue_incomplete, each_serializer: TaskSerializer) - today_tasks = ActiveModel::ArraySerializer.new(object.tasks.today_incomplete, each_serializer: TaskSerializer) - upcoming_tasks = ActiveModel::ArraySerializer.new(object.tasks.incomplete.upcoming, each_serializer: TaskSerializer) + overdue_tasks = ActiveModel::Serializer::CollectionSerializer.new(object.tasks.overdue_incomplete, each_serializer: TaskSerializer) + today_tasks = ActiveModel::Serializer::CollectionSerializer.new(object.tasks.today_incomplete, each_serializer: TaskSerializer) + upcoming_tasks = ActiveModel::Serializer::CollectionSerializer.new(object.tasks.incomplete.upcoming, each_serializer: TaskSerializer) { overdue: overdue_tasks, today: today_tasks, upcoming: upcoming_tasks } end diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb index 017d5f6d32..132fde0954 100644 --- a/app/serializers/user_serializer.rb +++ b/app/serializers/user_serializer.rb @@ -5,9 +5,9 @@ def clients object.clients.map do |client| incompleted_tasks = client.tasks.incomplete formatted_client = client.as_json(only: [:id, :given_name, :family_name, :local_given_name, :local_family_name]) - overdue_tasks = ActiveModel::ArraySerializer.new(incompleted_tasks.overdue, each_serializer: TaskSerializer) - today_tasks = ActiveModel::ArraySerializer.new(incompleted_tasks.today, each_serializer: TaskSerializer) - upcoming_tasks = ActiveModel::ArraySerializer.new(incompleted_tasks.upcoming, each_serializer: TaskSerializer) + overdue_tasks = ActiveModel::Serializer::CollectionSerializer.new(incompleted_tasks.overdue, each_serializer: TaskSerializer) + today_tasks = ActiveModel::Serializer::CollectionSerializer.new(incompleted_tasks.today, each_serializer: TaskSerializer) + upcoming_tasks = ActiveModel::Serializer::CollectionSerializer.new(incompleted_tasks.upcoming, each_serializer: TaskSerializer) formatted_client.merge(overdue: overdue_tasks, today: today_tasks, upcoming: upcoming_tasks) end.compact From aeb7712c58d7bd1bd8679f632a38a87f6d84f00f Mon Sep 17 00:00:00 2001 From: kirykr Date: Wed, 23 Dec 2020 16:01:28 +0700 Subject: [PATCH 16/27] fixed select2 report builder and select2 dropdown --- .../advanced_filter_builder.coffee | 4 +- app/assets/javascripts/calls/index.coffee | 30 - .../javascripts/client_advance_search.coffee | 75 +- app/assets/javascripts/clients/index.coffee | 9 +- app/assets/javascripts/common.coffee | 33 + app/assets/stylesheets/dashboards/index.scss | 12 - app/assets/stylesheets/form.scss | 10 + .../client_advanced_search.rb | 2 + app/controllers/api/communes_controller.rb | 2 +- app/controllers/api/villages_controller.rb | 2 +- .../client_advanced_searches_concern.rb | 5 +- app/javascript/components/EditCall/index.js | 224 +- .../components/NewClientForm/carerInfo.js | 306 +- .../components/NewClientForm/index.js | 1093 +- .../components/NewClientForm/referralInfo.js | 959 +- app/models/client.rb | 9 +- app/views/errors/404.html.haml | 2 +- config/application.rb | 1 + ...1222033904_add_item_subtype_to_versions.rb | 5 + db/schema.rb | 7 +- package-lock.json | 10199 ---------------- 21 files changed, 1718 insertions(+), 11271 deletions(-) create mode 100644 db/migrate/20201222033904_add_item_subtype_to_versions.rb delete mode 100644 package-lock.json diff --git a/app/assets/javascripts/advanced_filter_builder.coffee b/app/assets/javascripts/advanced_filter_builder.coffee index 512b8cba63..5662baaf7a 100644 --- a/app/assets/javascripts/advanced_filter_builder.coffee +++ b/app/assets/javascripts/advanced_filter_builder.coffee @@ -119,8 +119,10 @@ class CIF.AdvancedFilterBuilder month_has_changed: 'score has changed between month#' month_has_not_changed: 'score has not changed between month#' filters: @fieldList - plugins: + plugins: { + 'select2': 'select2' 'sortable': { 'inherit_no_sortable': false, 'inherit_no_drop': false } + } setRuleFromSavedSearch: -> self = @ diff --git a/app/assets/javascripts/calls/index.coffee b/app/assets/javascripts/calls/index.coffee index f54f20c4a9..4a175e63fa 100644 --- a/app/assets/javascripts/calls/index.coffee +++ b/app/assets/javascripts/calls/index.coffee @@ -47,36 +47,6 @@ CIF.CallsIndex = do -> deleteGroup: $('#builder, #wizard-builder').data('filter-translation-delete-group') $('#call-search-btn').val($('#call-search-btn').data('search')) - $.fn.queryBuilder.define 'select2', ((options) -> - if !$.fn.select2 or !$.fn.select2.constructor - Utils.error 'MissingLibrary', 'Select2 is required' - Selectors = $(".rule-operator-container [name$=_operator], .rule-filter-container [name$=_filter]") - if Selectors - @on 'afterCreateRuleFilters', (e, rule) -> - rule.$el.find(".rule-filter-container [name$=_filter]").select2 options - return - @on 'afterCreateRuleOperators', (e, rule) -> - rule.$el.find(".rule-operator-container [name$=_operator]").select2 options - return - @on 'afterUpdateRuleFilter', (e, rule) -> - rule.$el.find(".rule-filter-container [name$=_filter]").select2 options - rule.$el.find(".rule-value-container [name*=_value_]").select2(dropdownAutoWidth: true) - return - @on 'afterUpdateRuleOperator', (e, rule) -> - rule.$el.find(".rule-operator-container [name$=_operator]").select2 options - rule.$el.find(".rule-value-container [name*=_value_]").select2(dropdownAutoWidth: true) - return - @on 'beforeDeleteRule', (e, rule) -> - rule.$el.find(".rule-filter-container [name$=_filter]").select2 'destroy' - rule.$el.find(".rule-operator-container [name$=_operator]").select2 'destroy' - return - return - ), - container: 'body' - style: 'btn-inverse btn-xs' - width: '250px' - dropdownAutoWidth: true - showIcon: false filters = $("#call-builder-fields").data('fields') $('#builder').queryBuilder diff --git a/app/assets/javascripts/client_advance_search.coffee b/app/assets/javascripts/client_advance_search.coffee index 3adad2c526..3e5943c2d9 100644 --- a/app/assets/javascripts/client_advance_search.coffee +++ b/app/assets/javascripts/client_advance_search.coffee @@ -53,7 +53,7 @@ class CIF.ClientAdvanceSearch filterSelectChange: -> self = @ - $('.rule-filter-container select').on 'select2-close', -> + $('.rule-filter-container select').on 'select2:close', -> ruleParentId = $(@).closest("div[id^='builder_rule']").attr('id') setTimeout ( -> $("##{ruleParentId} .rule-operator-container select, .rule-value-container select").select2(width: 'resolve') @@ -93,16 +93,23 @@ class CIF.ClientAdvanceSearch initSelect2: -> $('#custom-form-select, #wizard-custom-form-select, #program-stream-select, #wizard-program-stream-select, #quantitative-case-select').select2() - $('#builder select').select2() - $('#wizard-builder select').select2() - setTimeout ( -> - ids = ['#custom-form-select', '#wizard-custom-form-select', '#program-stream-select', '#wizard-program-stream-select', '#quantitative-case-select', '#wizard-builder', '#builder'] - $.each ids, (index, item) -> - $("#{item} .rule-filter-container select").select2(width: '250px') - $("#{item} .rule-operator-container select, .rule-value-container select").select2(width: 'resolve') - ) + # $('#builder select').select2 + # width: '250px' + + $('#wizard-builder select').select2 + width: '250px' + + # setTimeout ( -> + # ids = ['#custom-form-select', '#wizard-custom-form-select', '#program-stream-select', '#wizard-program-stream-select', '#quantitative-case-select', '#wizard-builder', '#builder'] + # $.each ids, (index, item) -> + # $("#{item} .rule-filter-container select").select2 + # width: '250px' + + # $("#{item} .rule-operator-container select, .rule-value-container select").select2 + # width: 'resolve' + # ) - $('.csi-group select').select2(minimumResultsForSearch: -1).on 'select2-open', -> + $('.csi-group select').select2(minimumResultsForSearch: -1).on 'select2:open', -> selectWrapper = $(@).closest('.csi-group') if selectWrapper.offset().top > 840 $('html, body').animate { scrollTop: selectWrapper.offset().top }, "fast" @@ -125,20 +132,20 @@ class CIF.ClientAdvanceSearch initRuleOperatorSelect2: (rowBuilderRule) -> operatorSelect = $(rowBuilderRule).find('.rule-operator-container select') - $(operatorSelect).on 'select2-close', -> + $(operatorSelect).on 'select2:close', -> setTimeout ( -> - $(rowBuilderRule).find('.rule-value-container select').select2(width: '180px') + $(rowBuilderRule).find('.rule-value-container select').select2(width: '1180px') ) ###################################################################################################################### customFormSelectChange: -> self = @ - $('.main-report-builder .custom-form-wrapper select').on 'select2-selecting', (element) -> + $('.main-report-builder .custom-form-wrapper select').on 'select2:selecting', (element) -> self.customFormSelected.push(element.val) self.addCustomBuildersFields(element.val, self.CUSTOM_FORM_URL) - $('#report-builder-wizard .custom-form-wrapper select').on 'select2-selecting', (element) -> + $('#report-builder-wizard .custom-form-wrapper select').on 'select2:selecting', (element) -> $('#custom-form-column').addClass('hidden') $('#wizard-custom-form .loader').removeClass('hidden') self.wizardCustomFormSelected.push(element.val) @@ -235,7 +242,7 @@ class CIF.ClientAdvanceSearch customFormSelectRemove: -> self = @ - $('.main-report-builder .custom-form-wrapper select').on 'select2-removed', (element) -> + $('.main-report-builder .custom-form-wrapper select').on 'select2:unselect', (element) -> removeValue = element.choice.text formTitle = removeValue.trim() formTitle = self.formatSpecialCharacter("#{formTitle} Custom Form") @@ -246,7 +253,7 @@ class CIF.ClientAdvanceSearch self.handleRemoveFilterBuilder(removeValue, self.CUSTOM_FORM_TRANSLATE) - $('#report-builder-wizard .custom-form-wrapper select').on 'select2-removed', (element) -> + $('#report-builder-wizard .custom-form-wrapper select').on 'select2:unselect', (element) -> removeValue = element.choice.text formTitle = removeValue.trim() formTitle = self.formatSpecialCharacter("#{formTitle} Custom Form") @@ -317,7 +324,7 @@ class CIF.ClientAdvanceSearch handleProgramSelectChange: -> self = @ - $('.main-report-builder select.program-stream-select').on 'select2-selecting', (psElement) -> + $('.main-report-builder select.program-stream-select').on 'select2:selecting', (psElement) -> programId = psElement.val self.programSelected.push programId $('.main-report-builder .program-association').show() @@ -332,7 +339,7 @@ class CIF.ClientAdvanceSearch self.LOADER.start() self.addCustomBuildersFields(programId, self.EXIT_PROGRAM_URL, self.LOADER) - $('#report-builder-wizard select.program-stream-select').on 'select2-selecting', (psElement) -> + $('#report-builder-wizard select.program-stream-select').on 'select2:selecting', (psElement) -> programId = psElement.val self.wizardProgramSelected.push programId $('#report-builder-wizard .program-association').show() @@ -535,21 +542,21 @@ class CIF.ClientAdvanceSearch select2Csi = '#builder_group_0 .rules-list .rule-container .rule-filter-container > select' wizardCsi = '#report-builder-wizard-modal .rules-list .rule-container .rule-filter-container > select' - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> elements = $('.select2-results .select2-results-dept-0') $.each elements, (index, item) -> if item.firstElementChild.textContent == customCsiGroupTranslate $(item).hide() - $(document).on 'select2-open', wizardCsi, (e)-> + $(document).on 'select2:open', wizardCsi, (e)-> elements = $('.select2-results .select2-results-dept-0') $.each elements, (index, item) -> if item.firstElementChild.textContent == customCsiGroupTranslate $(item).hide() - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> selectCsiGroup = '.csi-group .rules-list .rule-container:nth-child(2) .rule-filter-container > select' - $(document).on 'select2-open', selectCsiGroup, (e)-> + $(document).on 'select2:open', selectCsiGroup, (e)-> elements = $('.select2-results .select2-results-dept-0') $.each elements, (index, item) -> if item.firstElementChild.textContent == customCsiGroupTranslate @@ -562,11 +569,11 @@ class CIF.ClientAdvanceSearch wizardFilter = '#report-builder-wizard-modal .rules-list .rule-container .rule-filter-container > select' wizardOperator = '#report-builder-wizard-modal .rules-list .rule-container .rule-operator-container > select' - $(document).on 'select2-selected', wizardFilter, (e)-> + $(document).on 'select2:select', wizardFilter, (e)-> setTimeout (-> $(wizardOperator).select2(width: 'resolve') ), - $(document).on 'select2-open', wizardOperator, (e)-> + $(document).on 'select2:open', wizardOperator, (e)-> elements = $('.select2-results .select2-results-dept-0') $.each elements, (index, item) -> if item.textContent.match(/has.*change|average/g) @@ -581,23 +588,23 @@ class CIF.ClientAdvanceSearch customCsiDomainScoresTranslate = $('#hidden_custom_csi_domain_scores').val() select2Csi = '.csi-group .rules-list .rule-container:nth-child(1) .rule-filter-container > select' - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> elements = $('.select2-results .select2-results-dept-0') handleCsiOption(elements, "#{csiDomainScoresTranslate}-#{customCsiDomainScoresTranslate}") select2Csi = '.csi-group .rules-list .rule-container:nth-child(2) .rule-filter-container > select' - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> elements = $('.select2-results .select2-results-dept-0') handleCsiOption(elements, customCsiGroupTranslate, 'second-child') select2Csi = '.csi-group .rules-list .rule-container:nth-child(3) .rule-filter-container > select' - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> elements = $('.select2-results .select2-results-dept-0') handleCsiOption(elements, customCsiGroupTranslate, 'third-child') handleAllDomainOperatorOpen: -> select2Csi = '.csi-group .rules-list .rule-container:nth-child(1) .rule-operator-container > select' - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> group = window.customGroup[$(@).closest('.csi-group').attr('id')] if $("##{group.id} option[value='all_domains']:selected").length > 0 || $("##{group.id} option[value='all_custom_domains']:selected").length > 0 elements = $('.select2-results .select2-results-dept-0') @@ -642,7 +649,7 @@ class CIF.ClientAdvanceSearch hideAverageFromIndividualDomainScore: -> select2Operator = '.csi-group .rules-list .rule-container:nth-child(1) .rule-operator-container > select' - $(document).on 'select2-open', select2Operator, (e)-> + $(document).on 'select2:open', select2Operator, (e)-> elements = $('.select2-results .select2-results-dept-0') if $(this.parentElement.parentElement).find('.rule-filter-container').find('option[value="all_domains"]:selected').length == 0 and $(this.parentElement.parentElement).find('.rule-filter-container').find('option[value="all_custom_domains"]:selected').length == 0 $.each elements, (index, item) -> @@ -656,7 +663,7 @@ class CIF.ClientAdvanceSearch handleSelect2RemoveProgram: -> self = @ programStreamKeyword = ['Enrollment', 'Tracking', 'Exit Program'] - $('.main-report-builder .program-stream-select').on 'select2-removed', (element) -> + $('.main-report-builder .program-stream-select').on 'select2:unselect', (element) -> programName = element.choice.text self.removeCheckboxColumnPickers(programStreamKeyword, programName, self) @@ -671,7 +678,7 @@ class CIF.ClientAdvanceSearch $(programStreamAssociation).find('.i-checks').iCheck('uncheck') $(programStreamAssociation).hide() - $('#report-builder-wizard .program-stream-select').on 'select2-removed', (element) -> + $('#report-builder-wizard .program-stream-select').on 'select2:unselect', (element) -> programName = element.choice.text self.removeCheckboxColumnPickers(programStreamKeyword, programName, self) @@ -891,7 +898,7 @@ class CIF.ClientAdvanceSearch if obj != undefined rowBuilderRule = obj.$el[0] ruleFiltersSelect = $(rowBuilderRule).find('.rule-filter-container select') - $(ruleFiltersSelect).on 'select2-close', -> + $(ruleFiltersSelect).on 'select2:close', -> ruleParentId = $(@).closest("div[id^='builder_rule']").attr('id') setTimeout ( -> $("##{ruleParentId} .rule-operator-container select, .rule-value-container select").select2(width: 'resolve') @@ -909,7 +916,7 @@ class CIF.ClientAdvanceSearch ###################################################################################################################### filterSelecting: -> - $(document).on 'select2-open', '.rule-value-container input.form-control', (e)-> + $(document).on 'select2:open', '.rule-value-container input.form-control', (e)-> ruleParentElement = $(this.parentElement.parentElement) filterValue = ruleParentElement.find('.rule-filter-container').find('option[value^="domainscore"]:selected') allDomainFilter = ruleParentElement.find('.rule-filter-container').find('option[value="all_domains"]:selected') @@ -930,7 +937,7 @@ class CIF.ClientAdvanceSearch ) disableOptions: -> - $(document).on 'select2-selected', '.rule-operator-container select', (e)-> + $(document).on 'select2:select', '.rule-operator-container select', (e)-> ruleParentElement = $(this.parentElement.parentElement) schoolGradeFilter = ruleParentElement.find('.rule-filter-container').find('option[value="school_grade"]:selected') betweenOperator = ruleParentElement.find('.rule-operator-container').find('option[value="between"]:selected') diff --git a/app/assets/javascripts/clients/index.coffee b/app/assets/javascripts/clients/index.coffee index 95f95f648a..73ccec424a 100644 --- a/app/assets/javascripts/clients/index.coffee +++ b/app/assets/javascripts/clients/index.coffee @@ -533,7 +533,6 @@ CIF.ClientsIndex = do -> minimumInputLength: 0 allowClear: true dropdownAutoWidth : true - width: 'auto' _formatReportxAxis = -> Highcharts.setOptions global: useUTC: false @@ -731,12 +730,12 @@ CIF.ClientsIndex = do -> $(document).on 'change', select2CsiOperator, (param)-> filterSelected = $(this).parent().siblings().closest('.rule-filter-container').find('select option:selected').val() - if filterSelected.match(/domainscore_/g) || filterSelected.match(/all_domains/g) + if filterSelected && (filterSelected.match(/domainscore_/g) || filterSelected.match(/all_domains/g)) _addSelectionOption(this, param) $(document).on 'change', wizardCsiFilter, (param)-> filterSelected = $(this).parent().siblings().closest('.rule-filter-container').find('select option:selected').val() - if filterSelected.match(/domainscore_/g) || filterSelected.match(/all_domains/g) + if filterSelected && (filterSelected.match(/domainscore_/g) || filterSelected.match(/all_domains/g)) _addSelectionOption(this, param) _handleDomainScoreFilterValue = -> @@ -744,11 +743,11 @@ CIF.ClientsIndex = do -> wizardCsiFilter = '#report-builder-wizard-modal .rules-list .rule-container .rule-filter-container select' $(document).on 'change', select2CsiFilter, (param)-> - if param.val.match(/domainscore_/g) || param.val.match(/all_domains/g) + if param.val && (param.val.match(/domainscore_/g) || param.val.match(/all_domains/g)) _addSelectionOption(this, param) $(document).on 'change', wizardCsiFilter, (param)-> - if param.val.match(/domainscore_/g) || param.val.match(/all_domains/g) + if param.val && (param.val.match(/domainscore_/g) || param.val.match(/all_domains/g)) _addSelectionOption(this, param) _reloadFilter = -> diff --git a/app/assets/javascripts/common.coffee b/app/assets/javascripts/common.coffee index b154e14563..6cfb6c1921 100644 --- a/app/assets/javascripts/common.coffee +++ b/app/assets/javascripts/common.coffee @@ -1,5 +1,6 @@ CIF.Common = init: -> + @queryBuilderSelect2PluginInit() @hideDynamicOperator() @validateFilterNumber() @customCheckBox() @@ -12,6 +13,38 @@ CIF.Common = @confirmOnCancelBotton() $.fn.select2.defaults.set( "theme", "bootstrap" ) + queryBuilderSelect2PluginInit: -> + $.fn.queryBuilder.define 'select2', ((options) -> + if !$.fn.select2 or !$.fn.select2.constructor + Utils.error 'MissingLibrary', 'Select2 is required' + Selectors = $(".rule-operator-container [name$=_operator], .rule-filter-container [name$=_filter]") + if Selectors + @on 'afterCreateRuleFilters', (e, rule) -> + rule.$el.find(".rule-filter-container select[name$=_filter]").select2 options + return + @on 'afterCreateRuleOperators', (e, rule) -> + rule.$el.find(".rule-operator-container select[name$=_operator]").select2 options + return + @on 'afterUpdateRuleFilter', (e, rule) -> + rule.$el.find(".rule-filter-container [name$=_filter]").select2 options + rule.$el.find(".rule-value-container select[name*=_value_]").select2(dropdownAutoWidth: true) + return + @on 'afterUpdateRuleOperator', (e, rule) -> + rule.$el.find(".rule-operator-container [name$=_operator]").select2 options + rule.$el.find(".rule-value-container select[name*=_value_]").select2(dropdownAutoWidth: true) + return + @on 'beforeDeleteRule', (e, rule) -> + rule.$el.find(".rule-filter-container select[name$=_filter]").select2 'destroy' + rule.$el.find(".rule-operator-container select[name$=_operator]").select2 'destroy' + return + return + ), + container: 'body' + style: 'btn-inverse btn-xs' + width: '250px' + dropdownAutoWidth: true + showIcon: false + preventEditOnDatePicker: -> $('.date-picker').datepicker autoclose: true, diff --git a/app/assets/stylesheets/dashboards/index.scss b/app/assets/stylesheets/dashboards/index.scss index ef1252c14e..e83eda9b34 100644 --- a/app/assets/stylesheets/dashboards/index.scss +++ b/app/assets/stylesheets/dashboards/index.scss @@ -181,16 +181,4 @@ body[id="dashboards-index"] { cursor: not-allowed; color: #333333 !important; } - - #client-search { - } - .select2-container.select2-container--bootstrap.select2-container--open { - z-index: 9999 !important; - } - - .select2-container--bootstrap .select2-results__option--highlighted { - a { - color: white; - } - } } diff --git a/app/assets/stylesheets/form.scss b/app/assets/stylesheets/form.scss index 006ff43f58..8c6275a60d 100644 --- a/app/assets/stylesheets/form.scss +++ b/app/assets/stylesheets/form.scss @@ -49,3 +49,13 @@ select + .select2-container { width: 100% !important; } + +.select2-container.select2-container--bootstrap.select2-container--open { + z-index: 9999 !important; +} + +.select2-container--bootstrap .select2-results__option--highlighted { + a { + color: white; + } +} diff --git a/app/classes/advanced_searches/client_advanced_search.rb b/app/classes/advanced_searches/client_advanced_search.rb index d07c4a7f17..ddfee1c9d0 100644 --- a/app/classes/advanced_searches/client_advanced_search.rb +++ b/app/classes/advanced_searches/client_advanced_search.rb @@ -9,6 +9,8 @@ def initialize(basic_rules, clients, overdue_assessment = false) def filter query_array = [] rules = [] + return Client.where(id: []) if @basic_rules && @basic_rules['rules'].blank? + client_base_sql = AdvancedSearches::ClientBaseSqlBuilder.new(@clients, @basic_rules).generate query_array << client_base_sql[:sql_string] client_base_sql[:values].each{ |v| query_array << v } diff --git a/app/controllers/api/communes_controller.rb b/app/controllers/api/communes_controller.rb index 309f9fc6ee..f995c47fbc 100644 --- a/app/controllers/api/communes_controller.rb +++ b/app/controllers/api/communes_controller.rb @@ -3,7 +3,7 @@ class CommunesController < Api::ApplicationController def index data = District.find(params[:district_id]).communes render json: { - data: ActiveModel::Serializer::CollectionSerializer.new(data, each_serializer: CommuneSerializer) + data: ActiveModel::Serializer::CollectionSerializer.new(data, each_serializer: CommuneSerializer).to_json } end end diff --git a/app/controllers/api/villages_controller.rb b/app/controllers/api/villages_controller.rb index 1d8532f3b0..bb4b67e025 100644 --- a/app/controllers/api/villages_controller.rb +++ b/app/controllers/api/villages_controller.rb @@ -3,7 +3,7 @@ class VillagesController < Api::ApplicationController def index data = Commune.find(params[:commune_id]).villages render json: { - data: ActiveModel::Serializer::CollectionSerializer.new(data, each_serializer: VillageSerializer) + data: ActiveModel::Serializer::CollectionSerializer.new(data, each_serializer: VillageSerializer).to_json } end end diff --git a/app/controllers/concerns/client_advanced_searches_concern.rb b/app/controllers/concerns/client_advanced_searches_concern.rb index c29e92b91f..03c20725e0 100644 --- a/app/controllers/concerns/client_advanced_searches_concern.rb +++ b/app/controllers/concerns/client_advanced_searches_concern.rb @@ -6,12 +6,13 @@ def advanced_search advanced_search = AdvancedSearch.find(params[:advanced_search_id]) basic_rules = advanced_search.queries else - basic_rules = JSON.parse @basic_filter_params || @wizard_basic_filter_params + basic_rules = JSON.parse @basic_filter_params || @wizard_basic_filter_params end $param_rules = find_params_advanced_search + clients = AdvancedSearches::ClientAdvancedSearch.new(basic_rules, Client.accessible_by(current_ability)) + @clients_by_user = clients.filter - @clients_by_user = clients.filter columns_visibility custom_form_column program_stream_column diff --git a/app/javascript/components/EditCall/index.js b/app/javascript/components/EditCall/index.js index 4ab4999812..f0d36ccf8d 100644 --- a/app/javascript/components/EditCall/index.js +++ b/app/javascript/components/EditCall/index.js @@ -1,36 +1,50 @@ -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect } from "react"; import { SelectInput, TextInput, RadioGroup, DateInput, TextArea, - DateTimePicker -} from '../Commons/inputs' + DateTimePicker, +} from "../Commons/inputs"; -import './styles.scss' +import "./styles.scss"; -import { setDefaultLanguage } from './helper' +import { setDefaultLanguage } from "./helper"; -export default props => { - const { data: { users, call, step } } = props +export default (props) => { + const { + data: { users, call, step }, + } = props; - const [loading, setLoading] = useState(false) - const [errorFields, setErrorFields] = useState([]) - const [callData, setCallData] = useState(call) - const userLists = users.map(user => ({label: user[0], value: user[1], isFixed: user[2] === 'locked' ? true : false })) - var url = window.location.href.split("&").slice(-1)[0].split("=")[1] + const [loading, setLoading] = useState(false); + const [errorFields, setErrorFields] = useState([]); + const [callData, setCallData] = useState(call); + const userLists = users.map((user) => ({ + label: user[0], + value: user[1], + isFixed: user[2] === "locked" ? true : false, + })); + var url = window.location.href.split("&").slice(-1)[0].split("=")[1]; - let T = setDefaultLanguage(url) + let T = setDefaultLanguage(url); const answeredCallOpts = [ - { label: T.translate("newCall.refereeInfo.answeredCallOpts.call_answered"), value: true }, - { label: T.translate("newCall.refereeInfo.answeredCallOpts.return_missed_call"), value: false } + { + label: T.translate("newCall.refereeInfo.answeredCallOpts.call_answered"), + value: true, + }, + { + label: T.translate( + "newCall.refereeInfo.answeredCallOpts.return_missed_call" + ), + value: false, + }, ]; const calledBeforeOpts = [ { label: T.translate("newCall.refereeInfo.yes"), value: true }, - { label: T.translate("newCall.refereeInfo.no"), value: false } + { label: T.translate("newCall.refereeInfo.no"), value: false }, ]; const callTypes = [ @@ -40,86 +54,102 @@ export default props => { T.translate("editCall.index.calltypes.phone_conseling"), T.translate("editCall.index.calltypes.seeking_information"), T.translate("editCall.index.calltypes.spam_call"), - T.translate("editCall.index.calltypes.wrong_number") + T.translate("editCall.index.calltypes.wrong_number"), ]; - const callTypeList = callTypes.map(type => ( - { label: type, value: type, isFixed: false } - )); + const callTypeList = callTypes.map((type) => ({ + label: type, + value: type, + isFixed: false, + })); - const noClientAttached = callData.call_type === "Seeking Information" || callData.call_type === "Spam Call" || callData.call_type === "Wrong Number" - const seekingInformation = callData.call_type === "Seeking Information" + const noClientAttached = + callData.call_type === "Seeking Information" || + callData.call_type === "Spam Call" || + callData.call_type === "Wrong Number"; + const seekingInformation = callData.call_type === "Seeking Information"; - const onChange = (obj, field) => event => { - const inputType = ['date', 'select', 'checkbox', 'radio', 'datetime'] - const value = inputType.includes(event.type) ? event.data : event.target.value + const onChange = (obj, field) => (event) => { + const inputType = ["date", "select", "checkbox", "radio", "datetime"]; + const value = inputType.includes(event.type) + ? event.data + : event.target.value; - if (typeof field !== 'object') - field = { [field]: value } + if (typeof field !== "object") field = { [field]: value }; switch (obj) { - case 'call': - setCallData({...callData, ...field}) + case "call": + setCallData({ ...callData, ...field }); break; } - } + }; const handleCancel = () => { - document.location.href = `/calls/${callData.id}${window.location.search}` - } + document.location.href = `/calls/${callData.id}${window.location.search}`; + }; const handleSave = () => { - if(handleValidation()) { + if (handleValidation()) { $.ajax({ url: `/api/v1/calls/${callData.id}`, - type: 'PUT', + type: "PUT", data: { - call: { ...callData } + call: { ...callData }, }, beforeSend: (req) => { - setLoading(true) - } + setLoading(true); + }, }) - .success(response => { - const clientUrls = response.client_urls; - const message = T.translate("editCall.index.message.call_has_been_updated") + .success((response) => { + const clientUrls = response.client_urls; + const message = T.translate( + "editCall.index.message.call_has_been_updated" + ); - document.location.href = `/calls/${response.call.id}?notice=${message}&locale=${url}` - if (clientUrls) { - clientUrls.forEach(url => { - window.open(`${url}?notice=${message}`, '_blank'); - }); - } - }).error((res) => { - onerror(res.responseText) - }) + document.location.href = `/calls/${response.call.id}?notice=${message}&locale=${url}`; + if (clientUrls) { + clientUrls.forEach((url) => { + window.open(`${url}?notice=${message}`, "_blank"); + }); + } + }) + .error((res) => { + onerror(res.responseText); + }); } - } + }; const handleValidation = () => { - const validationFields = seekingInformation ? ['receiving_staff_id', 'date_of_call', 'start_datetime', 'information_provided'] : ['receiving_staff_id', 'date_of_call', 'start_datetime'] - const errors = [] + const validationFields = seekingInformation + ? [ + "receiving_staff_id", + "date_of_call", + "start_datetime", + "information_provided", + ] + : ["receiving_staff_id", "date_of_call", "start_datetime"]; + const errors = []; - validationFields.forEach(field => { + validationFields.forEach((field) => { if (callData[field] === null) { - errors.push(field) - } else if(callData[field].length < 1) { - errors.push(field) + errors.push(field); + } else if (callData[field].length < 1) { + errors.push(field); } - }) + }); - if(errors.length > 0) { - setErrorFields(errors) - return false + if (errors.length > 0) { + setErrorFields(errors); + return false; } else { - setErrorFields([]) - return true + setErrorFields([]); + return true; } - } + }; return ( - <> - + <> +

{T.translate("editCall.index.call_information")}

@@ -155,19 +185,19 @@ export default props => {
-
-
+
+
-
+
{/* { T={T} type="date" required - isError={errorFields.includes('date_of_call')} + isError={errorFields.includes("date_of_call")} label={T.translate("editCall.index.date_of_call")} - onChange={onChange('call', 'date_of_call')} + onChange={onChange("call", "date_of_call")} value={callData.date_of_call} />
-
-
+
+
{/* {
-
-
+
+
+ onChange={onChange("call", "call_type")} + />
- { noClientAttached ? + {noClientAttached ? (