aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2017-09-04 11:09:23 +0200
committerLuc Donnet2017-09-04 11:09:23 +0200
commitdd3ec3c6090b05a0a910b278f51ff7b5d8a92f02 (patch)
tree270e2e70a36989e9c7da8b3b56bd2391ca070afa
parented64dc517bca5f775631d999aa2e60f78d4dae30 (diff)
downloadchouette-core-dd3ec3c6090b05a0a910b278f51ff7b5d8a92f02.tar.bz2
Update workbench_import, netex_import and import_resources views Refs #4256 #4257 #4258
-rw-r--r--app/controllers/import_resources_controller.rb40
-rw-r--r--app/decorators/import_resource_decorator.rb10
-rw-r--r--app/decorators/import_resources_decorator.rb12
-rw-r--r--app/helpers/import_resources_helper.rb15
-rw-r--r--app/helpers/imports_helper.rb18
-rw-r--r--app/helpers/newapplication_helper.rb14
-rw-r--r--app/models/import.rb5
-rw-r--r--app/models/import_message.rb2
-rw-r--r--app/models/import_resource.rb4
-rw-r--r--app/views/import_resources/index.html.slim54
-rw-r--r--app/views/imports/show.html.slim20
-rw-r--r--config/locales/import_resources.en.yml17
-rw-r--r--config/locales/import_resources.fr.yml17
-rw-r--r--config/routes.rb2
-rw-r--r--db/migrate/20170901132253_rename_type_in_import_resource.rb5
-rw-r--r--db/schema.rb494
-rw-r--r--spec/factories/import_resources.rb2
-rw-r--r--spec/models/import_resource_spec.rb4
-rw-r--r--spec/models/import_spec.rb7
19 files changed, 461 insertions, 281 deletions
diff --git a/app/controllers/import_resources_controller.rb b/app/controllers/import_resources_controller.rb
new file mode 100644
index 000000000..ac3dd042e
--- /dev/null
+++ b/app/controllers/import_resources_controller.rb
@@ -0,0 +1,40 @@
+class ImportResourcesController < BreadcrumbController
+ defaults resource_class: ImportResource, collection_name: 'import_resources', instance_name: 'import_resource'
+ respond_to :html
+ belongs_to :import
+
+ def index
+ index! do |format|
+ format.html {
+ @import_resources = decorate_import_resources(@import_resources)
+ }
+
+ build_breadcrumb :index
+ end
+ end
+
+ def download
+ if params[:token] == resource.token_download
+ send_file resource.file.path
+ else
+ user_not_authorized
+ end
+ end
+
+ protected
+ def collection
+ @import_resources ||= parent.resources
+ end
+
+ private
+
+ def decorate_import_resources(import_resources)
+ ImportResourcesDecorator.decorate(
+ import_resources,
+ with: ImportResourceDecorator,
+ context: {
+ import: @import
+ }
+ )
+ end
+end
diff --git a/app/decorators/import_resource_decorator.rb b/app/decorators/import_resource_decorator.rb
new file mode 100644
index 000000000..9bfd1f757
--- /dev/null
+++ b/app/decorators/import_resource_decorator.rb
@@ -0,0 +1,10 @@
+class ImportResourceDecorator < Draper::Decorator
+ decorates ImportResource
+
+ delegate_all
+
+ def action_links
+ links = []
+ end
+
+end
diff --git a/app/decorators/import_resources_decorator.rb b/app/decorators/import_resources_decorator.rb
new file mode 100644
index 000000000..2b1a25ef9
--- /dev/null
+++ b/app/decorators/import_resources_decorator.rb
@@ -0,0 +1,12 @@
+class ImportResourcesDecorator < ModelDecorator
+ delegate :where
+
+ def lines_imported
+ where(status: :OK, resource_type: :line).count
+ end
+
+ def lines_in_zipfile
+ where(resource_type: :line).count
+ end
+
+end
diff --git a/app/helpers/import_resources_helper.rb b/app/helpers/import_resources_helper.rb
new file mode 100644
index 000000000..3ee96eb9b
--- /dev/null
+++ b/app/helpers/import_resources_helper.rb
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+module ImportResourcesHelper
+
+ # Import statuses helper
+ def import_resource_status(status)
+ cls =''
+ cls = 'success' if status == 'OK'
+ cls = 'warning' if status == 'WARNING'
+ cls = 'danger' if status == 'ERROR'
+ cls = 'alert' if status == 'IGNORED'
+
+ content_tag :span, '', class: "fa fa-circle text-#{cls}"
+ end
+
+end
diff --git a/app/helpers/imports_helper.rb b/app/helpers/imports_helper.rb
index 5f9db3fb1..1c4549e50 100644
--- a/app/helpers/imports_helper.rb
+++ b/app/helpers/imports_helper.rb
@@ -1,6 +1,24 @@
# -*- coding: utf-8 -*-
module ImportsHelper
+ # Import statuses helper
+ def import_status(status)
+ if %w[new running pending].include? status
+ content_tag :span, '', class: "fa fa-clock-o"
+ else
+ cls =''
+ cls = 'success' if status == 'successful'
+ cls = 'warning' if status == 'warning'
+ cls = 'danger' if %w[failed aborted canceled].include? status
+
+ content_tag :span, '', class: "fa fa-circle text-#{cls}"
+ end
+ end
+
+ ##############################
+ #      TO CLEAN!!!
+ ##############################
+
def fields_for_import_task_format(form)
begin
render :partial => import_partial_name(form), :locals => { :form => form }
diff --git a/app/helpers/newapplication_helper.rb b/app/helpers/newapplication_helper.rb
index e6a6f7e11..df19113db 100644
--- a/app/helpers/newapplication_helper.rb
+++ b/app/helpers/newapplication_helper.rb
@@ -287,18 +287,4 @@ module NewapplicationHelper
end
end
- # Import statuses helper
- def import_status(status)
- if %w[new running pending].include? status
- content_tag :span, '', class: "fa fa-clock-o"
- else
- cls =''
- cls = 'success' if status == 'successful'
- cls = 'warning' if status == 'warning'
- cls = 'danger' if %w[failed aborted canceled].include? status
-
- content_tag :span, '', class: "fa fa-circle text-#{cls}"
- end
- end
-
end
diff --git a/app/models/import.rb b/app/models/import.rb
index 939434e67..ff2f57efc 100644
--- a/app/models/import.rb
+++ b/app/models/import.rb
@@ -5,8 +5,9 @@ class Import < ActiveRecord::Base
belongs_to :parent, polymorphic: true
- has_many :messages, class_name: "ImportMessage"
- has_many :children, foreign_key: :parent_id, class_name: "Import"
+ has_many :messages, class_name: "ImportMessage", dependent: :destroy
+ has_many :resources, class_name: "ImportResource", dependent: :destroy
+ has_many :children, foreign_key: :parent_id, class_name: "Import", dependent: :destroy
extend Enumerize
enumerize :status, in: %i(new pending successful warning failed running aborted canceled), scope: true
diff --git a/app/models/import_message.rb b/app/models/import_message.rb
index 5d0f5c862..913f6fd41 100644
--- a/app/models/import_message.rb
+++ b/app/models/import_message.rb
@@ -1,6 +1,6 @@
class ImportMessage < ActiveRecord::Base
belongs_to :import
- belongs_to :resource, class_name: ImportResource
+ belongs_to :resource, class_name: ImportResource, dependent: :destroy
enum criticity: [:info, :warning, :error]
validates :criticity, presence: true
diff --git a/app/models/import_resource.rb b/app/models/import_resource.rb
index 3ddd325fd..61c270aa2 100644
--- a/app/models/import_resource.rb
+++ b/app/models/import_resource.rb
@@ -3,9 +3,9 @@ class ImportResource < ActiveRecord::Base
belongs_to :import
extend Enumerize
- enumerize :status, in: %i(new pending successful failed)
+ enumerize :status, in: %i(OK ERROR WARNING IGNORED), scope: true
- validates_presence_of :name, :type, :reference
+ validates_presence_of :name, :resource_type, :reference
aasm column: :status do
state :new, :initial => true
diff --git a/app/views/import_resources/index.html.slim b/app/views/import_resources/index.html.slim
new file mode 100644
index 000000000..cf91f80f1
--- /dev/null
+++ b/app/views/import_resources/index.html.slim
@@ -0,0 +1,54 @@
+/ PageHeader
+= pageheader 'importer',
+ t('.title'),
+ '',
+ '',
+ ''
+
+/ PageContent
+.page_content
+ .container-fluid
+ - if @import_resources.any?
+ .row
+ .col-lg-12
+ = definition_list t('metadatas'),{ 'Bilan d\'import' => link_to(@import.parent.name, workbench_import_path(@import.parent.workbench, @import.parent) ),
+ 'Jeu de données associé' => ( @import.referential.present? ? link_to(@import.referential.name, referential_path(@import.referential)) : '-' ) }
+
+ - if @import_resources.any?
+ .row
+ .col-lg-12
+ h1
+ span = import_status(@import.status)
+ span = t('.table_state', lines_imported: @import_resources.lines_imported , lines_in_zipfile: @import_resources.lines_in_zipfile )
+ .col-lg-12
+ h2 = t('.table_title')
+ .col-lg-12
+ = t('.table_explanation')
+ .col-lg-12
+ = table_builder_2 @import_resources.where(resource_type: :file),
+ [ \
+ TableBuilderHelper::Column.new( \
+ key: :name, \
+ attribute: 'name', \
+ sortable: false, \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :status, \
+ attribute: Proc.new { |n| import_resource_status(n.status) }, \
+ sortable: false, \
+ ), \
+ TableBuilderHelper::Column.new( \
+ name: 'Résultat des tests' , \
+ key: :resource_type, \
+ attribute: 'resource_type', \
+ sortable: false, \
+ ), \
+ TableBuilderHelper::Column.new( \
+ name: 'Téléchargement' , \
+ key: :status, \
+ attribute: 'status', \
+ sortable: false, \
+ ), \
+ ],
+ links: [],
+ cls: 'table has-search'
diff --git a/app/views/imports/show.html.slim b/app/views/imports/show.html.slim
index 5518e1a47..d5dcd9caf 100644
--- a/app/views/imports/show.html.slim
+++ b/app/views/imports/show.html.slim
@@ -26,20 +26,30 @@
= table_builder_2 @import.children,
[ \
TableBuilderHelper::Column.new( \
- name: 'Nom du jeu de données', \
- attribute: 'name' \
+ name: 'Nom du jeu de données', \
+ attribute: 'name', \
+ sortable: false, \
+ link_to: lambda do |import| \
+ referential_path(import.referential) \
+ end \
), \
TableBuilderHelper::Column.new( \
key: :status, \
- attribute: 'status' \
+ attribute: Proc.new { |n| import_status(n.status) }, \
+ sortable: false, \
+ link_to: lambda do |import| \
+ workbench_import_import_resources_path(import.workbench_id, import) \
+ end \
), \
TableBuilderHelper::Column.new( \
name: 'Contrôle STIF', \
- attribute: '' \
+ attribute: '', \
+ sortable: false, \
), \
TableBuilderHelper::Column.new( \
name: 'Contrôle organisation', \
- attribute: '' \
+ attribute: '', \
+ sortable: false, \
) \
],
links: [],
diff --git a/config/locales/import_resources.en.yml b/config/locales/import_resources.en.yml
new file mode 100644
index 000000000..43761fe00
--- /dev/null
+++ b/config/locales/import_resources.en.yml
@@ -0,0 +1,17 @@
+en:
+ import_resources:
+ index:
+ title: "NeTEx conformity"
+ table_state: "%{lines_imported} lines imported on %{lines_in_zipfile} presents in zipfile"
+ table_title: "Satus of anlyzed files"
+ table_explanation: "When calendriers.xml and/or commun.xml are not imported, then all lines file are not processed."
+ activerecord:
+ models:
+ import_resource:
+ zero: "netex conformity"
+ one: "netex conformity"
+ other: "netex conformities"
+ attributes:
+ import:
+ name: "Filename"
+ status: "Status"
diff --git a/config/locales/import_resources.fr.yml b/config/locales/import_resources.fr.yml
new file mode 100644
index 000000000..8da7c5938
--- /dev/null
+++ b/config/locales/import_resources.fr.yml
@@ -0,0 +1,17 @@
+fr:
+ import_resources:
+ index:
+ title: "Rapport de conformité NeTEx"
+ table_state: "%{lines_imported} lignes importées sur %{lines_in_zipfile} présentes dans l'archive"
+ table_title: "Etat des fichiers analysés"
+ table_explanation: "Dans le cas ou le(s) fichiers calendriers.xml et/ou commun.xml sont dans un état non importé, alors tous les fichiers lignes sont automatiquement dans un état non traité."
+ activerecord:
+ models:
+ import_resource:
+ zero: "rapport de conformité Netex"
+ one: "rapport de conformité Netex"
+ other: "rapports de conformité Netex"
+ attributes:
+ import_resource:
+ name: "Fichier"
+ status: "Etat"
diff --git a/config/routes.rb b/config/routes.rb
index bf1c1cb74..4b87d9db9 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -5,6 +5,8 @@ ChouetteIhm::Application.routes.draw do
delete :referentials, on: :member, action: :delete_referentials
resources :imports do
get :download, on: :member
+ resources :import_messages, only: [:index]
+ resources :import_resources, only: [:index]
end
end
diff --git a/db/migrate/20170901132253_rename_type_in_import_resource.rb b/db/migrate/20170901132253_rename_type_in_import_resource.rb
new file mode 100644
index 000000000..655d2a107
--- /dev/null
+++ b/db/migrate/20170901132253_rename_type_in_import_resource.rb
@@ -0,0 +1,5 @@
+class RenameTypeInImportResource < ActiveRecord::Migration
+ def change
+ rename_column :import_resources, :type, :resource_type
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index b03200b6a..d1bd3bc2b 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: 20170817122914) do
+ActiveRecord::Schema.define(version: 20170901132253) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -21,12 +21,12 @@ ActiveRecord::Schema.define(version: 20170817122914) 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", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.string "comment", limit: 255
- t.decimal "link_distance", precision: 19, scale: 2
+ t.string "creator_id"
+ t.string "name"
+ t.string "comment"
+ t.decimal "link_distance", precision: 19, scale: 2
t.boolean "lift_availability"
t.boolean "mobility_restricted_suitability"
t.boolean "stairs_availability"
@@ -34,9 +34,9 @@ ActiveRecord::Schema.define(version: 20170817122914) do
t.time "frequent_traveller_duration"
t.time "occasional_traveller_duration"
t.time "mobility_restricted_traveller_duration"
- t.string "link_type", limit: 255
+ t.string "link_type"
t.integer "int_user_needs"
- t.string "link_orientation", limit: 255
+ t.string "link_orientation"
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -44,26 +44,26 @@ ActiveRecord::Schema.define(version: 20170817122914) do
add_index "access_links", ["objectid"], name: "access_links_objectid_key", unique: true, using: :btree
create_table "access_points", id: :bigserial, force: :cascade do |t|
- t.string "objectid", limit: 255
+ t.string "objectid"
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.string "comment", limit: 255
- t.decimal "longitude", precision: 19, scale: 16
- t.decimal "latitude", precision: 19, scale: 16
- t.string "long_lat_type", limit: 255
- t.string "country_code", limit: 255
- t.string "street_name", limit: 255
- t.string "contained_in", limit: 255
+ t.string "creator_id"
+ t.string "name"
+ t.string "comment"
+ t.decimal "longitude", precision: 19, scale: 16
+ t.decimal "latitude", precision: 19, scale: 16
+ t.string "long_lat_type"
+ t.string "country_code"
+ t.string "street_name"
+ t.string "contained_in"
t.time "openning_time"
t.time "closing_time"
- t.string "access_type", limit: 255
+ t.string "access_type"
t.boolean "lift_availability"
t.boolean "mobility_restricted_suitability"
t.boolean "stairs_availability"
t.integer "stop_area_id", limit: 8
- t.string "zip_code", limit: 255
- t.string "city_name", limit: 255
+ t.string "zip_code"
+ t.string "city_name"
t.text "import_xml"
t.datetime "created_at"
t.datetime "updated_at"
@@ -73,8 +73,8 @@ ActiveRecord::Schema.define(version: 20170817122914) do
create_table "api_keys", id: :bigserial, force: :cascade do |t|
t.integer "referential_id", limit: 8
- t.string "token", limit: 255
- t.string "name", limit: 255
+ t.string "token"
+ t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "organisation_id"
@@ -83,11 +83,11 @@ ActiveRecord::Schema.define(version: 20170817122914) do
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", limit: 255
- t.string "short_name", limit: 255
- t.daterange "date_ranges", array: true
- t.date "dates", array: true
- t.boolean "shared", default: false
+ 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"
@@ -97,7 +97,7 @@ ActiveRecord::Schema.define(version: 20170817122914) do
add_index "calendars", ["short_name"], name: "index_calendars_on_short_name", unique: true, using: :btree
create_table "clean_up_results", id: :bigserial, force: :cascade do |t|
- t.string "message_key", limit: 255
+ t.string "message_key"
t.hstore "message_attributs"
t.integer "clean_up_id", limit: 8
t.datetime "created_at"
@@ -107,7 +107,7 @@ ActiveRecord::Schema.define(version: 20170817122914) do
add_index "clean_up_results", ["clean_up_id"], name: "index_clean_up_results_on_clean_up_id", using: :btree
create_table "clean_ups", id: :bigserial, force: :cascade do |t|
- t.string "status", limit: 255
+ t.string "status"
t.datetime "started_at"
t.datetime "ended_at"
t.integer "referential_id", limit: 8
@@ -121,20 +121,20 @@ ActiveRecord::Schema.define(version: 20170817122914) 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", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.string "short_name", limit: 255
- t.string "organizational_unit", limit: 255
- t.string "operating_department_name", limit: 255
- t.string "code", limit: 255
- t.string "phone", limit: 255
- t.string "fax", limit: 255
- t.string "email", limit: 255
- t.string "registration_number", limit: 255
- t.string "url", limit: 255
- t.string "time_zone", limit: 255
+ t.string "creator_id"
+ t.string "name"
+ t.string "short_name"
+ t.string "organizational_unit"
+ t.string "operating_department_name"
+ t.string "code"
+ t.string "phone"
+ t.string "fax"
+ t.string "email"
+ t.string "registration_number"
+ t.string "url"
+ t.string "time_zone"
t.integer "line_referential_id", limit: 8
t.text "import_xml"
t.datetime "created_at"
@@ -148,13 +148,13 @@ ActiveRecord::Schema.define(version: 20170817122914) 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", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.string "comment", limit: 255
- t.decimal "link_distance", precision: 19, scale: 2
- t.string "link_type", limit: 255
+ t.string "creator_id"
+ t.string "name"
+ t.string "comment"
+ t.decimal "link_distance", precision: 19, scale: 2
+ t.string "link_type"
t.time "default_duration"
t.time "frequent_traveller_duration"
t.time "occasional_traveller_duration"
@@ -169,31 +169,15 @@ ActiveRecord::Schema.define(version: 20170817122914) do
add_index "connection_links", ["objectid"], name: "connection_links_objectid_key", unique: true, using: :btree
- create_table "delayed_jobs", id: :bigserial, force: :cascade do |t|
- t.integer "priority", default: 0
- t.integer "attempts", default: 0
- t.text "handler"
- t.text "last_error"
- t.datetime "run_at"
- t.datetime "locked_at"
- t.datetime "failed_at"
- t.string "locked_by", limit: 255
- t.string "queue", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
-
create_table "exports", id: :bigserial, force: :cascade do |t|
t.integer "referential_id", limit: 8
- t.string "status", limit: 255
- t.string "type", limit: 255
- t.string "options", limit: 255
+ t.string "status"
+ t.string "type"
+ t.string "options"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "references_type", limit: 255
- t.string "reference_ids", limit: 255
+ t.string "references_type"
+ t.string "reference_ids"
end
add_index "exports", ["referential_id"], name: "index_exports_on_referential_id", using: :btree
@@ -203,23 +187,23 @@ ActiveRecord::Schema.define(version: 20170817122914) do
t.integer "line_id", limit: 8
t.integer "connection_link_id", limit: 8
t.integer "stop_point_id", limit: 8
- t.string "objectid", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
t.datetime "creation_time"
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.string "comment", limit: 255
- t.string "description", limit: 255
+ t.string "creator_id"
+ t.string "name"
+ t.string "comment"
+ t.string "description"
t.boolean "free_access"
- t.decimal "longitude", precision: 19, scale: 16
- t.decimal "latitude", precision: 19, scale: 16
- t.string "long_lat_type", limit: 255
- t.decimal "x", precision: 19, scale: 2
- t.decimal "y", precision: 19, scale: 2
- t.string "projection_type", limit: 255
- t.string "country_code", limit: 255
- t.string "street_name", limit: 255
- t.string "contained_in", limit: 255
+ t.decimal "longitude", precision: 19, scale: 16
+ t.decimal "latitude", precision: 19, scale: 16
+ t.string "long_lat_type"
+ t.decimal "x", precision: 19, scale: 2
+ t.decimal "y", precision: 19, scale: 2
+ t.string "projection_type"
+ t.string "country_code"
+ t.string "street_name"
+ t.string "contained_in"
end
add_index "facilities", ["objectid"], name: "facilities_objectid_key", unique: true, using: :btree
@@ -231,8 +215,8 @@ ActiveRecord::Schema.define(version: 20170817122914) do
create_table "footnotes", id: :bigserial, force: :cascade do |t|
t.integer "line_id", limit: 8
- t.string "code", limit: 255
- t.string "label", limit: 255
+ t.string "code"
+ t.string "label"
t.datetime "created_at"
t.datetime "updated_at"
t.string "checksum"
@@ -245,12 +229,12 @@ ActiveRecord::Schema.define(version: 20170817122914) do
end
create_table "group_of_lines", id: :bigserial, force: :cascade do |t|
- t.string "objectid", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.string "comment", limit: 255
- t.string "registration_number", limit: 255
+ t.string "creator_id"
+ t.string "name"
+ t.string "comment"
+ t.string "registration_number"
t.integer "line_referential_id", limit: 8
t.text "import_xml"
t.datetime "created_at"
@@ -267,7 +251,7 @@ ActiveRecord::Schema.define(version: 20170817122914) do
create_table "import_messages", id: :bigserial, force: :cascade do |t|
t.integer "criticity"
- t.string "message_key", limit: 255
+ t.string "message_key"
t.hstore "message_attributes"
t.integer "import_id", limit: 8
t.integer "resource_id", limit: 8
@@ -280,37 +264,37 @@ ActiveRecord::Schema.define(version: 20170817122914) 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.string "status", limit: 255
+ t.integer "import_id", limit: 8
+ t.string "status"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "type", limit: 255
- t.string "reference", limit: 255
- t.string "name", limit: 255
+ t.string "resource_type"
+ t.string "reference"
+ t.string "name"
t.hstore "metrics"
end
add_index "import_resources", ["import_id"], name: "index_import_resources_on_import_id", using: :btree
create_table "imports", id: :bigserial, force: :cascade do |t|
- t.string "status", limit: 255
- t.string "current_step_id", limit: 255
+ t.string "status"
+ 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", limit: 255
+ t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "file", limit: 255
+ t.string "file"
t.datetime "started_at"
t.datetime "ended_at"
- t.string "token_download", limit: 255
- t.string "type", limit: 255
+ t.string "token_download"
+ t.string "type"
t.integer "parent_id", limit: 8
t.string "parent_type"
+ t.integer "current_step", default: 0
+ t.integer "total_steps", default: 0
t.datetime "notified_parent_at"
- t.integer "current_step", default: 0
- t.integer "total_steps", default: 0
t.string "creator"
end
@@ -345,16 +329,16 @@ ActiveRecord::Schema.define(version: 20170817122914) do
create_table "journey_patterns", id: :bigserial, force: :cascade do |t|
t.integer "route_id", limit: 8
- t.string "objectid", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.string "comment", limit: 255
- t.string "registration_number", limit: 255
- t.string "published_name", limit: 255
+ t.string "creator_id"
+ t.string "name"
+ t.string "comment"
+ t.string "registration_number"
+ 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.integer "section_status", default: 0, null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "checksum"
@@ -378,7 +362,7 @@ ActiveRecord::Schema.define(version: 20170817122914) do
create_table "line_referential_sync_messages", id: :bigserial, force: :cascade do |t|
t.integer "criticity"
- t.string "message_key", limit: 255
+ t.string "message_key"
t.hstore "message_attributes"
t.integer "line_referential_sync_id", limit: 8
t.datetime "created_at"
@@ -393,42 +377,42 @@ ActiveRecord::Schema.define(version: 20170817122914) do
t.datetime "updated_at"
t.datetime "started_at"
t.datetime "ended_at"
- t.string "status", limit: 255
+ t.string "status"
end
add_index "line_referential_syncs", ["line_referential_id"], name: "index_line_referential_syncs_on_line_referential_id", using: :btree
create_table "line_referentials", id: :bigserial, force: :cascade do |t|
- t.string "name", limit: 255
+ t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "sync_interval", default: 1
+ t.integer "sync_interval", default: 1
end
create_table "lines", id: :bigserial, force: :cascade do |t|
t.integer "network_id", limit: 8
t.integer "company_id", limit: 8
- t.string "objectid", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.string "number", limit: 255
- t.string "published_name", limit: 255
- t.string "transport_mode", limit: 255
- t.string "registration_number", limit: 255
- t.string "comment", limit: 255
+ t.string "creator_id"
+ t.string "name"
+ t.string "number"
+ t.string "published_name"
+ t.string "transport_mode"
+ t.string "registration_number"
+ t.string "comment"
t.boolean "mobility_restricted_suitability"
t.integer "int_user_needs"
t.boolean "flexible_service"
- t.string "url", limit: 255
+ t.string "url"
t.string "color", limit: 6
t.string "text_color", limit: 6
- t.string "stable_id", limit: 255
+ t.string "stable_id"
t.integer "line_referential_id", limit: 8
- t.boolean "deactivated", default: false
+ t.boolean "deactivated", default: false
t.text "import_xml"
- t.string "transport_submode", limit: 255
- t.integer "secondary_company_ids", limit: 8, array: true
+ t.string "transport_submode"
+ t.integer "secondary_company_ids", limit: 8, array: true
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "seasonal"
@@ -440,17 +424,17 @@ ActiveRecord::Schema.define(version: 20170817122914) do
add_index "lines", ["secondary_company_ids"], name: "index_lines_on_secondary_company_ids", using: :gin
create_table "networks", id: :bigserial, force: :cascade do |t|
- t.string "objectid", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
+ t.string "creator_id"
t.date "version_date"
- t.string "description", limit: 255
- t.string "name", limit: 255
- t.string "registration_number", limit: 255
- t.string "source_name", limit: 255
- t.string "source_type", limit: 255
- t.string "source_identifier", limit: 255
- t.string "comment", limit: 255
+ t.string "description"
+ t.string "name"
+ t.string "registration_number"
+ t.string "source_name"
+ t.string "source_type"
+ t.string "source_identifier"
+ t.string "comment"
t.text "import_xml"
t.integer "line_referential_id", limit: 8
t.datetime "created_at"
@@ -462,11 +446,11 @@ ActiveRecord::Schema.define(version: 20170817122914) do
add_index "networks", ["registration_number"], name: "networks_registration_number_key", using: :btree
create_table "organisations", id: :bigserial, force: :cascade do |t|
- t.string "name", limit: 255
+ t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "data_format", limit: 255, default: "neptune"
- t.string "code", limit: 255
+ t.string "data_format", default: "neptune"
+ t.string "code"
t.datetime "synced_at"
t.hstore "sso_attributes"
end
@@ -477,12 +461,12 @@ ActiveRecord::Schema.define(version: 20170817122914) 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", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.string "comment", limit: 255
- t.decimal "link_distance", precision: 19, scale: 2
+ t.string "creator_id"
+ t.string "name"
+ t.string "comment"
+ t.decimal "link_distance", precision: 19, scale: 2
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -490,7 +474,7 @@ ActiveRecord::Schema.define(version: 20170817122914) do
add_index "pt_links", ["objectid"], name: "pt_links_objectid_key", unique: true, using: :btree
create_table "referential_clonings", id: :bigserial, force: :cascade do |t|
- t.string "status", limit: 255
+ t.string "status"
t.datetime "started_at"
t.datetime "ended_at"
t.integer "source_referential_id", limit: 8
@@ -511,30 +495,30 @@ ActiveRecord::Schema.define(version: 20170817122914) do
t.daterange "periodes", array: true
end
- add_index "referential_metadata", ["line_ids"], name: "index_referential_metadata_on_line_ids", using: :btree
+ add_index "referential_metadata", ["line_ids"], name: "index_referential_metadata_on_line_ids", using: :gin
add_index "referential_metadata", ["referential_id"], name: "index_referential_metadata_on_referential_id", using: :btree
add_index "referential_metadata", ["referential_source_id"], name: "index_referential_metadata_on_referential_source_id", using: :btree
create_table "referentials", id: :bigserial, force: :cascade do |t|
- t.string "name", limit: 255
- t.string "slug", limit: 255
+ t.string "name"
+ t.string "slug"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "prefix", limit: 255
- t.string "projection_type", limit: 255
- t.string "time_zone", limit: 255
- t.string "bounds", limit: 255
+ t.string "prefix"
+ t.string "projection_type"
+ t.string "time_zone"
+ t.string "bounds"
t.integer "organisation_id", limit: 8
t.text "geographical_bounds"
t.integer "user_id", limit: 8
- t.string "user_name", limit: 255
- t.string "data_format", limit: 255
+ t.string "user_name"
+ t.string "data_format"
t.integer "line_referential_id", limit: 8
t.integer "stop_area_referential_id", limit: 8
t.integer "workbench_id", limit: 8
t.datetime "archived_at"
t.integer "created_from_id", limit: 8
- t.boolean "ready", default: false
+ t.boolean "ready", default: false
end
add_index "referentials", ["created_from_id"], name: "index_referentials_on_created_from_id", using: :btree
@@ -542,29 +526,29 @@ ActiveRecord::Schema.define(version: 20170817122914) do
create_table "route_sections", id: :bigserial, force: :cascade do |t|
t.integer "departure_id", limit: 8
t.integer "arrival_id", limit: 8
- t.string "objectid", limit: 255, null: false
+ t.geometry "input_geometry", limit: {:srid=>4326, :type=>"line_string"}
+ t.geometry "processed_geometry", limit: {:srid=>4326, :type=>"line_string"}
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
+ t.string "creator_id"
t.float "distance"
t.boolean "no_processing"
- t.geometry "input_geometry", limit: {:srid=>4326, :type=>"line_string"}
- t.geometry "processed_geometry", limit: {:srid=>4326, :type=>"line_string"}
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "routes", id: :bigserial, force: :cascade do |t|
t.integer "line_id", limit: 8
- t.string "objectid", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.string "comment", limit: 255
+ t.string "creator_id"
+ t.string "name"
+ t.string "comment"
t.integer "opposite_route_id", limit: 8
- t.string "published_name", limit: 255
- t.string "number", limit: 255
- t.string "direction", limit: 255
- t.string "wayback", limit: 255
+ t.string "published_name"
+ t.string "number"
+ t.string "direction"
+ t.string "wayback"
t.datetime "created_at"
t.datetime "updated_at"
t.string "checksum"
@@ -574,14 +558,14 @@ ActiveRecord::Schema.define(version: 20170817122914) do
add_index "routes", ["objectid"], name: "routes_objectid_key", unique: true, using: :btree
create_table "routing_constraint_zones", id: :bigserial, force: :cascade do |t|
- t.string "name", limit: 255
+ t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "objectid", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
+ t.string "creator_id"
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"
end
@@ -593,7 +577,7 @@ ActiveRecord::Schema.define(version: 20170817122914) do
create_table "rule_parameter_sets", id: :bigserial, force: :cascade do |t|
t.text "parameters"
- t.string "name", limit: 255
+ t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "organisation_id", limit: 8
@@ -607,7 +591,7 @@ ActiveRecord::Schema.define(version: 20170817122914) do
create_table "stop_area_referential_sync_messages", id: :bigserial, force: :cascade do |t|
t.integer "criticity"
- t.string "message_key", limit: 255
+ t.string "message_key"
t.hstore "message_attributes"
t.integer "stop_area_referential_sync_id", limit: 8
t.datetime "created_at"
@@ -622,48 +606,48 @@ ActiveRecord::Schema.define(version: 20170817122914) do
t.datetime "updated_at"
t.datetime "ended_at"
t.datetime "started_at"
- t.string "status", limit: 255
+ t.string "status"
end
add_index "stop_area_referential_syncs", ["stop_area_referential_id"], name: "index_stop_area_referential_syncs_on_stop_area_referential_id", using: :btree
create_table "stop_area_referentials", id: :bigserial, force: :cascade do |t|
- t.string "name", limit: 255
+ t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "stop_areas", id: :bigserial, force: :cascade do |t|
t.integer "parent_id", limit: 8
- t.string "objectid", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.string "comment", limit: 255
- t.string "area_type", limit: 255
- t.string "registration_number", limit: 255
- t.string "nearest_topic_name", limit: 255
+ t.string "creator_id"
+ t.string "name"
+ t.string "comment"
+ t.string "area_type"
+ t.string "registration_number"
+ t.string "nearest_topic_name"
t.integer "fare_code"
- t.decimal "longitude", precision: 19, scale: 16
- t.decimal "latitude", precision: 19, scale: 16
- t.string "long_lat_type", limit: 255
- t.string "country_code", limit: 255
- t.string "street_name", limit: 255
+ t.decimal "longitude", precision: 19, scale: 16
+ t.decimal "latitude", precision: 19, scale: 16
+ t.string "long_lat_type"
+ t.string "country_code"
+ t.string "street_name"
t.boolean "mobility_restricted_suitability"
t.boolean "stairs_availability"
t.boolean "lift_availability"
t.integer "int_user_needs"
- t.string "zip_code", limit: 255
- t.string "city_name", limit: 255
- t.string "url", limit: 255
- t.string "time_zone", limit: 255
+ t.string "zip_code"
+ t.string "city_name"
+ t.string "url"
+ t.string "time_zone"
t.integer "stop_area_referential_id", limit: 8
- t.string "status", limit: 255
+ t.string "status"
t.text "import_xml"
t.datetime "deleted_at"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "stif_type", limit: 255
+ t.string "stif_type"
end
add_index "stop_areas", ["name"], name: "index_stop_areas_on_name", using: :btree
@@ -679,12 +663,12 @@ ActiveRecord::Schema.define(version: 20170817122914) 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", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
+ t.string "creator_id"
t.integer "position"
- t.string "for_boarding", limit: 255
- t.string "for_alighting", limit: 255
+ t.string "for_boarding"
+ t.string "for_alighting"
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -694,9 +678,9 @@ ActiveRecord::Schema.define(version: 20170817122914) do
create_table "taggings", id: :bigserial, force: :cascade do |t|
t.integer "tag_id", limit: 8
t.integer "taggable_id", limit: 8
- t.string "taggable_type", limit: 255
+ t.string "taggable_type"
t.integer "tagger_id", limit: 8
- t.string "tagger_type", limit: 255
+ t.string "tagger_type"
t.string "context", limit: 128
t.datetime "created_at"
end
@@ -705,8 +689,8 @@ ActiveRecord::Schema.define(version: 20170817122914) do
add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree
create_table "tags", id: :bigserial, force: :cascade do |t|
- t.string "name", limit: 255
- t.integer "taggings_count", default: 0
+ t.string "name"
+ t.integer "taggings_count", default: 0
end
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
@@ -734,18 +718,18 @@ ActiveRecord::Schema.define(version: 20170817122914) 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", limit: 255, null: false
- t.integer "object_version", limit: 8, default: 1
- t.string "creator_id", limit: 255
- t.string "version", limit: 255
- t.string "comment", limit: 255
- t.integer "int_day_types", default: 0
+ t.string "objectid", null: false
+ t.integer "object_version", limit: 8, default: 1
+ t.string "creator_id"
+ t.string "version"
+ t.string "comment"
+ t.integer "int_day_types", default: 0
t.date "start_date"
t.date "end_date"
t.integer "calendar_id", limit: 8
t.datetime "created_at"
t.datetime "updated_at"
- t.string "color", limit: 255
+ t.string "color"
t.integer "created_from_id"
t.string "checksum"
t.text "checksum_source"
@@ -764,49 +748,49 @@ ActiveRecord::Schema.define(version: 20170817122914) 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", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "name", limit: 255
- t.time "start_time", null: false
- t.time "end_time", null: false
+ t.string "creator_id"
+ t.string "name"
+ t.time "start_time", null: false
+ t.time "end_time", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", id: :bigserial, force: :cascade do |t|
- t.string "email", limit: 255, default: "", null: false
- t.string "encrypted_password", limit: 255, default: ""
- t.string "reset_password_token", limit: 255
+ t.string "email", default: "", null: false
+ t.string "encrypted_password", default: ""
+ t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
- t.integer "sign_in_count", default: 0
+ t.integer "sign_in_count", default: 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
- t.string "current_sign_in_ip", limit: 255
- t.string "last_sign_in_ip", limit: 255
+ t.string "current_sign_in_ip"
+ t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "organisation_id", limit: 8
- t.string "name", limit: 255
- t.string "confirmation_token", limit: 255
+ t.string "name"
+ t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
- t.string "unconfirmed_email", limit: 255
- t.integer "failed_attempts", default: 0
- t.string "unlock_token", limit: 255
+ t.string "unconfirmed_email"
+ t.integer "failed_attempts", default: 0
+ t.string "unlock_token"
t.datetime "locked_at"
- t.string "authentication_token", limit: 255
- t.string "invitation_token", limit: 255
+ t.string "authentication_token"
+ t.string "invitation_token"
t.datetime "invitation_sent_at"
t.datetime "invitation_accepted_at"
t.integer "invitation_limit"
t.integer "invited_by_id", limit: 8
- t.string "invited_by_type", limit: 255
+ t.string "invited_by_type"
t.datetime "invitation_created_at"
- t.string "username", limit: 255
+ t.string "username"
t.datetime "synced_at"
- t.string "permissions", limit: 255, array: true
+ t.string "permissions", array: true
end
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
@@ -817,14 +801,14 @@ ActiveRecord::Schema.define(version: 20170817122914) do
create_table "vehicle_journey_at_stops", id: :bigserial, force: :cascade do |t|
t.integer "vehicle_journey_id", limit: 8
t.integer "stop_point_id", limit: 8
- t.string "connecting_service_id", limit: 255
- t.string "boarding_alighting_possibility", limit: 255
+ t.string "connecting_service_id"
+ t.string "boarding_alighting_possibility"
t.time "arrival_time"
t.time "departure_time"
- t.string "for_boarding", limit: 255
- t.string "for_alighting", limit: 255
- t.integer "departure_day_offset", default: 0
- t.integer "arrival_day_offset", default: 0
+ t.string "for_boarding"
+ t.string "for_alighting"
+ t.integer "departure_day_offset", default: 0
+ t.integer "arrival_day_offset", default: 0
t.string "checksum"
t.text "checksum_source"
end
@@ -836,20 +820,20 @@ ActiveRecord::Schema.define(version: 20170817122914) do
t.integer "route_id", limit: 8
t.integer "journey_pattern_id", limit: 8
t.integer "company_id", limit: 8
- t.string "objectid", limit: 255, null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id", limit: 255
- t.string "comment", limit: 255
- t.string "status_value", limit: 255
- t.string "transport_mode", limit: 255
- t.string "published_journey_name", limit: 255
- t.string "published_journey_identifier", limit: 255
- t.string "facility", limit: 255
- t.string "vehicle_type_identifier", limit: 255
+ t.string "creator_id"
+ t.string "comment"
+ t.string "status_value"
+ t.string "transport_mode"
+ t.string "published_journey_name"
+ t.string "published_journey_identifier"
+ t.string "facility"
+ t.string "vehicle_type_identifier"
t.integer "number", limit: 8
t.boolean "mobility_restricted_suitability"
t.boolean "flexible_service"
- t.integer "journey_category", default: 0, null: false
+ t.integer "journey_category", default: 0, null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "checksum"
@@ -860,7 +844,7 @@ ActiveRecord::Schema.define(version: 20170817122914) do
add_index "vehicle_journeys", ["route_id"], name: "index_vehicle_journeys_on_route_id", using: :btree
create_table "workbenches", id: :bigserial, force: :cascade do |t|
- t.string "name", limit: 255
+ t.string "name"
t.integer "organisation_id", limit: 8
t.datetime "created_at"
t.datetime "updated_at"
@@ -872,19 +856,21 @@ ActiveRecord::Schema.define(version: 20170817122914) do
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_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey", on_delete: :cascade
+ add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey"
add_foreign_key "api_keys", "organisations"
add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", on_delete: :cascade
- add_foreign_key "journey_frequencies", "timebands", name: "journey_frequencies_timeband_id_fk", on_delete: :nullify
- add_foreign_key "journey_frequencies", "vehicle_journeys", name: "journey_frequencies_vehicle_journey_id_fk", on_delete: :nullify
- add_foreign_key "journey_pattern_sections", "journey_patterns", name: "journey_pattern_sections_journey_pattern_id_fk", on_delete: :cascade
- add_foreign_key "journey_pattern_sections", "route_sections", name: "journey_pattern_sections_route_section_id_fk", on_delete: :cascade
+ add_foreign_key "journey_frequencies", "timebands", on_delete: :nullify
+ add_foreign_key "journey_frequencies", "vehicle_journeys", on_delete: :nullify
+ add_foreign_key "journey_pattern_sections", "journey_patterns", on_delete: :cascade
+ add_foreign_key "journey_pattern_sections", "route_sections", on_delete: :cascade
add_foreign_key "journey_patterns", "routes", name: "jp_route_fkey", on_delete: :cascade
add_foreign_key "journey_patterns", "stop_points", column: "arrival_stop_point_id", name: "arrival_point_fkey", on_delete: :nullify
add_foreign_key "journey_patterns", "stop_points", column: "departure_stop_point_id", name: "departure_point_fkey", on_delete: :nullify
add_foreign_key "journey_patterns_stop_points", "journey_patterns", name: "jpsp_jp_fkey", on_delete: :cascade
add_foreign_key "journey_patterns_stop_points", "stop_points", name: "jpsp_stoppoint_fkey", on_delete: :cascade
- add_foreign_key "routes", "routes", column: "opposite_route_id", name: "route_opposite_route_fkey", on_delete: :nullify
+ add_foreign_key "route_sections", "stop_areas", column: "arrival_id"
+ add_foreign_key "route_sections", "stop_areas", column: "departure_id"
+ add_foreign_key "routes", "routes", column: "opposite_route_id", name: "route_opposite_route_fkey"
add_foreign_key "stop_areas", "stop_areas", column: "parent_id", name: "area_parent_fkey", on_delete: :nullify
add_foreign_key "stop_areas_stop_areas", "stop_areas", column: "child_id", name: "stoparea_child_fkey", on_delete: :cascade
add_foreign_key "stop_areas_stop_areas", "stop_areas", column: "parent_id", name: "stoparea_parent_fkey", on_delete: :cascade
diff --git a/spec/factories/import_resources.rb b/spec/factories/import_resources.rb
index 6854dc4af..125f549b8 100644
--- a/spec/factories/import_resources.rb
+++ b/spec/factories/import_resources.rb
@@ -3,7 +3,7 @@ FactoryGirl.define do
association :import
status :new
sequence(:name) { |n| "Import resource #{n}" }
- type 'type'
+ resource_type 'type'
reference 'reference'
end
end
diff --git a/spec/models/import_resource_spec.rb b/spec/models/import_resource_spec.rb
index 99d260b20..6416babdc 100644
--- a/spec/models/import_resource_spec.rb
+++ b/spec/models/import_resource_spec.rb
@@ -3,10 +3,10 @@ require 'rails_helper'
RSpec.describe ImportResource, :type => :model do
it { should belong_to(:import) }
- it { should enumerize(:status).in(:new, :pending, :successful, :failed) }
+ it { should enumerize(:status).in(:OK, :ERROR, :WARNING, :IGNORED) }
it { should validate_presence_of(:name) }
- it { should validate_presence_of(:type) }
+ it { should validate_presence_of(:resource_type) }
it { should validate_presence_of(:reference) }
describe 'states' do
diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb
index 03a2db921..477d269e0 100644
--- a/spec/models/import_spec.rb
+++ b/spec/models/import_spec.rb
@@ -26,6 +26,13 @@ RSpec.describe Import, type: :model do
)
end
+ # describe "#destroy" do
+ # it "must call #destroy on imports children and then import_messages, import_resources linked" do
+ # TODO
+ #
+ # end
+ # end
+
describe "#notify_parent" do
it "must call #child_change on its parent" do
allow(netex_import).to receive(:update)