aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorZakaria BOUZIANE2015-03-12 13:41:26 +0100
committerZakaria BOUZIANE2015-03-12 13:41:26 +0100
commita60f31997f03f9669c856573a43f7f14e7687e20 (patch)
treebef7564e4bf9a29a0aeb66b8019aa7568a676cbd /db
parent7f9b55eca9fc703cd557dfb2743901fd05f0c01f (diff)
downloadchouette-core-a60f31997f03f9669c856573a43f7f14e7687e20.tar.bz2
Default data_format to neptune and set it to old organisations
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20150312104557_set_default_value_for_data_format_in_organisation.rb22
-rw-r--r--db/schema.rb8
2 files changed, 26 insertions, 4 deletions
diff --git a/db/migrate/20150312104557_set_default_value_for_data_format_in_organisation.rb b/db/migrate/20150312104557_set_default_value_for_data_format_in_organisation.rb
new file mode 100644
index 000000000..9efd941c4
--- /dev/null
+++ b/db/migrate/20150312104557_set_default_value_for_data_format_in_organisation.rb
@@ -0,0 +1,22 @@
+class SetDefaultValueForDataFormatInOrganisation < ActiveRecord::Migration
+ def change
+ Organisation.all.each do |organisation|
+ if organisation.data_format.neptune?
+ organisation.update_attributes :data_format => "neptune"
+ end
+ end
+ Referential.all.each do |referential|
+ if referential.data_format.neptune?
+ referential.update_attributes :data_format => "neptune"
+ elsif referential.data_format.netex?
+ referential.update_attributes :data_format => "netex"
+ elsif referential.data_format.gtfs?
+ referential.update_attributes :data_format => "gtfs"
+ elsif referential.data_format.hub?
+ referential.update_attributes :data_format => "hub"
+ end
+ end
+
+ change_column :organisations, :data_format, :string, :default => "neptune"
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index f07e8cf93..a8e24ac33 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20150304090743) do
+ActiveRecord::Schema.define(:version => 20150312104557) do
create_table "access_links", :force => true do |t|
t.integer "access_point_id", :limit => 8
@@ -326,9 +326,9 @@ ActiveRecord::Schema.define(:version => 20150304090743) do
create_table "organisations", :force => true do |t|
t.string "name"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "data_format"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "data_format", :default => "neptune"
end
create_table "pt_links", :force => true do |t|