aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2017-09-18 15:00:00 +0200
committerLuc Donnet2017-09-18 15:00:00 +0200
commit196f739a0d9ac8a911b5ac032dca383d646872f3 (patch)
tree788846a7ea7b024f2b5f70f894c3f2871f4a0f3b
parentcfd1dd541fcfb0f8a4a4cd1b307456344eca40a0 (diff)
downloadchouette-core-196f739a0d9ac8a911b5ac032dca383d646872f3.tar.bz2
Fix table name compliance_check_result to compliance_check_message Refs #4390 @2
-rw-r--r--app/models/compliance_check_message.rb (renamed from app/models/compliance_check_result.rb)2
-rw-r--r--config/locales/compliance_check_results.en.yml3
-rw-r--r--config/locales/compliance_check_results.fr.yml3
-rw-r--r--db/migrate/20170918103913_alter_table_compliance_check_result_to_compliance_check_message.rb5
-rw-r--r--db/schema.rb34
-rw-r--r--lib/tasks/erd.rake4
-rw-r--r--spec/factories/compliance_check_messages.rb (renamed from spec/factories/compliance_check_results.rb)2
-rw-r--r--spec/models/compliance_check_message_spec.rb (renamed from spec/models/compliance_check_result_spec.rb)4
8 files changed, 30 insertions, 27 deletions
diff --git a/app/models/compliance_check_result.rb b/app/models/compliance_check_message.rb
index 161e45189..86899eb15 100644
--- a/app/models/compliance_check_result.rb
+++ b/app/models/compliance_check_message.rb
@@ -1,4 +1,4 @@
-class ComplianceCheckResult < ActiveRecord::Base
+class ComplianceCheckMessage < ActiveRecord::Base
belongs_to :compliance_check
belongs_to :compliance_check_resource
end
diff --git a/config/locales/compliance_check_results.en.yml b/config/locales/compliance_check_results.en.yml
index e0541ab36..cd22aefb1 100644
--- a/config/locales/compliance_check_results.en.yml
+++ b/config/locales/compliance_check_results.en.yml
@@ -1,3 +1,2 @@
en:
- compliance_check_results:
-
+ compliance_check_messages:
diff --git a/config/locales/compliance_check_results.fr.yml b/config/locales/compliance_check_results.fr.yml
index b3ddc53f2..d3fbf0900 100644
--- a/config/locales/compliance_check_results.fr.yml
+++ b/config/locales/compliance_check_results.fr.yml
@@ -1,3 +1,2 @@
fr:
- compliance_check_results:
-
+ compliance_check_messages:
diff --git a/db/migrate/20170918103913_alter_table_compliance_check_result_to_compliance_check_message.rb b/db/migrate/20170918103913_alter_table_compliance_check_result_to_compliance_check_message.rb
new file mode 100644
index 000000000..c0dc6225a
--- /dev/null
+++ b/db/migrate/20170918103913_alter_table_compliance_check_result_to_compliance_check_message.rb
@@ -0,0 +1,5 @@
+class AlterTableComplianceCheckResultToComplianceCheckMessage < ActiveRecord::Migration
+ def change
+ rename_table :compliance_check_results, :compliance_check_messages
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 7b6731d3f..2b62fa7f1 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20170915100935) do
+ActiveRecord::Schema.define(version: 20170918103913) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -155,17 +155,7 @@ ActiveRecord::Schema.define(version: 20170915100935) do
add_index "compliance_check_blocks", ["compliance_check_set_id"], name: "index_compliance_check_blocks_on_compliance_check_set_id", using: :btree
- create_table "compliance_check_resources", id: :bigserial, force: :cascade do |t|
- t.string "status"
- t.string "name"
- t.string "type"
- t.string "reference"
- t.hstore "metrics"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
-
- create_table "compliance_check_results", id: :bigserial, force: :cascade do |t|
+ create_table "compliance_check_messages", id: :bigserial, force: :cascade do |t|
t.integer "compliance_check_id"
t.integer "compliance_check_resource_id"
t.string "message_key"
@@ -175,8 +165,18 @@ ActiveRecord::Schema.define(version: 20170915100935) do
t.datetime "updated_at", null: false
end
- add_index "compliance_check_results", ["compliance_check_id"], name: "index_compliance_check_results_on_compliance_check_id", using: :btree
- add_index "compliance_check_results", ["compliance_check_resource_id"], name: "index_compliance_check_results_on_compliance_check_resource_id", using: :btree
+ add_index "compliance_check_messages", ["compliance_check_id"], name: "index_compliance_check_messages_on_compliance_check_id", using: :btree
+ add_index "compliance_check_messages", ["compliance_check_resource_id"], name: "index_compliance_check_messages_on_compliance_check_resource_id", using: :btree
+
+ create_table "compliance_check_resources", id: :bigserial, force: :cascade do |t|
+ t.string "status"
+ t.string "name"
+ t.string "type"
+ t.string "reference"
+ t.hstore "metrics"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
create_table "compliance_check_sets", id: :bigserial, force: :cascade do |t|
t.integer "referential_id"
@@ -394,9 +394,9 @@ ActiveRecord::Schema.define(version: 20170915100935) do
t.string "type"
t.integer "parent_id", limit: 8
t.string "parent_type"
+ t.datetime "notified_parent_at"
t.integer "current_step", default: 0
t.integer "total_steps", default: 0
- t.datetime "notified_parent_at"
t.string "creator"
end
@@ -966,8 +966,8 @@ ActiveRecord::Schema.define(version: 20170915100935) do
add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey"
add_foreign_key "api_keys", "organisations"
add_foreign_key "compliance_check_blocks", "compliance_check_sets"
- add_foreign_key "compliance_check_results", "compliance_check_resources"
- add_foreign_key "compliance_check_results", "compliance_checks"
+ add_foreign_key "compliance_check_messages", "compliance_check_resources"
+ add_foreign_key "compliance_check_messages", "compliance_checks"
add_foreign_key "compliance_check_sets", "compliance_control_sets"
add_foreign_key "compliance_check_sets", "referentials"
add_foreign_key "compliance_check_sets", "workbenches"
diff --git a/lib/tasks/erd.rake b/lib/tasks/erd.rake
index a9b1a3454..6b79967de 100644
--- a/lib/tasks/erd.rake
+++ b/lib/tasks/erd.rake
@@ -3,10 +3,10 @@ namespace :generate do
desc "Create model diagrams for Chouette"
task :model_diagram => :environment do
sh "bundle exec rake erd only='Organisation,Referential,User,Workbench' filename='organisation' title='Organisation'"
- sh "bundle exec rake erd only='Calendar,Referential,Chouette::Line,Chouette::Route,Chouette::JourneyPattern,Chouette::VehicleJourney,Chouette::VehicleJourneyAtStop,Chouette::TimeTable,Chouette::TimeTableDate,Chouette::TimeTablePeriod,Chouette::Footnote,Chouette::Network,Chouette::Company,Chouette::StopPoint,Chouette::StopArea' filename='offer_datas' title='Offer Datas'"
+ sh "bundle exec rake erd only='Calendar,Referential,ReferentialMetadata,Chouette::Line,Chouette::Route,Chouette::JourneyPattern,Chouette::VehicleJourney,Chouette::VehicleJourneyAtStop,Chouette::TimeTable,Chouette::TimeTableDate,Chouette::TimeTablePeriod,Chouette::Footnote,Chouette::Network,Chouette::Company,Chouette::StopPoint,Chouette::StopArea' filename='offer_datas' title='Offer Datas'"
sh "bundle exec rake erd only='Organisation,StopAreaReferential,StopAreaReferentialSync,StopAreaReferentialSyncMessage,StopAreaReferentialMembership,LineReferential,LineReferentialSync,LineReferentialSyncMessage,LineReferentialMembership' filename='referentiels_externes' title='Référentiels externes'"
sh "bundle exec rake erd only='NetexImport,Import,WorkbenchImport,ImportResource,ImportMessage' filename='import' title='Import'"
- #sh "bundle exec rake erd only='' filename='validation' title='Validation'"
+ sh "bundle exec rake erd only='ComplianceControlSet,ComplianceControlBlock,ComplianceControl,ComplianceCheckSet,ComplianceCheckBlock,ComplianceCheck,ComplianceCheckResource,ComplianceCheckMessage' filename='validation' title='Validation'"
#sh "bundle exec rake erd only='VehicleJourney,VehicleJourneyExport' filename='export' title='Export'"
#sh "bundle exec rake erd only='' filename='intégration' title='Integration'"
#sh "bundle exec rake erd only='' filename='fusion' title='Fusion'"
diff --git a/spec/factories/compliance_check_results.rb b/spec/factories/compliance_check_messages.rb
index a56d77ce4..1a047a242 100644
--- a/spec/factories/compliance_check_results.rb
+++ b/spec/factories/compliance_check_messages.rb
@@ -1,5 +1,5 @@
FactoryGirl.define do
- factory :compliance_check_result do
+ factory :compliance_check_message do
association :compliance_check
association :compliance_check_resource
message_key "message_key"
diff --git a/spec/models/compliance_check_result_spec.rb b/spec/models/compliance_check_message_spec.rb
index 95586862f..8b424595e 100644
--- a/spec/models/compliance_check_result_spec.rb
+++ b/spec/models/compliance_check_message_spec.rb
@@ -1,8 +1,8 @@
require 'rails_helper'
-RSpec.describe ComplianceCheckResult, type: :model do
+RSpec.describe ComplianceCheckMessage, type: :model do
it 'should have a valid factory' do
- expect(FactoryGirl.build(:compliance_check_result)).to be_valid
+ expect(FactoryGirl.build(:compliance_check_message)).to be_valid
end
it { should belong_to :compliance_check }