aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorXinhui2016-10-10 16:27:49 +0200
committerXinhui2016-10-10 16:28:14 +0200
commitb2001ba74720f7351fa14e84aba96434e18242d1 (patch)
tree1b1ff41579310067b971005c9dbbb54e4a29ade5 /db
parent4c728e7bfe71f03b30332e99ac4cce0e8e489e63 (diff)
downloadchouette-core-b2001ba74720f7351fa14e84aba96434e18242d1.tar.bz2
Rename model OfferWorkbench to Workbench
Refs #1783
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20161010135256_rename_offer_workbench_to_workbench.rb11
-rw-r--r--db/schema.rb26
-rw-r--r--db/seeds.rb6
3 files changed, 27 insertions, 16 deletions
diff --git a/db/migrate/20161010135256_rename_offer_workbench_to_workbench.rb b/db/migrate/20161010135256_rename_offer_workbench_to_workbench.rb
new file mode 100644
index 000000000..5b5c9b3e0
--- /dev/null
+++ b/db/migrate/20161010135256_rename_offer_workbench_to_workbench.rb
@@ -0,0 +1,11 @@
+class RenameOfferWorkbenchToWorkbench < ActiveRecord::Migration
+ def self.up
+ rename_table :offer_workbenches, :workbenches
+ rename_column :referentials, :offer_workbench_id, :workbench_id
+ end
+
+ def self.down
+ rename_table :workbenches, :offer_workbenches
+ rename_column :referentials, :workbench_id, :offer_workbench_id
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e519a381d..e8a0c8c7a 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: 20160929133436) do
+ActiveRecord::Schema.define(version: 20161010135256) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -352,15 +352,6 @@ ActiveRecord::Schema.define(version: 20160929133436) do
add_index "networks", ["objectid"], :name => "networks_objectid_key", :unique => true
add_index "networks", ["registration_number"], :name => "networks_registration_number_key"
- create_table "offer_workbenches", force: true do |t|
- t.string "name"
- t.integer "organisation_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- add_index "offer_workbenches", ["organisation_id"], :name => "index_offer_workbenches_on_organisation_id"
-
create_table "organisations", force: true do |t|
t.string "name"
t.datetime "created_at"
@@ -401,7 +392,7 @@ ActiveRecord::Schema.define(version: 20160929133436) do
t.string "data_format"
t.integer "line_referential_id"
t.integer "stop_area_referential_id"
- t.integer "offer_workbench_id"
+ t.integer "workbench_id"
t.datetime "archived_at"
end
@@ -412,10 +403,10 @@ ActiveRecord::Schema.define(version: 20160929133436) do
t.integer "object_version"
t.datetime "creation_time"
t.string "creator_id"
- t.spatial "input_geometry", limit: {:srid=>4326, :type=>"line_string"}
- t.spatial "processed_geometry", limit: {:srid=>4326, :type=>"line_string"}
t.float "distance"
t.boolean "no_processing"
+ t.spatial "input_geometry", limit: {:srid=>4326, :type=>"line_string"}
+ t.spatial "processed_geometry", limit: {:srid=>4326, :type=>"line_string"}
end
create_table "routes", force: true do |t|
@@ -686,6 +677,15 @@ ActiveRecord::Schema.define(version: 20160929133436) do
add_index "vehicle_journeys", ["objectid"], :name => "vehicle_journeys_objectid_key", :unique => true
add_index "vehicle_journeys", ["route_id"], :name => "index_vehicle_journeys_on_route_id"
+ create_table "workbenches", force: true do |t|
+ t.string "name"
+ t.integer "organisation_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "workbenches", ["organisation_id"], :name => "index_workbenches_on_organisation_id"
+
Foreigner.load
add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey", dependent: :delete
diff --git a/db/seeds.rb b/db/seeds.rb
index 195729c3a..dae717966 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -17,7 +17,7 @@ stif.users.find_or_create_by!(username: "admin") do |user|
user.name = "STIF Administrateur"
end
-OfferWorkbench.find_or_create_by(name: "Gestion de l'offre", organisation: stif)
+Workbench.find_or_create_by(name: "Gestion de l'offre", organisation: stif)
operator = Organisation.find_or_create_by!(code: 'transporteur-a') do |organisation|
organisation.name = "Transporteur A"
@@ -53,14 +53,14 @@ StopAreaReferentialSync.find_or_create_by(stop_area_referential: stop_area_refer
end
-offer_workbench = OfferWorkbench.find_or_create_by(name: "Gestion de l'offre", organisation: operator)
+workbench = Workbench.find_or_create_by(name: "Gestion de l'offre", organisation: operator)
[["parissudest201604", "Paris Sud-Est Avril 2016"],
["parissudest201605", "Paris Sud-Est Mai 2016"]].each do |slug, name|
operator.referentials.find_or_create_by!(slug: slug) do |referential|
referential.name = name
referential.prefix = slug
- referential.offer_workbench = offer_workbench
+ referential.workbench = workbench
referential.line_referential = line_referential
referential.stop_area_referential = stop_area_referential
end