diff options
Diffstat (limited to 'db/schema.rb')
| -rw-r--r-- | db/schema.rb | 171 | 
1 files changed, 125 insertions, 46 deletions
| diff --git a/db/schema.rb b/db/schema.rb index c709290f5..7b77a55d2 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: 20180202170009) do +ActiveRecord::Schema.define(version: 20180416065012) do    # These are extensions that must be enabled in order to support this database    enable_extension "plpgsql" @@ -22,7 +22,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do    create_table "access_links", id: :bigserial, force: :cascade do |t|      t.integer  "access_point_id",                        limit: 8      t.integer  "stop_area_id",                           limit: 8 -    t.string   "objectid",                                                                  null: false +    t.string   "objectid",                                                                               null: false      t.integer  "object_version",                         limit: 8      t.string   "name"      t.string   "comment" @@ -39,6 +39,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.string   "link_orientation"      t.datetime "created_at"      t.datetime "updated_at" +    t.jsonb    "metadata",                                                                  default: {}    end    add_index "access_links", ["objectid"], name: "access_links_objectid_key", unique: true, using: :btree @@ -66,6 +67,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.text     "import_xml"      t.datetime "created_at"      t.datetime "updated_at" +    t.jsonb    "metadata",                                                            default: {}    end    add_index "access_points", ["objectid"], name: "access_points_objectid_key", unique: true, using: :btree @@ -77,26 +79,26 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.datetime "created_at"      t.datetime "updated_at"      t.integer  "organisation_id", limit: 8 +    t.jsonb    "metadata",                  default: {}    end    add_index "api_keys", ["organisation_id"], name: "index_api_keys_on_organisation_id", using: :btree    create_table "calendars", id: :bigserial, force: :cascade do |t|      t.string    "name" -    t.string    "short_name"      t.daterange "date_ranges",                               array: true      t.date      "dates",                                     array: true      t.boolean   "shared",                    default: false      t.integer   "organisation_id", limit: 8      t.datetime  "created_at"      t.datetime  "updated_at" -    t.integer   "workgroup_id",    limit: 8      t.integer   "int_day_types"      t.date      "excluded_dates",                            array: true +    t.integer   "workgroup_id",    limit: 8 +    t.jsonb     "metadata",                  default: {}    end    add_index "calendars", ["organisation_id"], name: "index_calendars_on_organisation_id", using: :btree -  add_index "calendars", ["short_name"], name: "index_calendars_on_short_name", unique: true, using: :btree    add_index "calendars", ["workgroup_id"], name: "index_calendars_on_workgroup_id", using: :btree    create_table "clean_up_results", id: :bigserial, force: :cascade do |t| @@ -125,7 +127,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do    add_index "clean_ups", ["referential_id"], name: "index_clean_ups_on_referential_id", using: :btree    create_table "companies", id: :bigserial, force: :cascade do |t| -    t.string   "objectid",                            null: false +    t.string   "objectid",                                         null: false      t.integer  "object_version",            limit: 8      t.string   "name"      t.string   "short_name" @@ -142,8 +144,11 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.text     "import_xml"      t.datetime "created_at"      t.datetime "updated_at" +    t.jsonb    "custom_field_values",                 default: {} +    t.jsonb    "metadata",                            default: {}    end +  add_index "companies", ["line_referential_id", "registration_number"], name: "index_companies_on_referential_id_and_registration_number", using: :btree    add_index "companies", ["line_referential_id"], name: "index_companies_on_line_referential_id", using: :btree    add_index "companies", ["objectid"], name: "companies_objectid_key", unique: true, using: :btree    add_index "companies", ["registration_number"], name: "companies_registration_number_key", using: :btree @@ -194,14 +199,15 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.string   "status"      t.integer  "parent_id",                 limit: 8      t.string   "parent_type" -    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.string   "current_step_id"      t.float    "current_step_progress"      t.string   "name"      t.datetime "started_at"      t.datetime "ended_at"      t.datetime "notified_parent_at" +    t.jsonb    "metadata",                            default: {}    end    add_index "compliance_check_sets", ["compliance_control_set_id"], name: "index_compliance_check_sets_on_compliance_control_set_id", using: :btree @@ -221,6 +227,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.datetime "created_at",                          null: false      t.datetime "updated_at",                          null: false      t.string   "origin_code" +    t.string   "compliance_control_name"    end    add_index "compliance_checks", ["compliance_check_block_id"], name: "index_compliance_checks_on_compliance_check_block_id", using: :btree @@ -239,8 +246,9 @@ ActiveRecord::Schema.define(version: 20180202170009) do    create_table "compliance_control_sets", id: :bigserial, force: :cascade do |t|      t.string   "name"      t.integer  "organisation_id", limit: 8 -    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.jsonb    "metadata",                  default: {}    end    add_index "compliance_control_sets", ["organisation_id"], name: "index_compliance_control_sets_on_organisation_id", using: :btree @@ -266,7 +274,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do    create_table "connection_links", id: :bigserial, force: :cascade do |t|      t.integer  "departure_id",                           limit: 8      t.integer  "arrival_id",                             limit: 8 -    t.string   "objectid",                                                                  null: false +    t.string   "objectid",                                                                               null: false      t.integer  "object_version",                         limit: 8      t.string   "name"      t.string   "comment" @@ -282,6 +290,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.integer  "int_user_needs"      t.datetime "created_at"      t.datetime "updated_at" +    t.jsonb    "metadata",                                                                  default: {}    end    add_index "connection_links", ["objectid"], name: "connection_links_objectid_key", unique: true, using: :btree @@ -299,18 +308,58 @@ ActiveRecord::Schema.define(version: 20180202170009) do    add_index "custom_fields", ["resource_type"], name: "index_custom_fields_on_resource_type", using: :btree +  create_table "export_messages", id: :bigserial, force: :cascade do |t| +    t.string   "criticity" +    t.string   "message_key" +    t.hstore   "message_attributes" +    t.integer  "export_id",           limit: 8 +    t.integer  "resource_id",         limit: 8 +    t.datetime "created_at" +    t.datetime "updated_at" +    t.hstore   "resource_attributes" +  end + +  add_index "export_messages", ["export_id"], name: "index_export_messages_on_export_id", using: :btree +  add_index "export_messages", ["resource_id"], name: "index_export_messages_on_resource_id", using: :btree + +  create_table "export_resources", id: :bigserial, force: :cascade do |t| +    t.integer  "export_id",     limit: 8 +    t.string   "status" +    t.datetime "created_at" +    t.datetime "updated_at" +    t.string   "resource_type" +    t.string   "reference" +    t.string   "name" +    t.hstore   "metrics" +  end + +  add_index "export_resources", ["export_id"], name: "index_export_resources_on_export_id", using: :btree +    create_table "exports", id: :bigserial, force: :cascade do |t| -    t.integer  "referential_id",  limit: 8      t.string   "status" -    t.string   "type" -    t.string   "options" +    t.string   "current_step_id" +    t.float    "current_step_progress" +    t.integer  "workbench_id",          limit: 8 +    t.integer  "referential_id",        limit: 8 +    t.string   "name"      t.datetime "created_at"      t.datetime "updated_at" -    t.string   "references_type" -    t.string   "reference_ids" +    t.string   "file" +    t.datetime "started_at" +    t.datetime "ended_at" +    t.string   "token_upload" +    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.string   "creator" +    t.hstore   "options"    end    add_index "exports", ["referential_id"], name: "index_exports_on_referential_id", using: :btree +  add_index "exports", ["workbench_id"], name: "index_exports_on_workbench_id", using: :btree    create_table "facilities", id: :bigserial, force: :cascade do |t|      t.integer  "stop_area_id",       limit: 8 @@ -359,7 +408,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do    end    create_table "group_of_lines", id: :bigserial, force: :cascade do |t| -    t.string   "objectid",                      null: false +    t.string   "objectid",                                   null: false      t.integer  "object_version",      limit: 8      t.string   "name"      t.string   "comment" @@ -368,6 +417,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.text     "import_xml"      t.datetime "created_at"      t.datetime "updated_at" +    t.jsonb    "metadata",                      default: {}    end    add_index "group_of_lines", ["line_referential_id"], name: "index_group_of_lines_on_line_referential_id", using: :btree @@ -393,7 +443,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do    add_index "import_messages", ["resource_id"], name: "index_import_messages_on_resource_id", using: :btree    create_table "import_resources", id: :bigserial, force: :cascade do |t| -    t.integer  "import_id",     limit: 8 +    t.integer  "import_id",      limit: 8      t.string   "status"      t.datetime "created_at"      t.datetime "updated_at" @@ -401,9 +451,13 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.string   "reference"      t.string   "name"      t.hstore   "metrics" +    t.integer  "referential_id" +    t.integer  "parent_id"    end    add_index "import_resources", ["import_id"], name: "index_import_resources_on_import_id", using: :btree +  add_index "import_resources", ["parent_id"], name: "index_import_resources_on_parent_id", using: :btree +  add_index "import_resources", ["referential_id"], name: "index_import_resources_on_referential_id", using: :btree    create_table "imports", id: :bigserial, force: :cascade do |t|      t.string   "status" @@ -421,9 +475,9 @@ ActiveRecord::Schema.define(version: 20180202170009) 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 @@ -446,7 +500,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do    create_table "journey_patterns", id: :bigserial, force: :cascade do |t|      t.integer  "route_id",                limit: 8 -    t.string   "objectid",                                      null: false +    t.string   "objectid",                                       null: false      t.integer  "object_version",          limit: 8      t.string   "name"      t.string   "comment" @@ -454,13 +508,14 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.string   "published_name"      t.integer  "departure_stop_point_id", limit: 8      t.integer  "arrival_stop_point_id",   limit: 8 -    t.integer  "section_status",                    default: 0, null: false      t.datetime "created_at"      t.datetime "updated_at"      t.string   "checksum"      t.text     "checksum_source"      t.string   "data_source_ref"      t.json     "costs" +    t.jsonb    "metadata",                          default: {} +    t.jsonb    "custom_field_values"    end    add_index "journey_patterns", ["objectid"], name: "journey_patterns_objectid_key", unique: true, using: :btree @@ -534,8 +589,10 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.datetime "created_at"      t.datetime "updated_at"      t.boolean  "seasonal" +    t.jsonb    "metadata",                                  default: {}    end +  add_index "lines", ["line_referential_id", "registration_number"], name: "index_lines_on_referential_id_and_registration_number", using: :btree    add_index "lines", ["line_referential_id"], name: "index_lines_on_line_referential_id", using: :btree    add_index "lines", ["objectid"], name: "lines_objectid_key", unique: true, using: :btree    add_index "lines", ["registration_number"], name: "lines_registration_number_key", using: :btree @@ -555,7 +612,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do    add_index "merges", ["workbench_id"], name: "index_merges_on_workbench_id", using: :btree    create_table "networks", id: :bigserial, force: :cascade do |t| -    t.string   "objectid",                      null: false +    t.string   "objectid",                                   null: false      t.integer  "object_version",      limit: 8      t.date     "version_date"      t.string   "description" @@ -569,6 +626,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.integer  "line_referential_id", limit: 8      t.datetime "created_at"      t.datetime "updated_at" +    t.jsonb    "metadata",                      default: {}    end    add_index "networks", ["line_referential_id"], name: "index_networks_on_line_referential_id", using: :btree @@ -593,13 +651,14 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.integer  "start_of_link_id", limit: 8      t.integer  "end_of_link_id",   limit: 8      t.integer  "route_id",         limit: 8 -    t.string   "objectid",                                            null: false +    t.string   "objectid",                                                         null: false      t.integer  "object_version",   limit: 8      t.string   "name"      t.string   "comment"      t.decimal  "link_distance",              precision: 19, scale: 2      t.datetime "created_at"      t.datetime "updated_at" +    t.jsonb    "metadata",                                            default: {}    end    add_index "pt_links", ["objectid"], name: "pt_links_objectid_key", unique: true, using: :btree @@ -607,13 +666,14 @@ ActiveRecord::Schema.define(version: 20180202170009) do    create_table "purchase_windows", id: :bigserial, force: :cascade do |t|      t.string    "name"      t.string    "color" -    t.daterange "date_ranges",                            array: true -    t.datetime  "created_at",                null: false -    t.datetime  "updated_at",                null: false +    t.daterange "date_ranges",                                         array: true +    t.datetime  "created_at",                             null: false +    t.datetime  "updated_at",                             null: false      t.string    "objectid"      t.string    "checksum"      t.text      "checksum_source"      t.integer   "referential_id",  limit: 8 +    t.jsonb     "metadata",                  default: {}    end    add_index "purchase_windows", ["referential_id"], name: "index_purchase_windows_on_referential_id", using: :btree @@ -703,6 +763,8 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.string   "checksum"      t.text     "checksum_source"      t.string   "data_source_ref" +    t.json     "costs" +    t.jsonb    "metadata"    end    add_index "routes", ["objectid"], name: "routes_objectid_key", unique: true, using: :btree @@ -711,13 +773,14 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.string   "name"      t.datetime "created_at"      t.datetime "updated_at" -    t.string   "objectid",                  null: false +    t.string   "objectid",                               null: false      t.integer  "object_version",  limit: 8      t.integer  "route_id",        limit: 8 -    t.integer  "stop_point_ids",  limit: 8,              array: true +    t.integer  "stop_point_ids",  limit: 8,                           array: true      t.string   "checksum"      t.text     "checksum_source"      t.string   "data_source_ref" +    t.jsonb    "metadata",                  default: {}    end    create_table "routing_constraints_lines", id: false, force: :cascade do |t| @@ -725,11 +788,12 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.integer "line_id",      limit: 8    end -  create_table "simple_importers", id: :bigserial, force: :cascade do |t| +  create_table "simple_interfaces", id: :bigserial, force: :cascade do |t|      t.string "configuration_name"      t.string "filepath"      t.string "status"      t.json   "journal" +    t.string "type"    end    create_table "stop_area_referential_memberships", id: :bigserial, force: :cascade do |t| @@ -765,11 +829,12 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.datetime "created_at"      t.datetime "updated_at"      t.string   "objectid_format" +    t.string   "registration_number_format"    end    create_table "stop_areas", id: :bigserial, force: :cascade do |t|      t.integer  "parent_id",                       limit: 8 -    t.string   "objectid",                                                            null: false +    t.string   "objectid",                                                                         null: false      t.integer  "object_version",                  limit: 8      t.string   "name"      t.string   "comment" @@ -800,11 +865,15 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.integer  "waiting_time"      t.string   "kind"      t.jsonb    "localized_names" +    t.json     "custom_field_values" +    t.datetime "confirmed_at" +    t.jsonb    "metadata",                                                            default: {}    end    add_index "stop_areas", ["name"], name: "index_stop_areas_on_name", using: :btree    add_index "stop_areas", ["objectid"], name: "stop_areas_objectid_key", unique: true, using: :btree    add_index "stop_areas", ["parent_id"], name: "index_stop_areas_on_parent_id", using: :btree +  add_index "stop_areas", ["stop_area_referential_id", "registration_number"], name: "index_stop_areas_on_referential_id_and_registration_number", using: :btree    add_index "stop_areas", ["stop_area_referential_id"], name: "index_stop_areas_on_stop_area_referential_id", using: :btree    create_table "stop_areas_stop_areas", id: false, force: :cascade do |t| @@ -815,13 +884,14 @@ ActiveRecord::Schema.define(version: 20180202170009) do    create_table "stop_points", id: :bigserial, force: :cascade do |t|      t.integer  "route_id",       limit: 8      t.integer  "stop_area_id",   limit: 8 -    t.string   "objectid",                 null: false +    t.string   "objectid",                              null: false      t.integer  "object_version", limit: 8      t.integer  "position"      t.string   "for_boarding"      t.string   "for_alighting"      t.datetime "created_at"      t.datetime "updated_at" +    t.jsonb    "metadata",                 default: {}    end    add_index "stop_points", ["objectid"], name: "stop_points_objectid_key", unique: true, using: :btree @@ -869,7 +939,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do    add_index "time_table_periods", ["time_table_id"], name: "index_time_table_periods_on_time_table_id", using: :btree    create_table "time_tables", id: :bigserial, force: :cascade do |t| -    t.string   "objectid",                              null: false +    t.string   "objectid",                               null: false      t.integer  "object_version",  limit: 8, default: 1      t.string   "version"      t.string   "comment" @@ -884,6 +954,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.string   "checksum"      t.text     "checksum_source"      t.string   "data_source_ref" +    t.jsonb    "metadata",                  default: {}    end    add_index "time_tables", ["calendar_id"], name: "index_time_tables_on_calendar_id", using: :btree @@ -899,13 +970,14 @@ ActiveRecord::Schema.define(version: 20180202170009) do    add_index "time_tables_vehicle_journeys", ["vehicle_journey_id"], name: "index_time_tables_vehicle_journeys_on_vehicle_journey_id", using: :btree    create_table "timebands", id: :bigserial, force: :cascade do |t| -    t.string   "objectid",                 null: false +    t.string   "objectid",                              null: false      t.integer  "object_version", limit: 8      t.string   "name" -    t.time     "start_time",               null: false -    t.time     "end_time",                 null: false +    t.time     "start_time",                            null: false +    t.time     "end_time",                              null: false      t.datetime "created_at"      t.datetime "updated_at" +    t.jsonb    "metadata",                 default: {}    end    create_table "users", id: :bigserial, force: :cascade do |t| @@ -973,7 +1045,6 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.string   "objectid",                                               null: false      t.integer  "object_version",                  limit: 8      t.string   "comment" -    t.string   "status_value"      t.string   "transport_mode"      t.string   "published_journey_name"      t.string   "published_journey_identifier" @@ -989,15 +1060,16 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.text     "checksum_source"      t.string   "data_source_ref"      t.jsonb    "custom_field_values",                       default: {} +    t.jsonb    "metadata",                                  default: {}    end    add_index "vehicle_journeys", ["objectid"], name: "vehicle_journeys_objectid_key", unique: true, using: :btree    add_index "vehicle_journeys", ["route_id"], name: "index_vehicle_journeys_on_route_id", using: :btree    create_table "versions", id: :bigserial, force: :cascade do |t| -    t.string   "item_type",            null: false -    t.integer  "item_id",    limit: 8, null: false -    t.string   "event",                null: false +    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" @@ -1007,17 +1079,21 @@ ActiveRecord::Schema.define(version: 20180202170009) do    create_table "workbenches", id: :bigserial, force: :cascade do |t|      t.string   "name" -    t.integer  "organisation_id",          limit: 8 +    t.integer  "organisation_id",                  limit: 8      t.datetime "created_at"      t.datetime "updated_at" -    t.integer  "line_referential_id",      limit: 8 -    t.integer  "stop_area_referential_id", limit: 8 -    t.integer  "output_id",                limit: 8 +    t.integer  "line_referential_id",              limit: 8 +    t.integer  "stop_area_referential_id",         limit: 8 +    t.integer  "output_id",                        limit: 8      t.string   "objectid_format" -    t.integer  "workgroup_id",             limit: 8 +    t.integer  "workgroup_id",                     limit: 8 +    t.integer  "import_compliance_control_set_id", limit: 8 +    t.integer  "merge_compliance_control_set_id",  limit: 8    end +  add_index "workbenches", ["import_compliance_control_set_id"], name: "index_workbenches_on_import_compliance_control_set_id", using: :btree    add_index "workbenches", ["line_referential_id"], name: "index_workbenches_on_line_referential_id", using: :btree +  add_index "workbenches", ["merge_compliance_control_set_id"], name: "index_workbenches_on_merge_compliance_control_set_id", using: :btree    add_index "workbenches", ["organisation_id"], name: "index_workbenches_on_organisation_id", using: :btree    add_index "workbenches", ["stop_area_referential_id"], name: "index_workbenches_on_stop_area_referential_id", using: :btree    add_index "workbenches", ["workgroup_id"], name: "index_workbenches_on_workgroup_id", using: :btree @@ -1026,8 +1102,10 @@ ActiveRecord::Schema.define(version: 20180202170009) do      t.string   "name"      t.integer  "line_referential_id",      limit: 8      t.integer  "stop_area_referential_id", limit: 8 -    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.string   "import_types",                       default: [],              array: true +    t.string   "export_types",                       default: [],              array: true    end    add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey" @@ -1045,6 +1123,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do    add_foreign_key "compliance_controls", "compliance_control_blocks"    add_foreign_key "compliance_controls", "compliance_control_sets"    add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", on_delete: :cascade +  add_foreign_key "import_resources", "referentials"    add_foreign_key "journey_frequencies", "timebands", on_delete: :nullify    add_foreign_key "journey_frequencies", "vehicle_journeys", on_delete: :nullify    add_foreign_key "journey_patterns", "routes", name: "jp_route_fkey", on_delete: :cascade | 
