From dcfb92ffad41618a083394bdc7f40732b1faf4f2 Mon Sep 17 00:00:00 2001 From: Nicolas Beiro LeBeau Date: Tue, 5 May 2020 15:42:52 -0400 Subject: [PATCH 01/21] audits --- app/views/audits/_index_table.html.haml | 121 +++++++++++++++++------- 1 file changed, 85 insertions(+), 36 deletions(-) diff --git a/app/views/audits/_index_table.html.haml b/app/views/audits/_index_table.html.haml index 0108ec8..16afa91 100644 --- a/app/views/audits/_index_table.html.haml +++ b/app/views/audits/_index_table.html.haml @@ -1,42 +1,91 @@ :ruby table_dom_id = SecureRandom.hex -.table-responsive - %table.table.table-hover{:id => table_dom_id, :data => {:toggle => 'table', - :pagination => 'true', - :show_pagination_switch => 'false', - :page_list => "[5, 10, 20, 50, 100, 200, 10000]", - :page_size => current_user.num_table_rows, - :search => 'false', - :toolbar => "#table_actions", - :export_types => "['csv', 'txt', 'excel']", - :show_export => 'false', - :show_columns => 'false', - :show_toggle => 'false', - :cookie => 'true', - :cookie_id_table => "auditsid", - :cookie_expire => "1y"}} - %thead - %tr - %th.center{:data => {:sortable => 'true'}} Name - %th.center{:data => {:sortable => 'true'}} Description - %th.center{:data => {:sortable => 'true'}} Instructions - -# %th.center{:data => {:sortable => 'true'}} Schedule - %th.center{:data => {:sortable => 'true'}} Last Run - %th.center{:data => {:sortable => 'true'}} Operational - %th.center{:data => {:sortable => 'true'}} Active - %th.center{:data => {:sortable => 'true'}} Updated At - %tbody - - audits.each do |a| - %tr{:id => a.object_key, :class => 'action-path'} - %td.left.nowrap= a.name - %td.left= format_as_text(a.description) - %td.left= format_as_text(a.instructions) - -# %td.left= link_to a.activity, activity_path(a.activity) if a.activity.present? - %td.center.nowrap= format_as_date(a.last_run) - %td.center= format_as_boolean(a.operational?) - %td.center= format_as_boolean(a.active) - %td.center.nowrap= format_as_date(a.updated_at) + += javascript_include_tag "https://kit.fontawesome.com/#{ENV['FONT_AWESOME']}.js" +.library-table + %table.elbat{:id => table_dom_id, + :use => 'true', + :data => {:use => 'true', + :side => 'client', + :current_page => '0', + :current_page_size => '10', + :page_sizes => "10,20,50,100,200", + :search => 'client', + :export => "['csv', 'txt', 'excel']", + :columns => "Name,, + Description,, + Instructions,, + Schedule,, + Last Run,, + Operational,, + Active,, + Updated At,,", + :selected_columns => "Name, + Description, + Instructions, + Last Run, + Operational, + Active, + Updated At", + :cookies => "true", + :sort => 'client', + :sort_params => @params, + :filter => "[]", + :data_source => 'client', + :url => ''}} + - audits.each_with_index do |a, index| + :javascript + add_row('#{table_dom_id}', + { + "Name": '#{h a.name }', // need link to + "Description": '#{h format_as_text(a.description) }', + "Instructions": '#{h format_as_text(a.instructions) }', + "Schedule": '#{h link_to a.activity, activity_path(a.activity) if a.activity.present? }', + "Last Run": '#{h format_as_date(a.last_run) }', + "Operational": "#{h format_as_boolean(a.operational?) }", + "Active": "#{h format_as_boolean(a.active) }", + "Updated At": '#{h format_as_date(a.updated_at) }', + + }, #{index}); + +-#.table-responsive +-# %table.table.table-hover{:id => table_dom_id, :data => {:toggle => 'table', +-# :pagination => 'true', +-# :show_pagination_switch => 'false', +-# :page_list => "[5, 10, 20, 50, 100, 200, 10000]", +-# :page_size => current_user.num_table_rows, +-# :search => 'false', +-# :toolbar => "#table_actions", +-# :export_types => "['csv', 'txt', 'excel']", +-# :show_export => 'false', +-# :show_columns => 'false', +-# :show_toggle => 'false', +-# :cookie => 'true', +-# :cookie_id_table => "auditsid", +-# :cookie_expire => "1y"}} +-# %thead +-# %tr +-# %th.center{:data => {:sortable => 'true'}} Name +-# %th.center{:data => {:sortable => 'true'}} Description TEST +-# %th.center{:data => {:sortable => 'true'}} Instructions +-# -# %th.center{:data => {:sortable => 'true'}} Schedule +-# %th.center{:data => {:sortable => 'true'}} Last Run +-# %th.center{:data => {:sortable => 'true'}} Operational +-# %th.center{:data => {:sortable => 'true'}} Active +-# %th.center{:data => {:sortable => 'true'}} Updated At +-# +-# %tbody +-# - audits.each do |a| +-# %tr{:id => a.object_key, :class => 'action-path'} +-# %td.left.nowrap= a.name +-# %td.left= format_as_text(a.description) +-# %td.left= format_as_text(a.instructions) +-# -# %td.left= link_to a.activity, activity_path(a.activity) if a.activity.present? +-# %td.center.nowrap= format_as_date(a.last_run) +-# %td.center= format_as_boolean(a.operational?) +-# %td.center= format_as_boolean(a.active) +-# %td.center.nowrap= format_as_date(a.updated_at) = render :partial => 'shared/table_scripts', :locals => {:table_id => table_dom_id, :path_pattern => audit_path("xxx")} From 3ffa40df68630181c6ffa291d19f8b6e9a240688 Mon Sep 17 00:00:00 2001 From: Derek Edwards Date: Tue, 5 May 2020 16:27:42 -0400 Subject: [PATCH 02/21] Update version. --- Gemfile | 2 +- lib/transam_audit/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 95a428a..d073c6f 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem 'active_record-acts_as', git: 'https://github.com/camsys/active_record-acts_ # To use debugger # gem 'debugger' -gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter1 +gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter2 gem 'mysql2', "~> 0.5.1" # lock gem for dummy app gem "capybara", '2.6.2' # lock gem for old capybara behavior on hidden element xpath gem 'sass-rails' diff --git a/lib/transam_audit/version.rb b/lib/transam_audit/version.rb index edeeb31..1acc71f 100644 --- a/lib/transam_audit/version.rb +++ b/lib/transam_audit/version.rb @@ -1,3 +1,3 @@ module TransamAudit - VERSION = "2.7.0" + VERSION = "2.11.0-rc.X" end From ce78ef89a35e80a63760e49da6f139429d3ca2f6 Mon Sep 17 00:00:00 2001 From: NJBL Date: Thu, 7 May 2020 01:14:30 -0400 Subject: [PATCH 03/21] audit results firsrt pass --- .../_index_asset_table.html.haml | 258 ++++++++++-------- 1 file changed, 137 insertions(+), 121 deletions(-) diff --git a/app/views/audit_results/_index_asset_table.html.haml b/app/views/audit_results/_index_asset_table.html.haml index c71964b..b6d488e 100644 --- a/app/views/audit_results/_index_asset_table.html.haml +++ b/app/views/audit_results/_index_asset_table.html.haml @@ -1,126 +1,142 @@ +:ruby + table_dom_id = SecureRandom.hex + + + #table_actions.btn-toolbar = render :partial => "index_actions" -.table-responsive - %table.table.table-hover{:id => 'audit_results_table', :data => {:toggle => 'table', - :pagination => 'true', - :show_pagination_switch => 'false', - :page_list => "[5, 10, 20, 50, 100, 200, 10000]", - :page_size => current_user.num_table_rows, - :search => 'false', - :toolbar => "#table_actions", - :export_types => "['csv', 'txt', 'excel']", - :show_export => 'false', - :resizable => 'true', - :show_columns => 'false', - :show_toggle => 'false', - :maintain_selected => 'true', - :single_select => 'false', - :cookie => 'true', - :cookie_id_table => "audit_results_assets_id", - :cookie_expire => "1y"}} - %thead - %tr - %th.center{:data => {:field => 'checked', :checkbox => 'true'}} - %th.center{:data => {:field => 'object_key', :visible => 'false'}} - - if @organization_list.count > 1 - %th.center{:data => {:field => 'org', :sortable => 'true'}} Org - %th.center{:data => {:sortable => 'true'}} Audit - %th.center{:data => {:field => 'object_type', :sortable => 'true'}} Type - %th.center{:data => {:sortable => 'true'}} Asset Tag - %th.center{:data => {:sortable => 'true'}} Description - %th.center{:data => {:sortable => 'true'}} Result - %th.center{:data => {:sortable => 'true'}} Updated At - %th.center{:data => {:sortable => 'true'}} Notes - - %tbody - - audit_results.each do |a| - -unless a.auditable.nil? #Don't show results for objects that have been deleted - %tr - %td - %td.center.nowrap= a.auditable.object_key - - if @organization_list.count > 1 - %td.left.nowrap= a.organization.short_name - %td.center.nowrap= a.audit - %td.left.nowrap= a.class_name - %td.left.nowrap - %span.hidden= a.auditable.asset_tag - = link_to a.auditable.asset_tag, inventory_path(a.auditable) - %td.left.nowrap= a.auditable.description - %td.center.nowrap= a.audit_result_type - %td.center.nowrap= format_as_date(a.updated_at) - %td.left= format_as_text(a.notes) -= render :partial => 'shared/table_scripts', :locals => {:table_id => 'audit_results_table', :path_pattern => activity_path("xxx")} -:javascript - - var selected_rows = new Set(); - var selected_states = new Set(); - - $(document).ready(function() { - - // Disable the table actions - enable_disable_table_actions(); - - // Add a handler for the print action which appends the selected orders to - // the href - $(".selected-action").on('click', function(e) { - - //get appropriate bulk update form and then update targets - $(this).parent().children("input[name='targets']").val(Array.from(selected_rows)); - return true; - }); - }); - - $('#audit_results_table').on('check.bs.table', function(e, row) { - update_selected(); - }).on('uncheck.bs.table', function(e, row) { - update_selected(); - }).on('check-all.bs.table', function(e, row) { - update_selected(); - }).on('uncheck-all.bs.table', function(e, row) { - update_selected(); - }).on('sort.bs.table', function(e, name, order) { - //console.log('Sorting on ' + name + ' dir => ' + order); - $('#audit_results_table').bootstrapTable('selectPage', 1); - }).on('load-success.bs.table', function() { - // Table reloaded, clear saved selection - selected_rows = new Set(); - selected_states = new Set(); - enable_disable_table_actions(); - }); - - // Enables or disables the package actions depending on how many are selected - function enable_disable_table_actions() { - var num = selected_rows.size; - if (num > 0) { - if (selected_states.size == 1) { - $('.selected-action').removeClass('disabled'); - } else { - $('.selected-action').addClass('disabled'); - } - } else { - $('.selected-action').addClass('disabled'); - } - }; - - // Updates the selected rows in the table - function update_selected() { - var selected = $('#audit_results_table').bootstrapTable('getSelections'); - selected_rows = new Set(); - selected_states = new Set(); - for (i = 0; i < selected.length; i++) { - //console.log(selected[i]); - selected_rows.add(selected[i].object_key); - selected_states.add(selected[i].org+"_"+selected[i].object_type.toLowerCase().replace(/ /g, "_")); - } - //console.log(selected_rows); - enable_disable_table_actions(); - }; - - // Removes an object identified by its object key from the set of objects selected - function remove_from_selected(object_key) { - selected_rows.delete(object_key); - enable_disable_table_actions(); - }; + +:css + + .col-item:nth-child(1){ + width:10%; + } + .col-item:nth-child(2){ + width:12%; + } + .col-item:nth-child(3){ + width:12%; + } + .col-item:nth-child(4){ + width:12%; + } + .col-item:nth-child(5){ + width:8%; + } + .col-item:nth-child(6){ + width:8%; + } + .col-item:nth-child(7){ + width:8%; + } + .col-item:nth-child(8){ + width:12%; + } + += javascript_include_tag "https://kit.fontawesome.com/#{ENV['FONT_AWESOME']}.js" +.library-table + %table.elbat{:id => table_dom_id, + :use => 'true', + :data => {:use => 'true', + :side => 'client', + :current_page => '0', + :current_page_size => '10', + :page_sizes => "10,20,50,100,200", + :search => 'client', + :export => "['csv', 'txt', 'excel']", + :columns => "Organization, + Audit Type, + Type, + Asset ID, + Description, + Result, + Updated At, + Notes,", + :selected_columns => "Organization, + Audit Type, + Type, + Asset ID, + Description, + Result, + Updated At, + Notes", + :cookies => "true", + :sort => 'client', + :params => "{}", + :filter => "[]", + :data_source => 'client', + :url => ''}} + + - audit_results.each_with_index do |a, index| + - unless a.auditable.nil? + :javascript + add_row('#{table_dom_id}', + { + "Organization": '#{h link_to a.organization.short_name }', + "Audit Type": '#{h a.audit }', + "Type": '#{h a.class_name }', + "Asset ID": '#{h a.auditable.asset_tag }', + "Description": '#{h a.auditable.description }', + "Result": '#{h a.audit_result_type }', + "Updated At": '#{h format_as_date(a.updated_at) }', + "Notes": '#{h format_as_text(a.notes).html_safe }', + }, #{index}); + + + + + +-# .table-responsive +-# %table.table.table-hover{:id => 'audit_results_table', :data => {:toggle => 'table', +-# :pagination => 'true', +-# :show_pagination_switch => 'false', +-# :page_list => "[5, 10, 20, 50, 100, 200, 10000]", +-# :page_size => current_user.num_table_rows, +-# :search => 'false', +-# :toolbar => "#table_actions", +-# :export_types => "['csv', 'txt', 'excel']", +-# :show_export => 'false', +-# :resizable => 'true', +-# :show_columns => 'false', +-# :show_toggle => 'false', +-# :maintain_selected => 'true', +-# :single_select => 'false', +-# :cookie => 'true', +-# :cookie_id_table => "audit_results_assets_id", +-# :cookie_expire => "1y"}} +-# %thead +-# %tr +-# %th.center{:data => {:field => 'checked', :checkbox => 'true'}} +-# %th.center{:data => {:field => 'object_key', :visible => 'false'}} +-# - if @organization_list.count > 1 +-# %th.center{:data => {:field => 'org', :sortable => 'true'}} Org +-# %th.center{:data => {:sortable => 'true'}} Audit +-# %th.center{:data => {:field => 'object_type', :sortable => 'true'}} Type +-# %th.center{:data => {:sortable => 'true'}} Asset Tag +-# %th.center{:data => {:sortable => 'true'}} Description +-# %th.center{:data => {:sortable => 'true'}} Result +-# %th.center{:data => {:sortable => 'true'}} Updated At +-# %th.center{:data => {:sortable => 'true'}} Notes + +-# %tbody +-# - audit_results.each do |a| +-# -unless a.auditable.nil? #Don't show results for objects that have been deleted +-# %tr +-# %td +-# %td.center.nowrap= a.auditable.object_key +-# - if @organization_list.count > 1 +-# %td.left.nowrap= a.organization.short_name +-# %td.center.nowrap= a.audit +-# %td.left.nowrap= a.class_name +-# %td.left.nowrap +-# %span.hidden= a.auditable.asset_tag +-# = link_to a.auditable.asset_tag, inventory_path(a.auditable) +-# %td.left.nowrap= a.auditable.description +-# %td.center.nowrap= a.audit_result_type +-# %td.center.nowrap= format_as_date(a.updated_at) +-# %td.left= format_as_text(a.notes) + += render :partial => 'shared/table_scripts', :locals => {:table_id => 'audit_results_table', :path_pattern => activity_path("xxx")} From 73a0616340714933721575ffa9c0932e71f38377 Mon Sep 17 00:00:00 2001 From: NJBL Date: Mon, 11 May 2020 04:01:05 -0400 Subject: [PATCH 04/21] audit results sanitize notes --- app/views/audit_results/_index_asset_table.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/audit_results/_index_asset_table.html.haml b/app/views/audit_results/_index_asset_table.html.haml index b6d488e..bda5d7e 100644 --- a/app/views/audit_results/_index_asset_table.html.haml +++ b/app/views/audit_results/_index_asset_table.html.haml @@ -82,7 +82,7 @@ "Description": '#{h a.auditable.description }', "Result": '#{h a.audit_result_type }', "Updated At": '#{h format_as_date(a.updated_at) }', - "Notes": '#{h format_as_text(a.notes).html_safe }', + "Notes": '#{h sanitize(a.notes, tags:[]).gsub("\n", ' ') }', }, #{index}); From 3fa4541d5815b7828f8e72a44fd05257b71d0b64 Mon Sep 17 00:00:00 2001 From: NJBL Date: Fri, 15 May 2020 10:56:25 -0400 Subject: [PATCH 05/21] audits drilldown, right align date --- app/views/audits/_index_table.html.haml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/views/audits/_index_table.html.haml b/app/views/audits/_index_table.html.haml index 16afa91..63e5e66 100644 --- a/app/views/audits/_index_table.html.haml +++ b/app/views/audits/_index_table.html.haml @@ -14,14 +14,14 @@ :page_sizes => "10,20,50,100,200", :search => 'client', :export => "['csv', 'txt', 'excel']", - :columns => "Name,, - Description,, - Instructions,, - Schedule,, - Last Run,, - Operational,, - Active,, - Updated At,,", + :columns => "Name,drilldown-link, + Description, + Instructions, + Schedule, + Last Run, + Operational, + Active, + Updated At,right-align", :selected_columns => "Name, Description, Instructions, @@ -39,9 +39,9 @@ :javascript add_row('#{table_dom_id}', { - "Name": '#{h a.name }', // need link to - "Description": '#{h format_as_text(a.description) }', - "Instructions": '#{h format_as_text(a.instructions) }', + "Name": '#{h link_to a.name, audit_path(a) }', + "Description": '#{h a.description }', + "Instructions": '#{h a.instructions }', "Schedule": '#{h link_to a.activity, activity_path(a.activity) if a.activity.present? }', "Last Run": '#{h format_as_date(a.last_run) }', "Operational": "#{h format_as_boolean(a.operational?) }", @@ -68,7 +68,7 @@ -# %thead -# %tr -# %th.center{:data => {:sortable => 'true'}} Name --# %th.center{:data => {:sortable => 'true'}} Description TEST +-# %th.center{:data => {:sortable => 'true'}} Description -# %th.center{:data => {:sortable => 'true'}} Instructions -# -# %th.center{:data => {:sortable => 'true'}} Schedule -# %th.center{:data => {:sortable => 'true'}} Last Run From 40e2fc75306c157337ba8e88b8db90fd846692e6 Mon Sep 17 00:00:00 2001 From: NJBL Date: Fri, 15 May 2020 15:16:26 -0400 Subject: [PATCH 06/21] full width --- app/views/audits/index.html.haml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/app/views/audits/index.html.haml b/app/views/audits/index.html.haml index 81564b4..462126c 100644 --- a/app/views/audits/index.html.haml +++ b/app/views/audits/index.html.haml @@ -1,15 +1,14 @@ -.col-sm-12.col-md-10.col-md-offset-1 - .page-header - %h2 Audits +.page-header + %h2 Audits - .row - .col-sm-12 - = render 'search_form' +.row + .col-sm-12 + = render 'search_form' - .row - .col-sm-12 - - if @audits.empty? - %p No matching audits found - - else - %p Found #{@audits.count} matching audits - = render :partial => 'index_table', :locals => {:audits => @audits} +.row + .col-sm-12 + - if @audits.empty? + %p No matching audits found + - else + %p Found #{@audits.count} matching audits + = render :partial => 'index_table', :locals => {:audits => @audits} From 9337ace0a8392d857293cf659dce3f3e1ea7ddbe Mon Sep 17 00:00:00 2001 From: NJBL Date: Fri, 15 May 2020 16:58:08 -0400 Subject: [PATCH 07/21] column widths and text formatting --- app/views/audits/_index_table.html.haml | 27 +++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/app/views/audits/_index_table.html.haml b/app/views/audits/_index_table.html.haml index 63e5e66..8366a31 100644 --- a/app/views/audits/_index_table.html.haml +++ b/app/views/audits/_index_table.html.haml @@ -1,7 +1,30 @@ :ruby table_dom_id = SecureRandom.hex +:css + .col-item:nth-child(2){ + width:10%; + } + .col-item:nth-child(3){ + width:30%; + } + .col-item:nth-child(4){ + width:30%; + } + .col-item:nth-child(5){ + width:8%; + } + .col-item:nth-child(6){ + width:8%; + } + .col-item:nth-child(7){ + width:8%; + } + .col-item:nth-child(8){ + width:8%; + } + = javascript_include_tag "https://kit.fontawesome.com/#{ENV['FONT_AWESOME']}.js" .library-table @@ -40,8 +63,8 @@ add_row('#{table_dom_id}', { "Name": '#{h link_to a.name, audit_path(a) }', - "Description": '#{h a.description }', - "Instructions": '#{h a.instructions }', + "Description": '#{h format_as_text(a.description) }', + "Instructions": '#{h format_as_text(a.instructions) }', "Schedule": '#{h link_to a.activity, activity_path(a.activity) if a.activity.present? }', "Last Run": '#{h format_as_date(a.last_run) }', "Operational": "#{h format_as_boolean(a.operational?) }", From dc017f3b73f4279fc23acda4765257993bbdeb87 Mon Sep 17 00:00:00 2001 From: NJBL Date: Tue, 19 May 2020 15:58:56 -0400 Subject: [PATCH 08/21] audit results column styles --- app/views/audit_results/_index_asset_table.html.haml | 4 ++-- app/views/audit_results/index.html.haml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/audit_results/_index_asset_table.html.haml b/app/views/audit_results/_index_asset_table.html.haml index bda5d7e..bad45f2 100644 --- a/app/views/audit_results/_index_asset_table.html.haml +++ b/app/views/audit_results/_index_asset_table.html.haml @@ -47,13 +47,13 @@ :page_sizes => "10,20,50,100,200", :search => 'client', :export => "['csv', 'txt', 'excel']", - :columns => "Organization, + :columns => "Organization,drilldown-link, Audit Type, Type, Asset ID, Description, Result, - Updated At, + Updated At,right-align, Notes,", :selected_columns => "Organization, Audit Type, diff --git a/app/views/audit_results/index.html.haml b/app/views/audit_results/index.html.haml index 167055b..03733fc 100644 --- a/app/views/audit_results/index.html.haml +++ b/app/views/audit_results/index.html.haml @@ -1,4 +1,4 @@ -.col-sm-12.col-md-10.col-md-offset-1 +.col-sm-12 .page-header %h2 Audit Results = render "index_#{@auditable_type.downcase.pluralize}" From 20b4dc60d50d258275ff14f65ae1c866f0567411 Mon Sep 17 00:00:00 2001 From: NJBL Date: Tue, 19 May 2020 16:50:58 -0400 Subject: [PATCH 09/21] audit_results drilldown link --- app/views/audit_results/_index_asset_table.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/audit_results/_index_asset_table.html.haml b/app/views/audit_results/_index_asset_table.html.haml index bad45f2..a2255bc 100644 --- a/app/views/audit_results/_index_asset_table.html.haml +++ b/app/views/audit_results/_index_asset_table.html.haml @@ -75,7 +75,7 @@ :javascript add_row('#{table_dom_id}', { - "Organization": '#{h link_to a.organization.short_name }', + "Organization": '#{h link_to a.organization.short_name, inventory_path(a.auditable) }', "Audit Type": '#{h a.audit }', "Type": '#{h a.class_name }', "Asset ID": '#{h a.auditable.asset_tag }', From 067d89a37a55277c9f5e1f1c0ffff9aa3b33bbcb Mon Sep 17 00:00:00 2001 From: NJBL Date: Mon, 1 Jun 2020 03:18:06 -0400 Subject: [PATCH 10/21] LIBRARY UPDATE: columns refernced by index, integrated col types and widths --- .../_index_asset_table.html.haml | 70 +++++-------------- app/views/audits/_index_table.html.haml | 65 +++++------------ 2 files changed, 36 insertions(+), 99 deletions(-) diff --git a/app/views/audit_results/_index_asset_table.html.haml b/app/views/audit_results/_index_asset_table.html.haml index a2255bc..571eb51 100644 --- a/app/views/audit_results/_index_asset_table.html.haml +++ b/app/views/audit_results/_index_asset_table.html.haml @@ -9,33 +9,6 @@ -:css - - .col-item:nth-child(1){ - width:10%; - } - .col-item:nth-child(2){ - width:12%; - } - .col-item:nth-child(3){ - width:12%; - } - .col-item:nth-child(4){ - width:12%; - } - .col-item:nth-child(5){ - width:8%; - } - .col-item:nth-child(6){ - width:8%; - } - .col-item:nth-child(7){ - width:8%; - } - .col-item:nth-child(8){ - width:12%; - } - = javascript_include_tag "https://kit.fontawesome.com/#{ENV['FONT_AWESOME']}.js" .library-table %table.elbat{:id => table_dom_id, @@ -44,25 +17,18 @@ :side => 'client', :current_page => '0', :current_page_size => '10', - :page_sizes => "10,20,50,100,200", + :page_sizes => "10,20,50,100", :search => 'client', :export => "['csv', 'txt', 'excel']", - :columns => "Organization,drilldown-link, - Audit Type, - Type, - Asset ID, - Description, - Result, - Updated At,right-align, - Notes,", - :selected_columns => "Organization, - Audit Type, - Type, - Asset ID, - Description, - Result, - Updated At, - Notes", + :columns => '{"0":{"name":"Organization","type":"drilldown-link","width":"10%"}, + "1":{"name":"Audit Type","width":"12%"}, + "2":{"name":"Type","width":"12%"}, + "3":{"name":"Asset ID","width":"12%"}, + "4":{"name":"Description","width":"8%"}, + "5":{"name":"Result","width":"8%"}, + "6":{"name":"Updated At","type":"right-align","width":"8%"}, + "7":{"name":"Notes","width":"12%"}}', + :selected_columns => "0,1,2,3,4,5,6,7", :cookies => "true", :sort => 'client', :params => "{}", @@ -75,14 +41,14 @@ :javascript add_row('#{table_dom_id}', { - "Organization": '#{h link_to a.organization.short_name, inventory_path(a.auditable) }', - "Audit Type": '#{h a.audit }', - "Type": '#{h a.class_name }', - "Asset ID": '#{h a.auditable.asset_tag }', - "Description": '#{h a.auditable.description }', - "Result": '#{h a.audit_result_type }', - "Updated At": '#{h format_as_date(a.updated_at) }', - "Notes": '#{h sanitize(a.notes, tags:[]).gsub("\n", ' ') }', + "0": '#{h link_to a.organization.short_name, inventory_path(a.auditable) }', + "1": '#{h a.audit }', + "2": '#{h a.class_name }', + "3": '#{h a.auditable.asset_tag }', + "4": '#{h a.auditable.description }', + "5": '#{h a.audit_result_type }', + "6": '#{h format_as_date(a.updated_at) }', + "7": '#{h sanitize(a.notes, tags:[]).gsub("\n", ' ') }', }, #{index}); diff --git a/app/views/audits/_index_table.html.haml b/app/views/audits/_index_table.html.haml index 8366a31..50acb23 100644 --- a/app/views/audits/_index_table.html.haml +++ b/app/views/audits/_index_table.html.haml @@ -1,30 +1,7 @@ :ruby table_dom_id = SecureRandom.hex -:css - .col-item:nth-child(2){ - width:10%; - } - .col-item:nth-child(3){ - width:30%; - } - .col-item:nth-child(4){ - width:30%; - } - .col-item:nth-child(5){ - width:8%; - } - .col-item:nth-child(6){ - width:8%; - } - .col-item:nth-child(7){ - width:8%; - } - .col-item:nth-child(8){ - width:8%; - } - = javascript_include_tag "https://kit.fontawesome.com/#{ENV['FONT_AWESOME']}.js" .library-table @@ -34,24 +11,18 @@ :side => 'client', :current_page => '0', :current_page_size => '10', - :page_sizes => "10,20,50,100,200", + :page_sizes => "10,20,50,100", :search => 'client', :export => "['csv', 'txt', 'excel']", - :columns => "Name,drilldown-link, - Description, - Instructions, - Schedule, - Last Run, - Operational, - Active, - Updated At,right-align", - :selected_columns => "Name, - Description, - Instructions, - Last Run, - Operational, - Active, - Updated At", + :columns => '{"0":{"name":"Name","type":"drilldown-link","width":"10%"}, + "1":{"name":"Description","width":"30%"}, + "2":{"name":"Instructions","width":"30%"}, + "3":{"name":"Schedule","width":"8%"}, + "4":{"name":"Last Run","width":"8%"}, + "5":{"name":"Operational","width":"8%"}, + "6":{"name":"Active","width":"8%"}, + "7":{"name":"Updated At","type":"right-align","width":"10%"}}', + :selected_columns => "0,1,2,4,5,6,7", :cookies => "true", :sort => 'client', :sort_params => @params, @@ -62,14 +33,14 @@ :javascript add_row('#{table_dom_id}', { - "Name": '#{h link_to a.name, audit_path(a) }', - "Description": '#{h format_as_text(a.description) }', - "Instructions": '#{h format_as_text(a.instructions) }', - "Schedule": '#{h link_to a.activity, activity_path(a.activity) if a.activity.present? }', - "Last Run": '#{h format_as_date(a.last_run) }', - "Operational": "#{h format_as_boolean(a.operational?) }", - "Active": "#{h format_as_boolean(a.active) }", - "Updated At": '#{h format_as_date(a.updated_at) }', + "0": '#{h link_to a.name, audit_path(a) }', + "1": '#{h format_as_text(a.description) }', + "2": '#{h format_as_text(a.instructions) }', + "3": '#{h link_to a.activity, activity_path(a.activity) if a.activity.present? }', + "4": '#{h format_as_date(a.last_run) }', + "5": "#{h format_as_boolean(a.operational?) }", + "6": "#{h format_as_boolean(a.active) }", + "7": '#{h format_as_date(a.updated_at) }', }, #{index}); From d4d8ab73d168ff48aff52213cd413feaf9a5c580 Mon Sep 17 00:00:00 2001 From: Derek Edwards Date: Mon, 8 Jun 2020 11:57:38 -0400 Subject: [PATCH 11/21] Update gemfile --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 95a428a..d073c6f 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem 'active_record-acts_as', git: 'https://github.com/camsys/active_record-acts_ # To use debugger # gem 'debugger' -gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter1 +gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter2 gem 'mysql2', "~> 0.5.1" # lock gem for dummy app gem "capybara", '2.6.2' # lock gem for old capybara behavior on hidden element xpath gem 'sass-rails' From 0a870a3128423b550e6084814f74557f5ada3efb Mon Sep 17 00:00:00 2001 From: NJBL Date: Tue, 9 Jun 2020 17:38:26 -0400 Subject: [PATCH 12/21] added table codes --- app/views/audit_results/_index_asset_table.html.haml | 1 + app/views/audits/_index_table.html.haml | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/audit_results/_index_asset_table.html.haml b/app/views/audit_results/_index_asset_table.html.haml index 571eb51..a105134 100644 --- a/app/views/audit_results/_index_asset_table.html.haml +++ b/app/views/audit_results/_index_asset_table.html.haml @@ -14,6 +14,7 @@ %table.elbat{:id => table_dom_id, :use => 'true', :data => {:use => 'true', + :table_code => 'audits', :side => 'client', :current_page => '0', :current_page_size => '10', diff --git a/app/views/audits/_index_table.html.haml b/app/views/audits/_index_table.html.haml index 50acb23..6fcec8c 100644 --- a/app/views/audits/_index_table.html.haml +++ b/app/views/audits/_index_table.html.haml @@ -8,6 +8,7 @@ %table.elbat{:id => table_dom_id, :use => 'true', :data => {:use => 'true', + :table_code => 'audit', :side => 'client', :current_page => '0', :current_page_size => '10', From 5f7d5ef1fcc6cdee6062e5a3246193c23f8efb9c Mon Sep 17 00:00:00 2001 From: Derek Edwards Date: Mon, 15 Jun 2020 16:51:42 -0400 Subject: [PATCH 13/21] Build travis on develop and 2.x.x --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index b616c2e..85ebf3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,8 @@ branches: only: - master - /quarter\d*/ + - develop + - /2.\d*.\d*/ before_script: - bundle update transam_core - cp spec/dummy/config/database.travis.yml spec/dummy/config/database.yml From e980657868f0233821d184345de5fcf1f52ea27e Mon Sep 17 00:00:00 2001 From: Derek Edwards Date: Mon, 15 Jun 2020 17:23:04 -0400 Subject: [PATCH 14/21] Handle empty notes field in all audits table. --- .../_index_asset_table.html.haml | 60 +- spec/dummy/db/schema.rb | 2021 ++++++++++------- 2 files changed, 1168 insertions(+), 913 deletions(-) diff --git a/app/views/audit_results/_index_asset_table.html.haml b/app/views/audit_results/_index_asset_table.html.haml index a105134..c3c1751 100644 --- a/app/views/audit_results/_index_asset_table.html.haml +++ b/app/views/audit_results/_index_asset_table.html.haml @@ -28,8 +28,8 @@ "4":{"name":"Description","width":"8%"}, "5":{"name":"Result","width":"8%"}, "6":{"name":"Updated At","type":"right-align","width":"8%"}, - "7":{"name":"Notes","width":"12%"}}', - :selected_columns => "0,1,2,3,4,5,6,7", + "notes":{"name":"Notes","width":"12%"}}', + :selected_columns => "0,1,2,3,4,5,6,notes", :cookies => "true", :sort => 'client', :params => "{}", @@ -49,61 +49,7 @@ "4": '#{h a.auditable.description }', "5": '#{h a.audit_result_type }', "6": '#{h format_as_date(a.updated_at) }', - "7": '#{h sanitize(a.notes, tags:[]).gsub("\n", ' ') }', + "notes": '#{h sanitize((a.notes || ""), tags:[]).gsub("\n", ' ') }', }, #{index}); - - - - --# .table-responsive --# %table.table.table-hover{:id => 'audit_results_table', :data => {:toggle => 'table', --# :pagination => 'true', --# :show_pagination_switch => 'false', --# :page_list => "[5, 10, 20, 50, 100, 200, 10000]", --# :page_size => current_user.num_table_rows, --# :search => 'false', --# :toolbar => "#table_actions", --# :export_types => "['csv', 'txt', 'excel']", --# :show_export => 'false', --# :resizable => 'true', --# :show_columns => 'false', --# :show_toggle => 'false', --# :maintain_selected => 'true', --# :single_select => 'false', --# :cookie => 'true', --# :cookie_id_table => "audit_results_assets_id", --# :cookie_expire => "1y"}} --# %thead --# %tr --# %th.center{:data => {:field => 'checked', :checkbox => 'true'}} --# %th.center{:data => {:field => 'object_key', :visible => 'false'}} --# - if @organization_list.count > 1 --# %th.center{:data => {:field => 'org', :sortable => 'true'}} Org --# %th.center{:data => {:sortable => 'true'}} Audit --# %th.center{:data => {:field => 'object_type', :sortable => 'true'}} Type --# %th.center{:data => {:sortable => 'true'}} Asset Tag --# %th.center{:data => {:sortable => 'true'}} Description --# %th.center{:data => {:sortable => 'true'}} Result --# %th.center{:data => {:sortable => 'true'}} Updated At --# %th.center{:data => {:sortable => 'true'}} Notes - --# %tbody --# - audit_results.each do |a| --# -unless a.auditable.nil? #Don't show results for objects that have been deleted --# %tr --# %td --# %td.center.nowrap= a.auditable.object_key --# - if @organization_list.count > 1 --# %td.left.nowrap= a.organization.short_name --# %td.center.nowrap= a.audit --# %td.left.nowrap= a.class_name --# %td.left.nowrap --# %span.hidden= a.auditable.asset_tag --# = link_to a.auditable.asset_tag, inventory_path(a.auditable) --# %td.left.nowrap= a.auditable.description --# %td.center.nowrap= a.audit_result_type --# %td.center.nowrap= format_as_date(a.updated_at) --# %td.left= format_as_text(a.notes) - = render :partial => 'shared/table_scripts', :locals => {:table_id => 'audit_results_table', :path_pattern => activity_path("xxx")} diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index 4dcac31..8c4db3d 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/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,1048 +10,1358 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170103225100) do - - create_table "activities", force: true do |t| - t.string "object_key", limit: 12 - t.integer "organization_type_id" - t.string "name", limit: 64 - t.text "description" - t.boolean "show_in_dashboard" - t.boolean "system_activity" - t.date "start_date" - t.date "end_date" - t.integer "frequency_quantity", null: false - t.integer "frequency_type_id", null: false - t.string "execution_time", limit: 32, null: false - t.string "job_name", limit: 64 +ActiveRecord::Schema.define(version: 2020_04_22_165110) do + + create_table "activities", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12 + t.integer "organization_type_id" + t.string "name", limit: 64 + t.text "description" + t.boolean "show_in_dashboard" + t.boolean "system_activity" + t.date "start_date" + t.date "end_date" + t.integer "frequency_quantity", null: false + t.integer "frequency_type_id", null: false + t.string "execution_time", limit: 32, null: false + t.string "job_name", limit: 64 t.datetime "last_run" - t.boolean "active" + t.boolean "active" t.datetime "created_at" t.datetime "updated_at" end - create_table "activity_logs", force: true do |t| - t.integer "organization_id", null: false - t.string "item_type", limit: 64, null: false - t.integer "item_id" - t.integer "user_id", null: false - t.text "activity", limit: 2147483647, null: false + create_table "activity_logs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "organization_id", null: false + t.string "item_type", limit: 64, null: false + t.integer "item_id" + t.integer "user_id", null: false + t.text "activity", limit: 4294967295, null: false t.datetime "activity_time" + t.index ["organization_id", "activity_time"], name: "activity_logs_idx1" + t.index ["user_id", "activity_time"], name: "activity_logs_idx2" end - add_index "activity_logs", ["organization_id", "activity_time"], name: "activity_logs_idx1", using: :btree - add_index "activity_logs", ["user_id", "activity_time"], name: "activity_logs_idx2", using: :btree + create_table "archived_fiscal_years", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.bigint "organization_id" + t.integer "fy_year" + t.index ["organization_id"], name: "index_archived_fiscal_years_on_organization_id" + end - create_table "asset_event_asset_subsystems", force: true do |t| + create_table "asset_event_asset_subsystems", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.integer "asset_event_id" t.integer "asset_subsystem_id" t.integer "parts_cost" t.integer "labor_cost" + t.index ["asset_event_id"], name: "rehab_events_subsystems_idx1" + t.index ["asset_subsystem_id"], name: "rehab_events_subsystems_idx2" + end + + create_table "asset_event_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "class_name", limit: 64, null: false + t.string "job_name", limit: 64, null: false + t.string "display_icon_name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false + t.index ["class_name"], name: "asset_event_types_idx1" end - add_index "asset_event_asset_subsystems", ["asset_event_id"], name: "rehab_events_subsystems_idx1", using: :btree - add_index "asset_event_asset_subsystems", ["asset_subsystem_id"], name: "rehab_events_subsystems_idx2", using: :btree - - create_table "asset_event_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "class_name", limit: 64, null: false - t.string "job_name", limit: 64, null: false - t.string "display_icon_name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false - end - - add_index "asset_event_types", ["class_name"], name: "asset_event_types_idx1", using: :btree - - create_table "asset_events", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "asset_id", null: false - t.integer "asset_event_type_id", null: false - t.integer "upload_id" - t.date "event_date", null: false - t.decimal "assessed_rating", precision: 9, scale: 2 - t.integer "condition_type_id" - t.integer "current_mileage" - t.integer "parent_id" - t.integer "replacement_year" - t.integer "rebuild_year" - t.integer "disposition_year" - t.integer "extended_useful_life_miles" - t.integer "extended_useful_life_months" - t.integer "replacement_reason_type_id" - t.date "disposition_date" - t.integer "disposition_type_id" - t.integer "service_status_type_id" - t.integer "maintenance_type_id" - t.integer "pcnt_5311_routes" - t.integer "avg_daily_use_hours" - t.integer "avg_daily_use_miles" - t.integer "avg_daily_passenger_trips" - t.integer "maintenance_provider_type_id" - t.decimal "avg_cost_per_mile", precision: 9, scale: 2 - t.decimal "avg_miles_per_gallon", precision: 9, scale: 2 - t.integer "annual_maintenance_cost" - t.integer "annual_insurance_cost" - t.boolean "actual_costs" - t.integer "annual_affected_ridership" - t.integer "annual_dollars_generated" - t.integer "sales_proceeds" - t.string "organization_id" - t.text "comments" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "state", limit: 32 - t.string "document", limit: 128 - t.string "original_filename", limit: 128 - t.integer "created_by_id" - end - - add_index "asset_events", ["asset_event_type_id"], name: "asset_events_idx3", using: :btree - add_index "asset_events", ["asset_id"], name: "asset_events_idx2", using: :btree - add_index "asset_events", ["created_by_id"], name: "asset_events_creator_idx", using: :btree - add_index "asset_events", ["event_date"], name: "asset_events_idx4", using: :btree - add_index "asset_events", ["object_key"], name: "asset_events_idx1", using: :btree - add_index "asset_events", ["upload_id"], name: "asset_events_idx5", using: :btree - - create_table "asset_groups", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "organization_id", null: false - t.string "name", limit: 64, null: false - t.string "code", limit: 8, null: false - t.string "description", limit: 254 - t.boolean "active" + create_table "asset_events", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "asset_id" + t.string "transam_asset_type" + t.bigint "transam_asset_id" + t.bigint "base_transam_asset_id" + t.integer "asset_event_type_id", null: false + t.integer "upload_id" + t.date "event_date", null: false + t.decimal "assessed_rating", precision: 9, scale: 2 + t.integer "condition_type_id" + t.integer "current_mileage" + t.integer "parent_id" + t.integer "replacement_year" + t.integer "rebuild_year" + t.integer "disposition_year" + t.integer "extended_useful_life_miles" + t.integer "extended_useful_life_months" + t.integer "replacement_reason_type_id" + t.date "disposition_date" + t.integer "disposition_type_id" + t.integer "service_status_type_id" + t.integer "maintenance_type_id" + t.integer "pcnt_5311_routes" + t.integer "avg_daily_use_hours" + t.integer "avg_daily_use_miles" + t.integer "avg_daily_passenger_trips" + t.integer "maintenance_provider_type_id" + t.decimal "avg_cost_per_mile", precision: 9, scale: 2 + t.decimal "avg_miles_per_gallon", precision: 9, scale: 2 + t.integer "annual_maintenance_cost" + t.integer "annual_insurance_cost" + t.boolean "actual_costs" + t.integer "annual_affected_ridership" + t.integer "annual_dollars_generated" + t.integer "sales_proceeds" + t.string "organization_id" + t.text "comments" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "state", limit: 32 + t.string "document", limit: 128 + t.string "original_filename", limit: 128 + t.integer "created_by_id" + t.bigint "updated_by_id" + t.integer "total_cost" + t.index ["asset_event_type_id"], name: "asset_events_idx3" + t.index ["asset_id"], name: "asset_events_idx2" + t.index ["base_transam_asset_id"], name: "index_asset_events_on_base_transam_asset_id" + t.index ["created_by_id"], name: "asset_events_creator_idx" + t.index ["event_date"], name: "asset_events_idx4" + t.index ["object_key"], name: "asset_events_idx1" + t.index ["transam_asset_id"], name: "index_asset_events_on_transam_asset_id" + t.index ["updated_by_id"], name: "index_asset_events_on_updated_by_id" + t.index ["upload_id"], name: "asset_events_idx5" + end + + create_table "asset_groups", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "organization_id", null: false + t.string "name", limit: 64, null: false + t.string "code", limit: 8, null: false + t.string "description", limit: 254 + t.boolean "active" t.datetime "created_at" t.datetime "updated_at" + t.index ["object_key"], name: "asset_groups_idx1" + t.index ["organization_id"], name: "asset_groups_idx2" end - add_index "asset_groups", ["object_key"], name: "asset_groups_idx1", using: :btree - add_index "asset_groups", ["organization_id"], name: "asset_groups_idx2", using: :btree - - create_table "asset_groups_assets", id: false, force: true do |t| - t.integer "asset_id", null: false + create_table "asset_groups_assets", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "asset_id" + t.bigint "transam_asset_id" t.integer "asset_group_id", null: false + t.index ["asset_id", "asset_group_id"], name: "asset_groups_assets_idx1" + t.index ["transam_asset_id"], name: "index_asset_groups_assets_on_transam_asset_id" end - add_index "asset_groups_assets", ["asset_id", "asset_group_id"], name: "asset_groups_assets_idx1", using: :btree - - create_table "asset_subsystems", force: true do |t| - t.string "name", limit: 64 - t.string "code", limit: 2 - t.string "description", limit: 254 + create_table "asset_subsystems", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64 + t.string "code", limit: 2 + t.string "description", limit: 254 t.integer "asset_type_id" t.boolean "active" end - create_table "asset_subtypes", force: true do |t| - t.integer "asset_type_id", null: false - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.string "image", limit: 254 - t.boolean "active", null: false + create_table "asset_subtypes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "asset_type_id", null: false + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.string "image", limit: 254 + t.boolean "active", null: false + t.index ["asset_type_id"], name: "asset_subtypes_idx1" end - add_index "asset_subtypes", ["asset_type_id"], name: "asset_subtypes_idx1", using: :btree - - create_table "asset_tags", force: true do |t| + create_table "asset_tags", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.integer "asset_id" t.integer "user_id" + t.index ["asset_id"], name: "asset_tags_idx1" + t.index ["user_id"], name: "asset_tags_idx2" end - add_index "asset_tags", ["asset_id"], name: "asset_tags_idx1", using: :btree - add_index "asset_tags", ["user_id"], name: "asset_tags_idx2", using: :btree - - create_table "asset_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "class_name", limit: 64, null: false - t.string "display_icon_name", limit: 64, null: false - t.string "map_icon_name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "asset_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "class_name", limit: 64, null: false + t.string "display_icon_name", limit: 64, null: false + t.string "map_icon_name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "allow_parent" + t.boolean "active", null: false + t.index ["class_name"], name: "asset_types_idx1" + t.index ["name"], name: "asset_types_idx2" end - add_index "asset_types", ["class_name"], name: "asset_types_idx1", using: :btree - add_index "asset_types", ["name"], name: "asset_types_idx2", using: :btree - - create_table "asset_types_manufacturers", id: false, force: true do |t| + create_table "asset_types_manufacturers", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.integer "asset_type_id" t.integer "manufacturer_id" - end - - add_index "asset_types_manufacturers", ["asset_type_id", "manufacturer_id"], name: "asset_types_manufacturers_idx1", using: :btree - - create_table "assets", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "organization_id", null: false - t.integer "asset_type_id", null: false - t.integer "asset_subtype_id", null: false - t.string "asset_tag", limit: 32, null: false - t.string "external_id", limit: 32 - t.integer "parent_id" - t.integer "superseded_by_id" - t.integer "manufacturer_id" - t.string "manufacturer_model", limit: 128 - t.integer "manufacture_year" - t.integer "pcnt_capital_responsibility" - t.integer "vendor_id" - t.integer "policy_replacement_year" - t.integer "policy_rehabilitation_year" - t.integer "estimated_replacement_year" - t.integer "estimated_replacement_cost" - t.integer "scheduled_replacement_year" - t.integer "scheduled_rehabilitation_year" - t.integer "scheduled_disposition_year" - t.integer "scheduled_replacement_cost" - t.text "early_replacement_reason" - t.boolean "scheduled_replace_with_new" - t.integer "scheduled_rehabilitation_cost" - t.integer "replacement_reason_type_id" - t.boolean "in_backlog" - t.integer "reported_condition_type_id" - t.decimal "reported_condition_rating", precision: 10, scale: 1 - t.integer "reported_mileage" - t.date "reported_mileage_date" - t.date "reported_condition_date" - t.integer "estimated_condition_type_id" - t.decimal "estimated_condition_rating", precision: 9, scale: 2 - t.integer "service_status_type_id" - t.date "service_status_date" - t.date "last_maintenance_date" - t.boolean "depreciable" - t.integer "book_value" - t.integer "salvage_value" - t.date "disposition_date" - t.integer "disposition_type_id" - t.date "last_rehabilitation_date" - t.integer "maintenance_provider_type_id" - t.string "location_reference", limit: 254 - t.text "location_comments" - t.integer "fuel_type_id" - t.integer "vehicle_length" - t.integer "gross_vehicle_weight" - t.string "title_number", limit: 32 - t.string "serial_number", limit: 32 - t.boolean "purchased_new" - t.integer "purchase_cost" - t.date "purchase_date" - t.date "warranty_date" - t.date "in_service_date" - t.integer "expected_useful_life" - t.integer "expected_useful_miles" - t.integer "rebuild_year" - t.string "license_plate", limit: 32 - t.integer "seating_capacity" - t.integer "standing_capacity" - t.integer "wheelchair_capacity" - t.integer "fta_ownership_type_id" - t.integer "fta_vehicle_type_id" - t.integer "fta_funding_type_id" - t.boolean "ada_accessible_lift" - t.boolean "ada_accessible_ramp" - t.boolean "fta_emergency_contingency_fleet" - t.string "description", limit: 128 - t.string "address1", limit: 128 - t.string "address2", limit: 128 - t.string "city", limit: 64 - t.string "state", limit: 2 - t.string "zip", limit: 10 - t.integer "facility_size" - t.boolean "section_of_larger_facility" - t.integer "pcnt_operational" - t.integer "num_floors" - t.integer "num_structures" - t.integer "num_elevators" - t.integer "num_escalators" - t.integer "num_parking_spaces_public" - t.integer "num_parking_spaces_private" - t.decimal "lot_size", precision: 9, scale: 2 - t.string "line_number", limit: 128 - t.integer "quantity" - t.string "quantity_units", limit: 16 - t.integer "created_by_id" - t.integer "updated_by_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "upload_id" - end - - add_index "assets", ["asset_subtype_id"], name: "assets_idx4", using: :btree - add_index "assets", ["asset_type_id"], name: "assets_idx3", using: :btree - add_index "assets", ["estimated_replacement_year"], name: "assets_idx8", using: :btree - add_index "assets", ["in_backlog"], name: "assets_idx7", using: :btree - add_index "assets", ["manufacture_year"], name: "assets_idx5", using: :btree - add_index "assets", ["object_key"], name: "assets_idx1", using: :btree - add_index "assets", ["organization_id", "asset_subtype_id", "in_backlog"], name: "assets_idx12", using: :btree - add_index "assets", ["organization_id", "asset_subtype_id", "policy_replacement_year"], name: "assets_idx10", using: :btree - add_index "assets", ["organization_id", "in_backlog"], name: "assets_idx11", using: :btree - add_index "assets", ["organization_id", "policy_replacement_year"], name: "assets_idx9", using: :btree - add_index "assets", ["organization_id"], name: "assets_idx2", using: :btree - add_index "assets", ["reported_condition_type_id"], name: "assets_idx6", using: :btree - add_index "assets", ["superseded_by_id"], name: "assets_idx13", using: :btree - - create_table "audit_result_types", force: true do |t| - t.string "name", limit: 32, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false - end - - create_table "audit_results", force: true do |t| - t.integer "audit_id", null: false - t.integer "auditable_id", null: false - t.string "auditable_type", limit: 64, null: false - t.string "class_name", limit: 64, null: false - t.integer "organization_id", null: false - t.integer "audit_result_type_id", null: false - t.text "notes" + t.index ["asset_type_id", "manufacturer_id"], name: "asset_types_manufacturers_idx1" + end + + create_table "assets", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "organization_id", null: false + t.integer "asset_type_id", null: false + t.integer "asset_subtype_id", null: false + t.string "asset_tag", limit: 32, null: false + t.string "external_id", limit: 32 + t.integer "parent_id" + t.integer "superseded_by_id" + t.integer "manufacturer_id" + t.string "other_manufacturer" + t.string "manufacturer_model", limit: 128 + t.integer "manufacture_year" + t.integer "pcnt_capital_responsibility" + t.integer "vendor_id" + t.integer "policy_replacement_year" + t.integer "policy_rehabilitation_year" + t.integer "estimated_replacement_year" + t.integer "estimated_replacement_cost" + t.integer "scheduled_replacement_year" + t.integer "scheduled_rehabilitation_year" + t.integer "scheduled_disposition_year" + t.integer "scheduled_replacement_cost" + t.text "early_replacement_reason" + t.boolean "scheduled_replace_with_new" + t.integer "scheduled_rehabilitation_cost" + t.integer "replacement_reason_type_id" + t.boolean "in_backlog" + t.integer "reported_condition_type_id" + t.decimal "reported_condition_rating", precision: 10, scale: 1 + t.integer "reported_mileage" + t.date "reported_mileage_date" + t.date "reported_condition_date" + t.integer "estimated_condition_type_id" + t.decimal "estimated_condition_rating", precision: 9, scale: 2 + t.integer "service_status_type_id" + t.date "service_status_date" + t.date "last_maintenance_date" + t.boolean "depreciable" + t.integer "book_value" + t.integer "salvage_value" + t.date "disposition_date" + t.integer "disposition_type_id" + t.date "last_rehabilitation_date" + t.integer "maintenance_provider_type_id" + t.string "location_reference", limit: 254 + t.text "location_comments" + t.integer "fuel_type_id" + t.integer "vehicle_length" + t.integer "gross_vehicle_weight" + t.string "title_number", limit: 32 + t.string "serial_number", limit: 32 + t.boolean "purchased_new" + t.integer "purchase_cost" + t.date "purchase_date" + t.date "warranty_date" + t.date "in_service_date" + t.integer "expected_useful_life" + t.integer "expected_useful_miles" + t.integer "rebuild_year" + t.string "license_plate", limit: 32 + t.integer "seating_capacity" + t.integer "standing_capacity" + t.integer "wheelchair_capacity" + t.integer "fta_ownership_type_id" + t.integer "fta_vehicle_type_id" + t.integer "fta_funding_type_id" + t.boolean "ada_accessible_lift" + t.boolean "ada_accessible_ramp" + t.boolean "fta_emergency_contingency_fleet" + t.string "description", limit: 128 + t.string "address1", limit: 128 + t.string "address2", limit: 128 + t.string "city", limit: 64 + t.string "state", limit: 2 + t.string "zip", limit: 10 + t.integer "facility_size" + t.boolean "section_of_larger_facility" + t.integer "pcnt_operational" + t.integer "num_floors" + t.integer "num_structures" + t.integer "num_elevators" + t.integer "num_escalators" + t.integer "num_parking_spaces_public" + t.integer "num_parking_spaces_private" + t.decimal "lot_size", precision: 9, scale: 2 + t.string "line_number", limit: 128 + t.integer "quantity" + t.string "quantity_units", limit: 16 + t.integer "created_by_id" + t.integer "weight" + t.integer "updated_by_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "upload_id" + t.integer "location_id" + t.integer "dual_fuel_type_id" + t.index ["asset_subtype_id"], name: "assets_idx4" + t.index ["asset_type_id"], name: "assets_idx3" + t.index ["estimated_replacement_year"], name: "assets_idx8" + t.index ["in_backlog"], name: "assets_idx7" + t.index ["manufacture_year"], name: "assets_idx5" + t.index ["object_key"], name: "assets_idx1" + t.index ["organization_id", "asset_subtype_id", "in_backlog"], name: "assets_idx12" + t.index ["organization_id", "asset_subtype_id", "policy_replacement_year"], name: "assets_idx10" + t.index ["organization_id", "in_backlog"], name: "assets_idx11" + t.index ["organization_id", "policy_replacement_year"], name: "assets_idx9" + t.index ["organization_id"], name: "assets_idx2" + t.index ["reported_condition_type_id"], name: "assets_idx6" + t.index ["superseded_by_id"], name: "assets_idx13" + end + + create_table "audit_result_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 32, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false + end + + create_table "audit_results", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "audit_id", null: false + t.integer "auditable_id", null: false + t.string "auditable_type", limit: 64, null: false + t.string "class_name" + t.integer "organization_id", null: false + t.integer "audit_result_type_id", null: false + t.text "notes" t.datetime "created_at" t.datetime "updated_at" - end - - add_index "audit_results", ["audit_id"], name: "audit_results_idx1", using: :btree - add_index "audit_results", ["audit_result_type_id"], name: "audit_results_idx4", using: :btree - add_index "audit_results", ["auditable_type", "auditable_id"], name: "audit_results_idx2", using: :btree - add_index "audit_results", ["class_name"], name: "audit_results_idx3", using: :btree - - create_table "audits", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "activity_id" - t.string "name", limit: 64, null: false - t.text "description", null: false - t.string "instructions", limit: 254, null: false - t.date "start_date", null: false - t.date "end_date", null: false - t.string "auditor_class_name", limit: 128, null: false + t.string "filterable_type" + t.bigint "filterable_id" + t.index ["audit_id"], name: "audit_results_idx1" + t.index ["audit_result_type_id"], name: "audit_results_idx4" + t.index ["auditable_type", "auditable_id"], name: "audit_results_idx2" + t.index ["class_name"], name: "audit_results_idx3" + t.index ["filterable_type", "filterable_id"], name: "index_audit_results_on_filterable_type_and_filterable_id" + end + + create_table "audits", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "activity_id" + t.string "name", limit: 64, null: false + t.text "description", null: false + t.string "instructions", limit: 254, null: false + t.date "start_date", null: false + t.date "end_date", null: false + t.string "auditor_class_name", limit: 128, null: false t.datetime "last_run" - t.boolean "active", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.boolean "active", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "filterable_class_name" + t.index ["active"], name: "audit_idx2" + t.index ["object_key"], name: "audit_idx1" end - add_index "audits", ["active"], name: "audit_idx2", using: :btree - add_index "audits", ["object_key"], name: "audit_idx1", using: :btree - - create_table "comments", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "commentable_id", null: false - t.string "commentable_type", limit: 64, null: false - t.string "comment", limit: 254, null: false - t.integer "created_by_id", null: false + create_table "comments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "commentable_id", null: false + t.string "commentable_type", limit: 64, null: false + t.string "comment", limit: 254, null: false + t.integer "created_by_id", null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["commentable_id", "commentable_type"], name: "comments_idx1" end - add_index "comments", ["commentable_id", "commentable_type"], name: "comments_idx1", using: :btree - - create_table "condition_estimation_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "class_name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "condition_estimation_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "class_name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false + t.index ["class_name"], name: "condition_estimation_types_idx1" end - add_index "condition_estimation_types", ["class_name"], name: "condition_estimation_types_idx1", using: :btree + create_table "condition_rollup_calculation_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name" + t.string "class_name" + t.string "description" + t.boolean "active" + end - create_table "condition_types", force: true do |t| - t.string "name", limit: 64, null: false - t.decimal "rating", precision: 9, scale: 2, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "condition_type_percents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.bigint "asset_event_id" + t.bigint "condition_type_id" + t.integer "pcnt" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["asset_event_id"], name: "index_condition_type_percents_on_asset_event_id" + t.index ["condition_type_id"], name: "index_condition_type_percents_on_condition_type_id" end - create_table "cost_calculation_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "class_name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "condition_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.decimal "rating_ceiling", precision: 9, scale: 2, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false end - add_index "cost_calculation_types", ["class_name"], name: "cost_calculation_types_idx1", using: :btree + create_table "cost_calculation_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "class_name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false + t.index ["class_name"], name: "cost_calculation_types_idx1" + end - create_table "customers", force: true do |t| - t.integer "license_type_id", null: false - t.string "name", limit: 64, null: false - t.boolean "active", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "customers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "license_type_id", null: false + t.string "name", limit: 64, null: false + t.boolean "active", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "delayed_job_priorities", force: true do |t| - t.string "class_name", null: false - t.integer "priority", default: 0, null: false + create_table "delayed_job_priorities", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "class_name", null: false + t.integer "priority", null: false t.datetime "created_at" t.datetime "updated_at" end - create_table "delayed_jobs", force: true do |t| - t.integer "priority" - t.integer "attempts" - t.text "handler" - t.text "last_error" + create_table "delayed_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "priority" + t.integer "attempts" + t.text "handler" + t.text "last_error" t.datetime "run_at" t.datetime "locked_at" t.datetime "failed_at" - t.string "locked_by" - t.string "queue" + t.string "locked_by" + t.string "queue" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["priority", "run_at"], name: "delayed_jobs_priority" + end + + create_table "disposition_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "code", limit: 2, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false + end + + create_table "district_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false + end + + create_table "districts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.bigint "district_type_id" + t.string "state" + t.string "name", limit: 64, null: false + t.string "code", null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false + t.index ["code"], name: "index_districts_on_code" + t.index ["district_type_id"], name: "index_districts_on_district_type_id" + t.index ["name"], name: "index_districts_on_name" + end + + create_table "documents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "documentable_id", null: false + t.string "documentable_type", limit: 64, null: false + t.string "document", limit: 128, null: false + t.string "description", limit: 254, null: false + t.string "original_filename", limit: 128, null: false + t.string "content_type", limit: 128, null: false + t.integer "file_size", null: false + t.integer "created_by_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["documentable_id", "documentable_type"], name: "documents_idx2" + t.index ["object_key"], name: "documents_idx1" end - add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree - - create_table "disposition_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "code", limit: 2, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false - end - - create_table "documents", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "documentable_id", null: false - t.string "documentable_type", limit: 64, null: false - t.string "document", limit: 128, null: false - t.string "description", limit: 254, null: false - t.string "original_filename", limit: 128, null: false - t.string "content_type", limit: 128, null: false - t.integer "file_size", null: false - t.integer "created_by_id" + create_table "dual_fuel_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "primary_fuel_type_id" + t.integer "secondary_fuel_type_id" + t.boolean "active" + t.index ["primary_fuel_type_id"], name: "index_dual_fuel_types_on_primary_fuel_type_id" + t.index ["secondary_fuel_type_id"], name: "index_dual_fuel_types_on_secondary_fuel_type_id" + end + + create_table "file_content_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "class_name", limit: 64, null: false + t.string "builder_name" + t.string "description", limit: 254, null: false + t.boolean "active", null: false + t.index ["class_name"], name: "file_content_types_idx2" + t.index ["name"], name: "file_content_types_idx1" + end + + create_table "file_status_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false + t.index ["name"], name: "file_status_types_idx1" + end + + create_table "forms", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.string "roles", limit: 128, null: false + t.string "controller", limit: 64, null: false + t.integer "sort_order" + t.boolean "active", null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["object_key"], name: "forms_idx1" end - add_index "documents", ["documentable_id", "documentable_type"], name: "documents_idx2", using: :btree - add_index "documents", ["object_key"], name: "documents_idx1", using: :btree - - create_table "file_content_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "class_name", limit: 64, null: false - t.string "builder_name" - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "frequency_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 32, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false end - add_index "file_content_types", ["class_name"], name: "file_content_types_idx2", using: :btree - add_index "file_content_types", ["name"], name: "file_content_types_idx1", using: :btree - - create_table "file_status_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "fuel_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", null: false + t.string "code", null: false + t.string "description", null: false + t.boolean "active", null: false end - add_index "file_status_types", ["name"], name: "file_status_types_idx1", using: :btree + create_table "image_classifications", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name" + t.string "category" + t.integer "sort_order" + t.boolean "active" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end - create_table "forms", force: true do |t| - t.string "object_key", limit: 12, null: false - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.string "roles", limit: 128, null: false - t.string "controller", limit: 64, null: false - t.boolean "active", null: false + create_table "images", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.bigint "base_imagable_id" + t.string "base_imagable_type" + t.integer "imagable_id", null: false + t.string "imagable_type", limit: 64, null: false + t.string "image", limit: 128, null: false + t.string "name" + t.string "description", limit: 254, null: false + t.boolean "exportable" + t.string "original_filename", limit: 128, null: false + t.string "content_type", limit: 128, null: false + t.integer "file_size", null: false + t.integer "created_by_id" t.datetime "created_at" t.datetime "updated_at" + t.float "latitude" + t.float "longitude" + t.float "bearing" + t.bigint "image_classification_id" + t.string "compass_point" + t.index ["base_imagable_type", "base_imagable_id"], name: "index_images_on_base_imagable_type_and_base_imagable_id" + t.index ["imagable_id", "imagable_type"], name: "images_idx2" + t.index ["image_classification_id"], name: "index_images_on_image_classification_id" + t.index ["object_key"], name: "images_idx1" + end + + create_table "issue_status_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 32, null: false + t.string "description", limit: 254, null: false + t.boolean "active" end - add_index "forms", ["object_key"], name: "forms_idx1", using: :btree - - create_table "frequency_types", force: true do |t| - t.string "name", limit: 32, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "issue_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false end - create_table "fuel_types", force: true do |t| - t.string "name", null: false - t.string "code", null: false - t.string "description", null: false - t.boolean "active", null: false + create_table "issues", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "issue_type_id", null: false + t.integer "web_browser_type_id", null: false + t.integer "created_by_id", null: false + t.text "comments", null: false + t.integer "issue_status_type_id", default: 1 + t.text "resolution_comments" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["issue_type_id"], name: "issues_idx2" + t.index ["object_key"], name: "issues_idx1" end - create_table "images", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "imagable_id", null: false - t.string "imagable_type", limit: 64, null: false - t.string "image", limit: 128, null: false - t.string "description", limit: 254, null: false - t.string "original_filename", limit: 128, null: false - t.string "content_type", limit: 128, null: false - t.integer "file_size", null: false - t.integer "created_by_id" + create_table "keyword_search_indices", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_class", limit: 64, null: false + t.string "object_key", limit: 12, null: false + t.integer "organization_id", null: false + t.string "context", limit: 64, null: false + t.string "summary", limit: 64, null: false + t.text "search_text", null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["object_class"], name: "keyword_search_indices_idx1" end - add_index "images", ["imagable_id", "imagable_type"], name: "images_idx2", using: :btree - add_index "images", ["object_key"], name: "images_idx1", using: :btree + create_table "license_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "asset_manager", null: false + t.boolean "web_services", null: false + t.boolean "active", null: false + end + + create_table "maintenance_provider_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "code", limit: 2, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false + end + + create_table "maintenance_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 32, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false + end - create_table "issue_status_types", force: true do |t| - t.string "name", limit: 32, null: false - t.string "description", limit: 254, null: false + create_table "manufacturer_models", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name" + t.string "description" + t.bigint "organization_id" t.boolean "active" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["organization_id"], name: "index_manufacturer_models_on_organization_id" end - create_table "issue_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "manufacturers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "filter", limit: 32, null: false + t.string "name", limit: 128, null: false + t.string "code", limit: 3, null: false + t.boolean "active", null: false + t.index ["filter"], name: "manufacturers_idx1" end - create_table "issues", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "issue_type_id", null: false - t.integer "web_browser_type_id", null: false - t.integer "created_by_id", null: false - t.text "comments", null: false - t.integer "issue_status_type_id", default: 1 - t.text "resolution_comments" + create_table "message_tags", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "message_id" + t.integer "user_id" + t.index ["message_id"], name: "message_tags_idx1" + t.index ["user_id"], name: "message_tags_idx2" + end + + create_table "message_templates", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.bigint "priority_type_id" + t.string "object_key" + t.string "name" + t.string "subject" + t.text "description" + t.text "delivery_rules" + t.text "body" + t.boolean "active" + t.boolean "message_enabled" + t.boolean "email_enabled" + t.boolean "is_system_template" + t.boolean "is_implemented" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["priority_type_id"], name: "index_message_templates_on_priority_type_id" + end + + create_table "messages", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "organization_id", null: false + t.integer "user_id", null: false + t.integer "to_user_id" + t.integer "priority_type_id", null: false + t.integer "thread_message_id" + t.string "subject", limit: 64, null: false + t.text "body" + t.boolean "active" + t.datetime "opened_at" + t.datetime "created_at", null: false + t.bigint "message_template_id" + t.string "email_status" + t.index ["message_template_id"], name: "index_messages_on_message_template_id" + t.index ["object_key"], name: "messages_idx1" + t.index ["organization_id"], name: "messages_idx2" + t.index ["thread_message_id"], name: "messages_idx5" + t.index ["to_user_id"], name: "messages_idx4" + t.index ["user_id"], name: "messages_idx3" + end + + create_table "notice_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.string "display_icon", limit: 64, null: false + t.string "display_class", limit: 64, null: false + t.boolean "active" + end + + create_table "notices", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.string "subject", limit: 64, null: false + t.string "summary", limit: 128, null: false + t.text "details" + t.integer "notice_type_id" + t.integer "organization_id" + t.datetime "display_datetime" + t.datetime "end_datetime" + t.boolean "active" t.datetime "created_at" t.datetime "updated_at" end - add_index "issues", ["issue_type_id"], name: "issues_idx2", using: :btree - add_index "issues", ["object_key"], name: "issues_idx1", using: :btree - - create_table "keyword_search_indices", force: true do |t| - t.string "object_class", limit: 64, null: false - t.string "object_key", limit: 12, null: false - t.integer "organization_id", null: false - t.string "context", limit: 64, null: false - t.string "summary", limit: 64, null: false - t.text "search_text", null: false + create_table "notifications", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.string "text", null: false + t.string "link", null: false + t.integer "notifiable_id" + t.string "notifiable_type" + t.boolean "active" t.datetime "created_at" t.datetime "updated_at" + t.index ["notifiable_id", "notifiable_type"], name: "index_notifications_on_notifiable_id_and_notifiable_type" end - add_index "keyword_search_indices", ["object_class"], name: "keyword_search_indices_idx1", using: :btree + create_table "organization_role_mappings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "organization_id", null: false + t.integer "role_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + end - create_table "license_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "asset_manager", null: false - t.boolean "web_services", null: false - t.boolean "active", null: false + create_table "organization_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "class_name", limit: 64, null: false + t.string "display_icon_name", limit: 64, null: false + t.string "map_icon_name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.string "roles" + t.boolean "active", null: false + t.index ["class_name"], name: "organization_types_idx1" + end + + create_table "organizations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "organization_type_id", null: false + t.integer "customer_id", null: false + t.string "external_id", limit: 32 + t.string "name", limit: 128, null: false + t.string "short_name", limit: 16, null: false + t.boolean "license_holder", null: false + t.string "address1", limit: 128, null: false + t.string "address2", limit: 128 + t.string "county", limit: 64 + t.string "city", limit: 64, null: false + t.string "state", limit: 2, null: false + t.string "zip", limit: 10, null: false + t.string "phone", limit: 12, null: false + t.string "phone_ext", limit: 6 + t.string "fax", limit: 12 + t.string "url", limit: 128, null: false + t.boolean "indian_tribe" + t.string "subrecipient_number", limit: 9 + t.string "ntd_id_number", limit: 4 + t.boolean "active", null: false + t.decimal "latitude", precision: 11, scale: 6 + t.decimal "longitude", precision: 11, scale: 6 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "country" + t.string "legal_name" + t.index ["customer_id"], name: "organizations_idx2" + t.index ["organization_type_id"], name: "organizations_idx1" + t.index ["short_name"], name: "organizations_idx4" + t.index ["short_name"], name: "short_name" end - create_table "maintenance_provider_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "code", limit: 2, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "organizations_saved_queries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.bigint "saved_query_id", null: false + t.bigint "organization_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["organization_id"], name: "index_organizations_saved_queries_on_organization_id" + t.index ["saved_query_id"], name: "index_organizations_saved_queries_on_saved_query_id" + end + + create_table "organizations_saved_searches", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.bigint "organization_id" + t.bigint "saved_search_id" + t.index ["organization_id"], name: "index_organizations_saved_searches_on_organization_id" + t.index ["saved_search_id"], name: "index_organizations_saved_searches_on_saved_search_id" + end + + create_table "policies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "organization_id", null: false + t.integer "parent_id" + t.integer "year", null: false + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.integer "service_life_calculation_type_id", null: false + t.integer "cost_calculation_type_id", null: false + t.integer "condition_estimation_type_id", null: false + t.decimal "condition_threshold", precision: 9, scale: 2, null: false + t.decimal "interest_rate", precision: 9, scale: 2, null: false + t.boolean "current", null: false + t.boolean "active", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["object_key"], name: "policies_idx1" + t.index ["organization_id"], name: "policies_idx2" + end + + create_table "policy_asset_subtype_rules", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "policy_id", null: false + t.integer "asset_subtype_id", null: false + t.integer "fuel_type_id" + t.integer "min_service_life_months", null: false + t.integer "min_service_life_miles" + t.integer "replacement_cost", null: false + t.integer "cost_fy_year", null: false + t.boolean "replace_with_new", null: false + t.boolean "replace_with_leased", null: false + t.integer "replace_asset_subtype_id" + t.integer "replace_fuel_type_id" + t.integer "lease_length_months" + t.integer "rehabilitation_service_month" + t.integer "rehabilitation_labor_cost" + t.integer "rehabilitation_parts_cost" + t.integer "extended_service_life_months" + t.integer "extended_service_life_miles" + t.integer "min_used_purchase_service_life_months", null: false + t.string "purchase_replacement_code", limit: 8, null: false + t.string "lease_replacement_code", limit: 8 + t.string "purchase_expansion_code", limit: 8 + t.string "lease_expansion_code", limit: 8 + t.string "rehabilitation_code", limit: 8, null: false + t.string "engineering_design_code", limit: 8 + t.string "construction_code", limit: 8 + t.boolean "default_rule" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["asset_subtype_id"], name: "policy_asset_subtype_rules_idx2" + t.index ["policy_id"], name: "policy_asset_subtype_rules_idx1" + end + + create_table "policy_asset_type_rules", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "policy_id", null: false + t.integer "asset_type_id", null: false + t.integer "service_life_calculation_type_id", null: false + t.integer "replacement_cost_calculation_type_id", null: false + t.integer "condition_rollup_calculation_type_id" + t.decimal "annual_inflation_rate", precision: 9, scale: 2, null: false + t.integer "pcnt_residual_value", null: false + t.integer "condition_rollup_weight" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["asset_type_id"], name: "policy_asset_type_rules_idx2" + t.index ["policy_id"], name: "policy_asset_type_rules_idx1" end - create_table "maintenance_types", force: true do |t| - t.string "name", limit: 32, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "priority_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "is_default", null: false + t.boolean "active", null: false end - create_table "manufacturers", force: true do |t| - t.string "filter", limit: 32, null: false - t.string "name", limit: 128, null: false - t.string "code", limit: 3, null: false - t.boolean "active", null: false + create_table "query_asset_classes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "table_name" + t.text "transam_assets_join" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "manufacturers", ["filter"], name: "manufacturers_idx1", using: :btree + create_table "query_association_classes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "table_name" + t.string "display_field_name" + t.string "id_field_name", default: "id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end - create_table "message_tags", force: true do |t| - t.integer "message_id" - t.integer "user_id" + create_table "query_categories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "message_tags", ["message_id"], name: "message_tags_idx1", using: :btree - add_index "message_tags", ["user_id"], name: "message_tags_idx2", using: :btree + create_table "query_field_asset_classes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.bigint "query_field_id" + t.bigint "query_asset_class_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["query_asset_class_id"], name: "index_query_field_asset_classes_on_query_asset_class_id" + t.index ["query_field_id"], name: "index_query_field_asset_classes_on_query_field_id" + end - create_table "messages", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "organization_id", null: false - t.integer "user_id", null: false - t.integer "to_user_id" - t.integer "priority_type_id", null: false - t.integer "thread_message_id" - t.string "subject", limit: 64, null: false - t.text "body" - t.boolean "active" - t.datetime "opened_at" - t.datetime "created_at", null: false + create_table "query_fields", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name" + t.string "label" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "query_category_id" + t.string "filter_type" + t.bigint "query_association_class_id" + t.boolean "hidden" + t.string "pairs_with" + t.boolean "auto_show" + t.string "display_field" + t.string "column_filter" + t.string "column_filter_value" + t.index ["query_association_class_id"], name: "index_query_fields_on_query_association_class_id" + t.index ["query_category_id"], name: "index_query_fields_on_query_category_id" + end + + create_table "query_filters", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.bigint "query_field_id" + t.text "value" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "saved_query_id" + t.string "op" + t.index ["query_field_id"], name: "index_query_filters_on_query_field_id" + t.index ["saved_query_id"], name: "index_query_filters_on_saved_query_id" end - add_index "messages", ["object_key"], name: "messages_idx1", using: :btree - add_index "messages", ["organization_id"], name: "messages_idx2", using: :btree - add_index "messages", ["thread_message_id"], name: "messages_idx5", using: :btree - add_index "messages", ["to_user_id"], name: "messages_idx4", using: :btree - add_index "messages", ["user_id"], name: "messages_idx3", using: :btree + create_table "query_params", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name" + t.string "description" + t.text "query_string" + t.string "class_name" + t.boolean "active" + end - create_table "notice_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.string "display_icon", limit: 64, null: false - t.string "display_class", limit: 64, null: false + create_table "replacement_reason_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false t.boolean "active" end - create_table "notices", force: true do |t| - t.string "object_key", limit: 12, null: false - t.string "subject", limit: 64, null: false - t.string "summary", limit: 128, null: false - t.text "details" - t.integer "notice_type_id" - t.integer "organization_id" - t.datetime "display_datetime" - t.datetime "end_datetime" - t.boolean "active" - t.datetime "created_at" - t.datetime "updated_at" + create_table "report_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.string "display_icon_name", limit: 64, null: false + t.boolean "active", null: false + end + + create_table "reports", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "report_type_id", null: false + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.string "class_name", null: false + t.string "view_name", limit: 32, null: false + t.string "roles", limit: 128 + t.text "custom_sql" + t.boolean "show_in_nav" + t.boolean "show_in_dashboard" + t.string "chart_type", limit: 32 + t.text "chart_options" + t.boolean "active", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["report_type_id"], name: "reports_idx1" end - create_table "notifications", force: true do |t| - t.string "object_key", limit: 12, null: false - t.string "text", null: false - t.string "link", null: false - t.integer "notifiable_id" - t.string "notifiable_type" - t.boolean "active" - t.datetime "created_at" - t.datetime "updated_at" + create_table "role_privilege_mappings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.bigint "role_id" + t.bigint "privilege_id" + t.index ["privilege_id"], name: "index_role_privilege_mappings_on_privilege_id" + t.index ["role_id"], name: "index_role_privilege_mappings_on_role_id" end - add_index "notifications", ["notifiable_id", "notifiable_type"], name: "index_notifications_on_notifiable_id_and_notifiable_type", using: :btree + create_table "roles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.integer "weight" + t.integer "resource_id" + t.string "resource_type" + t.integer "role_parent_id" + t.boolean "show_in_user_mgmt" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "privilege", default: false, null: false + t.string "label" + t.index ["name"], name: "roles_idx1" + t.index ["resource_id"], name: "roles_idx2" + end - create_table "organization_role_mappings", force: true do |t| - t.integer "organization_id", null: false - t.integer "role_id", null: false - t.datetime "created_at" - t.datetime "updated_at" + create_table "rule_sets", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key" + t.string "name" + t.string "class_name" + t.boolean "rule_set_aware" + t.boolean "active" end - create_table "organization_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "class_name", limit: 64, null: false - t.string "display_icon_name", limit: 64, null: false - t.string "map_icon_name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false - end - - add_index "organization_types", ["class_name"], name: "organization_types_idx1", using: :btree - - create_table "organizations", force: true do |t| - t.integer "organization_type_id", null: false - t.integer "customer_id", null: false - t.string "external_id", limit: 32 - t.string "name", limit: 128, null: false - t.string "short_name", limit: 16, null: false - t.boolean "license_holder", null: false - t.string "address1", limit: 128, null: false - t.string "address2", limit: 128 - t.string "county", limit: 64 - t.string "city", limit: 64, null: false - t.string "state", limit: 2, null: false - t.string "zip", limit: 10, null: false - t.string "phone", limit: 12, null: false - t.string "phone_ext", limit: 6 - t.string "fax", limit: 10 - t.string "url", limit: 128, null: false - t.boolean "indian_tribe" - t.string "subrecipient_number", limit: 9 - t.string "ntd_id_number", limit: 4 - t.boolean "active", null: false - t.decimal "latitude", precision: 11, scale: 6 - t.decimal "longitude", precision: 11, scale: 6 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "organizations", ["customer_id"], name: "organizations_idx2", using: :btree - add_index "organizations", ["organization_type_id"], name: "organizations_idx1", using: :btree - add_index "organizations", ["short_name"], name: "organizations_idx4", using: :btree - add_index "organizations", ["short_name"], name: "short_name", using: :btree - - create_table "policies", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "organization_id", null: false - t.integer "parent_id" - t.integer "year", null: false - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.integer "service_life_calculation_type_id", null: false - t.integer "cost_calculation_type_id", null: false - t.integer "condition_estimation_type_id", null: false - t.decimal "condition_threshold", precision: 9, scale: 2, null: false - t.decimal "interest_rate", precision: 9, scale: 2, null: false - t.boolean "current", null: false - t.boolean "active", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "policies", ["object_key"], name: "policies_idx1", using: :btree - add_index "policies", ["organization_id"], name: "policies_idx2", using: :btree - - create_table "policy_asset_subtype_rules", force: true do |t| - t.integer "policy_id", null: false - t.integer "asset_subtype_id", null: false - t.integer "fuel_type_id" - t.integer "min_service_life_months", null: false - t.integer "min_service_life_miles" - t.integer "replacement_cost", null: false - t.integer "cost_fy_year", null: false - t.boolean "replace_with_new", null: false - t.boolean "replace_with_leased", null: false - t.integer "replace_asset_subtype_id" - t.integer "replace_fuel_type_id" - t.integer "lease_length_months" - t.integer "rehabilitation_service_month" - t.integer "rehabilitation_labor_cost" - t.integer "rehabilitation_parts_cost" - t.integer "extended_service_life_months" - t.integer "extended_service_life_miles" - t.integer "min_used_purchase_service_life_months", null: false - t.string "purchase_replacement_code", limit: 8, null: false - t.string "lease_replacement_code", limit: 8 - t.string "purchase_expansion_code", limit: 8 - t.string "lease_expansion_code", limit: 8 - t.string "rehabilitation_code", limit: 8, null: false - t.string "engineering_design_code", limit: 8 - t.string "construction_code", limit: 8 - t.boolean "default_rule" - t.datetime "created_at" - t.datetime "updated_at" + create_table "saved_queries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key" + t.string "name" + t.string "description" + t.integer "created_by_user_id" + t.integer "updated_by_user_id" + t.integer "shared_from_org_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.text "ordered_output_field_ids" end - add_index "policy_asset_subtype_rules", ["asset_subtype_id"], name: "policy_asset_subtype_rules_idx2", using: :btree - add_index "policy_asset_subtype_rules", ["policy_id"], name: "policy_asset_subtype_rules_idx1", using: :btree + create_table "saved_query_fields", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.bigint "saved_query_id" + t.bigint "query_field_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["query_field_id"], name: "index_saved_query_fields_on_query_field_id" + t.index ["saved_query_id"], name: "index_saved_query_fields_on_saved_query_id" + end + + create_table "saved_searches", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "user_id", null: false + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.integer "search_type_id" + t.text "json" + t.text "query_string" + t.integer "ordinal" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end - create_table "policy_asset_type_rules", force: true do |t| - t.integer "policy_id", null: false - t.integer "asset_type_id", null: false - t.integer "service_life_calculation_type_id", null: false - t.integer "replacement_cost_calculation_type_id", null: false - t.decimal "annual_inflation_rate", precision: 9, scale: 2, null: false - t.integer "pcnt_residual_value", null: false - t.datetime "created_at" - t.datetime "updated_at" + create_table "search_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name" + t.string "class_name" + t.boolean "active" end - add_index "policy_asset_type_rules", ["asset_type_id"], name: "policy_asset_type_rules_idx2", using: :btree - add_index "policy_asset_type_rules", ["policy_id"], name: "policy_asset_type_rules_idx1", using: :btree + create_table "serial_numbers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "identifiable_type" + t.bigint "identifiable_id" + t.string "identification" + t.index ["identifiable_type", "identifiable_id"], name: "index_serial_numbers_on_identifiable_type_and_identifiable_id" + end - create_table "priority_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "is_default", null: false - t.boolean "active", null: false + create_table "service_life_calculation_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "class_name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false + t.index ["class_name"], name: "service_life_calculation_types_idx1" end - create_table "query_params", force: true do |t| - t.string "name" - t.string "description" - t.text "query_string" - t.string "class_name" - t.boolean "active" + create_table "service_status_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "code", limit: 1, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false end - create_table "replacement_reason_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false + create_table "system_config_extensions", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "class_name" + t.string "extension_name" + t.string "engine_name" t.boolean "active" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "report_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.string "display_icon_name", limit: 64, null: false - t.boolean "active", null: false - end - - create_table "reports", force: true do |t| - t.integer "report_type_id", null: false - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.string "class_name", limit: 32, null: false - t.string "view_name", limit: 32, null: false - t.string "roles", limit: 128 - t.text "custom_sql" - t.boolean "show_in_nav" - t.boolean "show_in_dashboard" - t.string "chart_type", limit: 32 - t.text "chart_options" - t.boolean "active", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "reports", ["report_type_id"], name: "reports_idx1", using: :btree - - create_table "roles", force: true do |t| - t.string "name", limit: 64, null: false - t.integer "weight" - t.integer "resource_id" - t.string "resource_type" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "privilege", default: false, null: false - t.string "label" - end - - add_index "roles", ["name"], name: "roles_idx1", using: :btree - add_index "roles", ["resource_id"], name: "roles_idx2", using: :btree - - create_table "service_life_calculation_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "class_name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false - end - - add_index "service_life_calculation_types", ["class_name"], name: "service_life_calculation_types_idx1", using: :btree - - create_table "service_status_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "code", limit: 1, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false - end - - create_table "system_configs", force: true do |t| - t.integer "customer_id" - t.string "start_of_fiscal_year", limit: 5 - t.string "map_tile_provider", limit: 64 - t.integer "srid" - t.float "min_lat", limit: 24 - t.float "min_lon", limit: 24 - t.float "max_lat", limit: 24 - t.float "max_lon", limit: 24 - t.integer "search_radius" - t.string "search_units", limit: 8 - t.string "geocoder_components", limit: 128 - t.string "geocoder_region", limit: 64 - t.integer "num_forecasting_years" - t.integer "num_reporting_years" - t.string "asset_base_class_name", limit: 64 - t.integer "max_rows_returned" - t.string "data_file_path", limit: 64 + create_table "system_config_field_customizations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "table_name" + t.string "field_name" + t.string "description" + t.string "code_frag" + t.boolean "is_locked" + t.boolean "active" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "is_visible" + t.string "label" + t.string "action_name" + end + + create_table "system_configs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "customer_id" + t.string "start_of_fiscal_year", limit: 5 + t.integer "fy_year" + t.string "default_fiscal_year_formatter" + t.string "default_weather_code" + t.string "map_tile_provider", limit: 64 + t.integer "srid" + t.float "min_lat" + t.float "min_lon" + t.float "max_lat" + t.float "max_lon" + t.integer "search_radius" + t.string "search_units", limit: 8 + t.string "geocoder_components", limit: 128 + t.string "geocoder_region", limit: 64 + t.integer "num_forecasting_years" + t.integer "num_reporting_years" + t.integer "max_rows_returned" + t.string "measurement_system" + t.string "data_file_path", limit: 64 t.datetime "created_at" t.datetime "updated_at" end - create_table "tasks", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "taskable_id" - t.string "taskable_type" - t.integer "user_id", null: false - t.integer "priority_type_id", null: false - t.integer "organization_id", null: false - t.integer "assigned_to_user_id" - t.string "subject", limit: 64, null: false - t.text "body", null: false - t.boolean "send_reminder" - t.string "state", limit: 32 - t.datetime "complete_by", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - add_index "tasks", ["assigned_to_user_id"], name: "tasks_idx5", using: :btree - add_index "tasks", ["complete_by"], name: "tasks_idx6", using: :btree - add_index "tasks", ["object_key"], name: "tasks_idx1", using: :btree - add_index "tasks", ["organization_id"], name: "tasks_idx4", using: :btree - add_index "tasks", ["state"], name: "tasks_idx3", using: :btree - add_index "tasks", ["user_id"], name: "tasks_idx2", using: :btree - - create_table "uploads", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "organization_id" - t.integer "user_id", null: false - t.integer "file_content_type_id", null: false - t.integer "file_status_type_id", null: false - t.string "file", limit: 128, null: false - t.string "original_filename", limit: 254, null: false - t.integer "num_rows_processed" - t.integer "num_rows_added" - t.integer "num_rows_replaced" - t.integer "num_rows_skipped" - t.integer "num_rows_failed" - t.text "processing_log", limit: 2147483647 - t.boolean "force_update" + create_table "tasks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "taskable_id" + t.string "taskable_type" + t.integer "user_id", null: false + t.integer "priority_type_id", null: false + t.integer "organization_id", null: false + t.integer "assigned_to_user_id" + t.string "subject", limit: 64, null: false + t.text "body", null: false + t.boolean "send_reminder" + t.string "state", limit: 32 + t.datetime "complete_by", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["assigned_to_user_id"], name: "tasks_idx5" + t.index ["complete_by"], name: "tasks_idx6" + t.index ["object_key"], name: "tasks_idx1" + t.index ["organization_id"], name: "tasks_idx4" + t.index ["state"], name: "tasks_idx3" + t.index ["user_id"], name: "tasks_idx2" + end + + create_table "transam_assets", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "transam_assetible_type" + t.bigint "transam_assetible_id" + t.string "object_key", limit: 12, null: false + t.bigint "organization_id", null: false + t.bigint "asset_subtype_id" + t.bigint "upload_id" + t.string "asset_tag", null: false + t.date "disposition_date" + t.string "external_id" + t.text "description" + t.bigint "manufacturer_id" + t.string "other_manufacturer" + t.bigint "manufacturer_model_id" + t.string "other_manufacturer_model" + t.integer "manufacture_year" + t.integer "quantity" + t.string "quantity_unit" + t.integer "purchase_cost" + t.date "purchase_date" + t.boolean "purchased_new" + t.date "in_service_date" + t.bigint "vendor_id" + t.string "other_vendor" + t.integer "parent_id" + t.integer "location_id" + t.integer "policy_replacement_year" + t.integer "scheduled_replacement_year" + t.integer "scheduled_replacement_cost" + t.text "early_replacement_reason" + t.boolean "in_backlog" + t.integer "scheduled_rehabilitation_year" + t.integer "scheduled_disposition_year" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["asset_subtype_id"], name: "index_transam_assets_on_asset_subtype_id" + t.index ["manufacturer_id"], name: "index_transam_assets_on_manufacturer_id" + t.index ["manufacturer_model_id"], name: "index_transam_assets_on_manufacturer_model_id" + t.index ["organization_id"], name: "index_transam_assets_on_organization_id" + t.index ["transam_assetible_type", "transam_assetible_id"], name: "transam_assetible_idx" + t.index ["upload_id"], name: "index_transam_assets_on_upload_id" + t.index ["vendor_id"], name: "index_transam_assets_on_vendor_id" + end + + create_table "uploads", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "organization_id" + t.integer "user_id", null: false + t.integer "file_content_type_id", null: false + t.integer "file_status_type_id", null: false + t.string "file", limit: 128, null: false + t.string "original_filename", limit: 254, null: false + t.integer "num_rows_processed" + t.integer "num_rows_added" + t.integer "num_rows_replaced" + t.integer "num_rows_skipped" + t.integer "num_rows_failed" + t.text "processing_log", limit: 4294967295 + t.boolean "force_update" t.datetime "processing_started_at" t.datetime "processing_completed_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 ["file_content_type_id"], name: "uploads_idx4" + t.index ["file_status_type_id"], name: "uploads_idx5" + t.index ["object_key"], name: "uploads_idx1" + t.index ["organization_id"], name: "uploads_idx2" + t.index ["user_id"], name: "uploads_idx3" end - add_index "uploads", ["file_content_type_id"], name: "uploads_idx4", using: :btree - add_index "uploads", ["file_status_type_id"], name: "uploads_idx5", using: :btree - add_index "uploads", ["object_key"], name: "uploads_idx1", using: :btree - add_index "uploads", ["organization_id"], name: "uploads_idx2", using: :btree - add_index "uploads", ["user_id"], name: "uploads_idx3", using: :btree - - create_table "user_notifications", force: true do |t| - t.integer "user_id", null: false - t.integer "notification_id", null: false + create_table "user_notifications", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "notification_id", null: false t.datetime "opened_at" t.datetime "created_at" t.datetime "updated_at" + t.index ["notification_id"], name: "index_user_notifications_on_notification_id" + t.index ["user_id"], name: "index_user_notifications_on_user_id" end - add_index "user_notifications", ["notification_id"], name: "index_user_notifications_on_notification_id", using: :btree - add_index "user_notifications", ["user_id"], name: "index_user_notifications_on_user_id", using: :btree - - create_table "user_organization_filters", force: true do |t| - t.string "object_key", limit: 12, null: false - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "user_organization_filters", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false t.datetime "created_at" t.datetime "updated_at" - t.integer "sort_order" - t.integer "created_by_user_id" - t.text "query_string" - t.integer "resource_id" - t.string "resource_type" + t.integer "sort_order" + t.integer "created_by_user_id" + t.text "query_string" + t.integer "resource_id" + t.string "resource_type" + t.index ["created_by_user_id"], name: "index_user_organization_filters_on_created_by_user_id" + t.index ["object_key"], name: "user_organization_filters_idx1" end - add_index "user_organization_filters", ["created_by_user_id"], name: "index_user_organization_filters_on_created_by_user_id", using: :btree - add_index "user_organization_filters", ["object_key"], name: "user_organization_filters_idx1", using: :btree - - create_table "user_organization_filters_organizations", id: false, force: true do |t| + create_table "user_organization_filters_organizations", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.integer "user_organization_filter_id", null: false - t.integer "organization_id", null: false - end - - add_index "user_organization_filters_organizations", ["user_organization_filter_id", "organization_id"], name: "user_organization_filters_idx1", using: :btree - - create_table "users", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "organization_id", null: false - t.string "external_id", limit: 32 - t.string "first_name", limit: 64, null: false - t.string "last_name", limit: 64, null: false - t.string "title", limit: 64 - t.string "phone", limit: 12, null: false - t.string "phone_ext", limit: 6 - t.string "timezone", limit: 32, null: false - t.string "email", limit: 128, null: false - t.string "address1", limit: 64 - t.string "address2", limit: 64 - t.string "city", limit: 32 - t.string "state", limit: 2 - t.string "zip", limit: 10 - t.integer "num_table_rows" - t.integer "user_organization_filter_id" - t.string "encrypted_password", limit: 64, null: false - t.string "reset_password_token", limit: 64 + t.integer "organization_id", null: false + t.index ["user_organization_filter_id", "organization_id"], name: "user_organization_filters_idx1" + end + + create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "organization_id", null: false + t.string "external_id", limit: 32 + t.string "first_name", limit: 64, null: false + t.string "last_name", limit: 64, null: false + t.string "title", limit: 64 + t.string "phone", limit: 12, null: false + t.string "phone_ext", limit: 6 + t.string "timezone", limit: 32, null: false + t.string "email", limit: 128, null: false + t.string "address1", limit: 64 + t.string "address2", limit: 64 + t.string "city", limit: 32 + t.string "state", limit: 2 + t.string "zip", limit: 10 + t.integer "num_table_rows" + t.integer "user_organization_filter_id" + t.string "encrypted_password", limit: 64, null: false + t.string "reset_password_token", limit: 64 t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count" + t.integer "sign_in_count" t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip", limit: 16 - t.string "last_sign_in_ip", limit: 16 - t.integer "failed_attempts", null: false - t.string "unlock_token", limit: 128 + t.string "current_sign_in_ip", limit: 16 + t.string "last_sign_in_ip", limit: 16 + t.integer "failed_attempts", null: false + t.string "unlock_token", limit: 128 t.datetime "locked_at" - t.boolean "notify_via_email", null: false - t.integer "weather_code_id" - t.boolean "active", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "password_changed_at" + t.boolean "notify_via_email", null: false + t.integer "weather_code_id" + t.boolean "active", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "authentication_token", limit: 30 + t.index ["authentication_token"], name: "index_users_on_authentication_token", unique: true + t.index ["email"], name: "users_idx3" + t.index ["object_key"], name: "users_idx1" + t.index ["organization_id"], name: "users_idx2" end - add_index "users", ["email"], name: "users_idx3", using: :btree - add_index "users", ["object_key"], name: "users_idx1", using: :btree - add_index "users", ["organization_id"], name: "users_idx2", using: :btree - - create_table "users_organizations", id: false, force: true do |t| + create_table "users_organizations", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.integer "user_id" t.integer "organization_id" + t.index ["user_id", "organization_id"], name: "users_organizations_idx2" end - add_index "users_organizations", ["user_id", "organization_id"], name: "users_organizations_idx2", using: :btree - - create_table "users_roles", id: false, force: true do |t| - t.integer "user_id", null: false - t.integer "role_id", null: false - t.integer "granted_by_user_id" - t.date "granted_on_date" - t.integer "revoked_by_user_id" - t.date "revoked_on_date" - t.boolean "active" + create_table "users_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "role_id", null: false + t.integer "granted_by_user_id" + t.date "granted_on_date" + t.integer "revoked_by_user_id" + t.date "revoked_on_date" + t.boolean "active" t.datetime "created_at" t.datetime "updated_at" + t.index ["active"], name: "users_roles_idx3" + t.index ["user_id", "role_id"], name: "users_roles_idx2" end - add_index "users_roles", ["active"], name: "users_roles_idx3", using: :btree - add_index "users_roles", ["user_id", "role_id"], name: "users_roles_idx2", using: :btree - - create_table "users_user_organization_filters", force: true do |t| - t.integer "user_id", null: false + create_table "users_user_organization_filters", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "user_id", null: false t.integer "user_organization_filter_id", null: false + t.index ["user_id"], name: "users_user_organization_filters_idx1" + t.index ["user_organization_filter_id"], name: "users_user_organization_filters_idx2" end - add_index "users_user_organization_filters", ["user_id"], name: "users_user_organization_filters_idx1", using: :btree - add_index "users_user_organization_filters", ["user_organization_filter_id"], name: "users_user_organization_filters_idx2", using: :btree - - create_table "vendors", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "organization_id", null: false - t.string "name", limit: 64, null: false - t.string "address1", limit: 64 - t.string "address2", limit: 64 - t.string "city", limit: 64 - t.string "state", limit: 2 - t.string "zip", limit: 10 - t.string "phone", limit: 12 - t.string "phone_ext", limit: 6 - t.string "fax", limit: 12 - t.string "url", limit: 128 - t.decimal "latitude", precision: 11, scale: 6 - t.decimal "longitude", precision: 11, scale: 6 - t.boolean "active" - t.datetime "created_at" - t.datetime "updated_at" + create_table "users_viewable_organizations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "user_id" + t.integer "organization_id" end - add_index "vendors", ["name"], name: "vendors_idx2", using: :btree - add_index "vendors", ["object_key"], name: "vendors_idx1", using: :btree - add_index "vendors", ["organization_id"], name: "vendors_idx3", using: :btree - - create_table "versions", force: true 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 "vendors", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "organization_id", null: false + t.string "name", limit: 64, null: false + t.string "address1", limit: 64 + t.string "address2", limit: 64 + t.string "city", limit: 64 + t.string "state", limit: 2 + t.string "zip", limit: 10 + t.string "phone", limit: 12 + t.string "phone_ext", limit: 6 + t.string "fax", limit: 12 + t.string "url", limit: 128 + t.decimal "latitude", precision: 11, scale: 6 + t.decimal "longitude", precision: 11, scale: 6 + t.boolean "active" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["name"], name: "vendors_idx2" + t.index ["object_key"], name: "vendors_idx1" + t.index ["organization_id"], name: "vendors_idx3" + end + + create_table "version_associations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", 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", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", 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.text "object_changes" + t.integer "transaction_id" + t.index ["transaction_id"], name: "index_versions_on_transaction_id" end - create_table "weather_codes", force: true do |t| - t.string "state", limit: 2 - t.string "code", limit: 8 - t.string "city", limit: 64 + create_table "weather_codes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "state", limit: 2 + t.string "code", limit: 8 + t.string "city", limit: 64 t.boolean "active" + t.index ["state", "city"], name: "weather_codes_idx" end - add_index "weather_codes", ["state", "city"], name: "weather_codes_idx", using: :btree - - create_table "web_browser_types", force: true do |t| - t.string "name", limit: 64, null: false - t.string "description", limit: 254, null: false - t.boolean "active", null: false + create_table "web_browser_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "name", limit: 64, null: false + t.string "description", limit: 254, null: false + t.boolean "active", null: false end - create_table "workflow_events", force: true do |t| - t.string "object_key", limit: 12, null: false - t.integer "accountable_id", null: false - t.string "accountable_type", limit: 64, null: false - t.string "event_type", limit: 64, null: false - t.integer "created_by_id" + create_table "workflow_events", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "object_key", limit: 12, null: false + t.integer "accountable_id", null: false + t.string "accountable_type", limit: 64, null: false + t.string "event_type", limit: 64, null: false + t.integer "created_by_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["accountable_id", "accountable_type"], name: "workflow_events_idx2" + t.index ["object_key"], name: "workflow_events_idx1" end - add_index "workflow_events", ["accountable_id", "accountable_type"], name: "workflow_events_idx2", using: :btree - add_index "workflow_events", ["object_key"], name: "workflow_events_idx1", using: :btree - -end \ No newline at end of file + add_foreign_key "query_field_asset_classes", "query_asset_classes" + add_foreign_key "query_field_asset_classes", "query_fields" + add_foreign_key "query_filters", "query_fields" + add_foreign_key "saved_query_fields", "query_fields" + add_foreign_key "saved_query_fields", "saved_queries" +end From 5267754ae0b64cee0dbd35118074ce5693916c6e Mon Sep 17 00:00:00 2001 From: NJBL Date: Wed, 24 Jun 2020 09:10:44 -0400 Subject: [PATCH 15/21] audits and audit results table codes and column codes --- .../audit_results/_index_asset_table.html.haml | 16 ++++++++-------- app/views/audits/_index_table.html.haml | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/views/audit_results/_index_asset_table.html.haml b/app/views/audit_results/_index_asset_table.html.haml index c3c1751..1732544 100644 --- a/app/views/audit_results/_index_asset_table.html.haml +++ b/app/views/audit_results/_index_asset_table.html.haml @@ -14,22 +14,22 @@ %table.elbat{:id => table_dom_id, :use => 'true', :data => {:use => 'true', - :table_code => 'audits', + :table_code => 'audit', :side => 'client', :current_page => '0', :current_page_size => '10', :page_sizes => "10,20,50,100", :search => 'client', :export => "['csv', 'txt', 'excel']", - :columns => '{"0":{"name":"Organization","type":"drilldown-link","width":"10%"}, - "1":{"name":"Audit Type","width":"12%"}, + :columns => '{"org_name":{"name":"Organization","type":"drilldown-link","width":"10%"}, + "audit_type":{"name":"Audit Type","width":"12%"}, "2":{"name":"Type","width":"12%"}, - "3":{"name":"Asset ID","width":"12%"}, + "asset_id":{"name":"Asset ID","width":"12%"}, "4":{"name":"Description","width":"8%"}, "5":{"name":"Result","width":"8%"}, "6":{"name":"Updated At","type":"right-align","width":"8%"}, "notes":{"name":"Notes","width":"12%"}}', - :selected_columns => "0,1,2,3,4,5,6,notes", + :selected_columns => "org_name,audit_type,2,asset_id,4,5,6,notes", :cookies => "true", :sort => 'client', :params => "{}", @@ -42,10 +42,10 @@ :javascript add_row('#{table_dom_id}', { - "0": '#{h link_to a.organization.short_name, inventory_path(a.auditable) }', - "1": '#{h a.audit }', + "org_name": '#{h link_to a.organization.short_name, inventory_path(a.auditable) }', + "audit_type": '#{h a.audit }', "2": '#{h a.class_name }', - "3": '#{h a.auditable.asset_tag }', + "asset_id": '#{h a.auditable.asset_tag }', "4": '#{h a.auditable.description }', "5": '#{h a.audit_result_type }', "6": '#{h format_as_date(a.updated_at) }', diff --git a/app/views/audits/_index_table.html.haml b/app/views/audits/_index_table.html.haml index 6fcec8c..a8bc158 100644 --- a/app/views/audits/_index_table.html.haml +++ b/app/views/audits/_index_table.html.haml @@ -8,22 +8,22 @@ %table.elbat{:id => table_dom_id, :use => 'true', :data => {:use => 'true', - :table_code => 'audit', + :table_code => 'audits', :side => 'client', :current_page => '0', :current_page_size => '10', :page_sizes => "10,20,50,100", :search => 'client', :export => "['csv', 'txt', 'excel']", - :columns => '{"0":{"name":"Name","type":"drilldown-link","width":"10%"}, - "1":{"name":"Description","width":"30%"}, + :columns => '{"name":{"name":"Name","type":"drilldown-link","width":"10%"}, + "description":{"name":"Description","width":"30%"}, "2":{"name":"Instructions","width":"30%"}, "3":{"name":"Schedule","width":"8%"}, - "4":{"name":"Last Run","width":"8%"}, + "last_run":{"name":"Last Run","width":"8%"}, "5":{"name":"Operational","width":"8%"}, "6":{"name":"Active","width":"8%"}, "7":{"name":"Updated At","type":"right-align","width":"10%"}}', - :selected_columns => "0,1,2,4,5,6,7", + :selected_columns => "name,description,2,last_run,5,6,7", :cookies => "true", :sort => 'client', :sort_params => @params, @@ -34,11 +34,11 @@ :javascript add_row('#{table_dom_id}', { - "0": '#{h link_to a.name, audit_path(a) }', - "1": '#{h format_as_text(a.description) }', + "name": '#{h link_to a.name, audit_path(a) }', + "description": '#{h format_as_text(a.description) }', "2": '#{h format_as_text(a.instructions) }', "3": '#{h link_to a.activity, activity_path(a.activity) if a.activity.present? }', - "4": '#{h format_as_date(a.last_run) }', + "last_run": '#{h format_as_date(a.last_run) }', "5": "#{h format_as_boolean(a.operational?) }", "6": "#{h format_as_boolean(a.active) }", "7": '#{h format_as_date(a.updated_at) }', From 7d6598cf2aae9f5fe5faf11af25ef79dd301a665 Mon Sep 17 00:00:00 2001 From: Lydia Chang Date: Mon, 6 Jul 2020 14:21:51 -0400 Subject: [PATCH 16/21] TTPLAT-1482 only have all audits menu link --- app/views/shared/_audit_policy_sub_nav.html.haml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/views/shared/_audit_policy_sub_nav.html.haml b/app/views/shared/_audit_policy_sub_nav.html.haml index c7673ef..b992ef7 100644 --- a/app/views/shared/_audit_policy_sub_nav.html.haml +++ b/app/views/shared/_audit_policy_sub_nav.html.haml @@ -8,11 +8,3 @@ %i.fa.fa-line-chart.fa-fw = "All Audit Results" - - - audits.each do |audit| - %li.text-left - - type_filter = audit.audit_results.count > 0 ? audit.audit_results.first.class_name : '' - = link_to audit_results_path(:audit_filter => audit.id, :types_filter => type_filter, :audit_result_type_filter => AuditResultType::AUDIT_RESULT_FAILED) do - %i.fa.fa-line-chart.fa-fw - = "#{audit.name} Results" - From 71059a755e15e69ccd108443a4dcaa479b66a170 Mon Sep 17 00:00:00 2001 From: Lydia Chang Date: Mon, 6 Jul 2020 16:03:31 -0400 Subject: [PATCH 17/21] update test for changed view --- spec/views/shared/_audit_policy_sub_nav.html.haml_spec.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/spec/views/shared/_audit_policy_sub_nav.html.haml_spec.rb b/spec/views/shared/_audit_policy_sub_nav.html.haml_spec.rb index df11542..f37425f 100644 --- a/spec/views/shared/_audit_policy_sub_nav.html.haml_spec.rb +++ b/spec/views/shared/_audit_policy_sub_nav.html.haml_spec.rb @@ -1,12 +1,6 @@ require 'rails_helper' describe "shared/_audit_policy_sub_nav.html.haml", :type => :view do - it 'single audit results' do - test_audit = create(:audit) - render - - expect(rendered).to have_link("#{test_audit.name} Results") - end it 'all results' do render From d10ddcaa54fccb6f4c76ca6d59720bb190727417 Mon Sep 17 00:00:00 2001 From: NJBL Date: Fri, 14 Aug 2020 00:17:49 -0400 Subject: [PATCH 18/21] audits header --- app/views/audit_results/index.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/audit_results/index.html.haml b/app/views/audit_results/index.html.haml index 03733fc..d45e310 100644 --- a/app/views/audit_results/index.html.haml +++ b/app/views/audit_results/index.html.haml @@ -1,4 +1,4 @@ .col-sm-12 .page-header - %h2 Audit Results - = render "index_#{@auditable_type.downcase.pluralize}" + %h2 Audits + = render "index_#{@auditable_type.downcase.pluralize}" From 2a51fe97161ad2cb1be6b6cf9f4c78f42efd51a4 Mon Sep 17 00:00:00 2001 From: NJBL Date: Thu, 3 Sep 2020 11:35:55 -0400 Subject: [PATCH 19/21] all audit results new row selection management for updates export --- .../_index_asset_table.html.haml | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/app/views/audit_results/_index_asset_table.html.haml b/app/views/audit_results/_index_asset_table.html.haml index 1732544..7564cb5 100644 --- a/app/views/audit_results/_index_asset_table.html.haml +++ b/app/views/audit_results/_index_asset_table.html.haml @@ -37,9 +37,78 @@ :data_source => 'client', :url => ''}} + :javascript + // capture relationship between asset id and object key + let id_to_key_state = {}; + var selected_rows = new Set(); + var selected_states = new Set(); + let key_state = []; + //$('##{table_dom_id}').ready(function() { + + // Disable the table actions + enable_disable_table_actions(); + + // Add a handler for the print action which appends the selected orders to + // the href + $(".selected-action").on('click', function(e) { + + //get appropriate bulk update form and then update targets + $(this).parent().children("input[name='targets']").val(Array.from(selected_rows)); + //return true; + }); + + $('##{table_dom_id}').on('change','.cell-checkbox input[type="checkbox"]', function(e, row) { + update_selected(); + }).on('change','.header-checkbox input[type="checkbox"]:checked', function(e, row) { + update_selected(); + }).ready(function() { + // Table reloaded, clear saved selection + selected_rows = new Set(); + selected_states = new Set(); + enable_disable_table_actions(); + }); + //}); + + // Enables or disables the package actions depending on how many are selected + function enable_disable_table_actions() { + var num = selected_rows.size; + if (num > 0) { + if (selected_states.size == 1) { + $('.selected-action').removeClass('disabled'); + } else { + $('.selected-action').addClass('disabled'); + } + } else { + $('.selected-action').addClass('disabled'); + } + }; + + // Updates the selected rows in the table + function update_selected() { + if(!window['#{table_dom_id}'].checkedRows){ + window['#{table_dom_id}'].checkedRows = {}; + } + var selected = window['#{table_dom_id}'].checkedRows; + selected_rows = new Set(); + selected_states = new Set(); + for (let k of Object.keys(selected)) { + key_state = id_to_key_state[selected[k]["Asset ID"]]; + selected_rows.add(key_state[0]); + selected_states.add(key_state[1].toLowerCase().replace(/ /g, "_")); + } + //console.log(selected_rows); + enable_disable_table_actions(); + }; + + + + - audit_results.each_with_index do |a, index| - unless a.auditable.nil? :javascript + + id_to_key_state["#{h a.auditable.asset_tag}"] = ['#{h a.auditable.object_key }','#{h a.audit_result_type }']; + add_row('#{table_dom_id}', { "org_name": '#{h link_to a.organization.short_name, inventory_path(a.auditable) }', @@ -52,4 +121,5 @@ "notes": '#{h sanitize((a.notes || ""), tags:[]).gsub("\n", ' ') }', }, #{index}); + = render :partial => 'shared/table_scripts', :locals => {:table_id => 'audit_results_table', :path_pattern => activity_path("xxx")} From 59600df795a6547c1d9531f7134729532aade438 Mon Sep 17 00:00:00 2001 From: NJBL Date: Wed, 9 Sep 2020 10:08:18 -0400 Subject: [PATCH 20/21] export remove excel --- app/views/audit_results/_index_asset_table.html.haml | 2 +- app/views/audits/_index_table.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/audit_results/_index_asset_table.html.haml b/app/views/audit_results/_index_asset_table.html.haml index 7564cb5..6b70ff1 100644 --- a/app/views/audit_results/_index_asset_table.html.haml +++ b/app/views/audit_results/_index_asset_table.html.haml @@ -20,7 +20,7 @@ :current_page_size => '10', :page_sizes => "10,20,50,100", :search => 'client', - :export => "['csv', 'txt', 'excel']", + :export => "['csv', 'txt']", :columns => '{"org_name":{"name":"Organization","type":"drilldown-link","width":"10%"}, "audit_type":{"name":"Audit Type","width":"12%"}, "2":{"name":"Type","width":"12%"}, diff --git a/app/views/audits/_index_table.html.haml b/app/views/audits/_index_table.html.haml index a8bc158..f15309a 100644 --- a/app/views/audits/_index_table.html.haml +++ b/app/views/audits/_index_table.html.haml @@ -14,7 +14,7 @@ :current_page_size => '10', :page_sizes => "10,20,50,100", :search => 'client', - :export => "['csv', 'txt', 'excel']", + :export => "['csv', 'txt']", :columns => '{"name":{"name":"Name","type":"drilldown-link","width":"10%"}, "description":{"name":"Description","width":"30%"}, "2":{"name":"Instructions","width":"30%"}, From 0252a4273d02445b5cf66c33c669a010a91b5b3e Mon Sep 17 00:00:00 2001 From: Derek Edwards Date: Fri, 18 Sep 2020 15:03:13 -0400 Subject: [PATCH 21/21] Update version. --- Gemfile | 2 +- app/models/concerns/transam_auditable.rb | 1 + lib/transam_audit/version.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index d073c6f..af1b116 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem 'active_record-acts_as', git: 'https://github.com/camsys/active_record-acts_ # To use debugger # gem 'debugger' -gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter2 +gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :master gem 'mysql2', "~> 0.5.1" # lock gem for dummy app gem "capybara", '2.6.2' # lock gem for old capybara behavior on hidden element xpath gem 'sass-rails' diff --git a/app/models/concerns/transam_auditable.rb b/app/models/concerns/transam_auditable.rb index 3fea710..20fe51a 100644 --- a/app/models/concerns/transam_auditable.rb +++ b/app/models/concerns/transam_auditable.rb @@ -73,6 +73,7 @@ def check_for_audit_changes end self.has_audit_changes = audit_changed return true + end #----------------------------------------------------------------------------- diff --git a/lib/transam_audit/version.rb b/lib/transam_audit/version.rb index 1acc71f..5ca5f2c 100644 --- a/lib/transam_audit/version.rb +++ b/lib/transam_audit/version.rb @@ -1,3 +1,3 @@ module TransamAudit - VERSION = "2.11.0-rc.X" + VERSION = "2.11.0" end