diff options
| -rw-r--r-- | app/models/compliance_control_set.rb | 3 | ||||
| -rw-r--r-- | db/migrate/20170905101656_create_compliance_control_sets.rb | 10 | ||||
| -rw-r--r-- | db/schema.rb | 14 | ||||
| -rw-r--r-- | spec/factories/compliance_control_sets.rb | 6 | ||||
| -rw-r--r-- | spec/models/compliance_control_set_spec.rb | 9 |
5 files changed, 40 insertions, 2 deletions
diff --git a/app/models/compliance_control_set.rb b/app/models/compliance_control_set.rb new file mode 100644 index 000000000..7801eb612 --- /dev/null +++ b/app/models/compliance_control_set.rb @@ -0,0 +1,3 @@ +class ComplianceControlSet < ActiveRecord::Base + belongs_to :organisation +end diff --git a/db/migrate/20170905101656_create_compliance_control_sets.rb b/db/migrate/20170905101656_create_compliance_control_sets.rb new file mode 100644 index 000000000..d074267cd --- /dev/null +++ b/db/migrate/20170905101656_create_compliance_control_sets.rb @@ -0,0 +1,10 @@ +class CreateComplianceControlSets < ActiveRecord::Migration + def change + create_table :compliance_control_sets do |t| + t.string :name + t.references :organisation, index: true, foreign_key: true + + t.timestamps null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb index d1bd3bc2b..bbbaf935e 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: 20170901132253) do +ActiveRecord::Schema.define(version: 20170905101656) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -145,6 +145,15 @@ ActiveRecord::Schema.define(version: 20170901132253) do add_index "companies", ["objectid"], name: "companies_objectid_key", unique: true, using: :btree add_index "companies", ["registration_number"], name: "companies_registration_number_key", using: :btree + create_table "compliance_control_sets", id: :bigserial, force: :cascade do |t| + t.string "name" + t.integer "organisation_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "compliance_control_sets", ["organisation_id"], name: "index_compliance_control_sets_on_organisation_id", using: :btree + create_table "connection_links", id: :bigserial, force: :cascade do |t| t.integer "departure_id", limit: 8 t.integer "arrival_id", limit: 8 @@ -292,9 +301,9 @@ ActiveRecord::Schema.define(version: 20170901132253) 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 @@ -858,6 +867,7 @@ ActiveRecord::Schema.define(version: 20170901132253) do add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey" add_foreign_key "api_keys", "organisations" + add_foreign_key "compliance_control_sets", "organisations" add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", on_delete: :cascade add_foreign_key "journey_frequencies", "timebands", on_delete: :nullify add_foreign_key "journey_frequencies", "vehicle_journeys", on_delete: :nullify diff --git a/spec/factories/compliance_control_sets.rb b/spec/factories/compliance_control_sets.rb new file mode 100644 index 000000000..f322816ed --- /dev/null +++ b/spec/factories/compliance_control_sets.rb @@ -0,0 +1,6 @@ +FactoryGirl.define do + factory :compliance_control_set do + sequence(:name) { |n| "Compliance control set #{n}" } + organisation + end +end diff --git a/spec/models/compliance_control_set_spec.rb b/spec/models/compliance_control_set_spec.rb new file mode 100644 index 000000000..fb46bc65a --- /dev/null +++ b/spec/models/compliance_control_set_spec.rb @@ -0,0 +1,9 @@ +require 'rails_helper' + +RSpec.describe ComplianceControlSet, type: :model do + it 'should have a valid factory' do + expect(FactoryGirl.build(:compliance_control_set)).to be_valid + end + + it { should belong_to :organisation } +end |
