diff options
| author | Marc Florisson | 2015-02-20 22:16:13 +0100 |
|---|---|---|
| committer | Marc Florisson | 2015-02-20 22:16:13 +0100 |
| commit | 9730870608fc78a94a8367d8ab508ee23a9d20b6 (patch) | |
| tree | c4526d668b496da055eab0ce908f87f6d9e8c755 /db | |
| parent | 254dbb9ed3d22d3bd1427d3a771517abffbebe23 (diff) | |
| download | chouette-core-9730870608fc78a94a8367d8ab508ee23a9d20b6.tar.bz2 | |
refactor rule parameter set, move to organisation's level
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrate/20150121144108_add_hub_restrictions_to_organisation.rb | 11 | ||||
| -rw-r--r-- | db/migrate/20150218175300_set_organisation_id_to_rps.rb | 14 | ||||
| -rw-r--r-- | db/schema.rb | 9 |
3 files changed, 26 insertions, 8 deletions
diff --git a/db/migrate/20150121144108_add_hub_restrictions_to_organisation.rb b/db/migrate/20150121144108_add_hub_restrictions_to_organisation.rb index 7417105e9..27955b43f 100644 --- a/db/migrate/20150121144108_add_hub_restrictions_to_organisation.rb +++ b/db/migrate/20150121144108_add_hub_restrictions_to_organisation.rb @@ -1,7 +1,10 @@ class AddHubRestrictionsToOrganisation < ActiveRecord::Migration - def change - change_table :organisations do |t| - t.boolean :hub_restrictions - end + def self.up + add_column :organisations, :hub_restrictions_by_default, :boolean + add_column :referentials, :hub_restrictions, :boolean + end + def self.down + remove_column :organisations, :hub_restrictions_by_default + remove_column :referentials, :hub_restrictions end end diff --git a/db/migrate/20150218175300_set_organisation_id_to_rps.rb b/db/migrate/20150218175300_set_organisation_id_to_rps.rb new file mode 100644 index 000000000..efd43124b --- /dev/null +++ b/db/migrate/20150218175300_set_organisation_id_to_rps.rb @@ -0,0 +1,14 @@ +class SetOrganisationIdToRps < ActiveRecord::Migration + def up + RuleParameterSet.all.each_with_index do |rps, index| + rps.update_attributes :organisation_id => Referential.find( rps.referential_id).organisation_id, + :name => "#{rps.name} #{index}" + end + end + + def down + RuleParameterSet.all.each_with_index do |rps, index| + rps.update_attributes :organisation_id => nil + end + end +end diff --git a/db/schema.rb b/db/schema.rb index b49ca789f..a2a5a8ba5 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 => 20150129170104) do +ActiveRecord::Schema.define(:version => 20150218175300) do create_table "access_links", :force => true do |t| t.integer "access_point_id", :limit => 8 @@ -326,9 +326,9 @@ ActiveRecord::Schema.define(:version => 20150129170104) do create_table "organisations", :force => true do |t| t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "hub_restrictions" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "hub_restrictions_by_default" end create_table "pt_links", :force => true do |t| @@ -359,6 +359,7 @@ ActiveRecord::Schema.define(:version => 20150129170104) do t.text "geographical_bounds" t.integer "user_id", :limit => 8 t.string "user_name" + t.boolean "hub_restrictions" end create_table "routes", :force => true do |t| |
