diff options
| author | Xinhui | 2017-11-17 12:07:58 +0100 |
|---|---|---|
| committer | Xinhui | 2017-11-17 12:09:42 +0100 |
| commit | 1261698d213964a3391fe1880198da00e7ac9831 (patch) | |
| tree | bae0b1a874a47fc36106dc5c33e66e9af182b503 /db | |
| parent | f677c08029ccb3b910ab6a2401fa56ccacb2b4d9 (diff) | |
| parent | 219af774c2d589446133bda55aa0f001d6526181 (diff) | |
| download | chouette-core-1261698d213964a3391fe1880198da00e7ac9831.tar.bz2 | |
Merge branch '4516_cleanup_rule_parameter_set'
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrate/20150218175300_set_organisation_id_to_rps.rb | 13 | ||||
| -rw-r--r-- | db/migrate/20150219175300_insert_default_organisation.rb | 8 | ||||
| -rw-r--r-- | db/migrate/20171114102438_drop_table_rule_parameter_sets.rb | 5 | ||||
| -rw-r--r-- | db/schema.rb | 18 |
4 files changed, 9 insertions, 35 deletions
diff --git a/db/migrate/20150218175300_set_organisation_id_to_rps.rb b/db/migrate/20150218175300_set_organisation_id_to_rps.rb deleted file mode 100644 index 024f5938e..000000000 --- a/db/migrate/20150218175300_set_organisation_id_to_rps.rb +++ /dev/null @@ -1,13 +0,0 @@ -class SetOrganisationIdToRps < ActiveRecord::Migration - def up - RuleParameterSet.where(organisation_id: nil).update_all "name = concat(name, ' ', id)" - - # RuleParameterSet.joins(...).update_all("organisation_id = referentials.organisation_id") - # fails (see https://github.com/rails/arel/pull/294) - execute "UPDATE rule_parameter_sets SET organisation_id = referentials.organisation_id FROM referentials WHERE referentials.id = rule_parameter_sets.referential_id;" - end - - def down - RuleParameterSet.update_all organisation_id: nil - end -end diff --git a/db/migrate/20150219175300_insert_default_organisation.rb b/db/migrate/20150219175300_insert_default_organisation.rb index c8e97b562..2734893f5 100644 --- a/db/migrate/20150219175300_insert_default_organisation.rb +++ b/db/migrate/20150219175300_insert_default_organisation.rb @@ -1,10 +1,8 @@ class InsertDefaultOrganisation < ActiveRecord::Migration class Organisation < ActiveRecord::Base attr_accessor :name - - has_many :rule_parameter_sets, :dependent => :destroy end - + def up organisation = Organisation.find_or_create_by!(:name => "Chouette") Referential.where( :organisation_id => nil).each do |r| @@ -13,10 +11,6 @@ class InsertDefaultOrganisation < ActiveRecord::Migration User.where( :organisation_id => nil).each do |r| r.update_attributes :organisation_id => organisation.id end - Organisation.all.each do |organisation| - RuleParameterSet.default_for_all_modes( organisation).save if organisation.rule_parameter_sets.empty? - end - end def down diff --git a/db/migrate/20171114102438_drop_table_rule_parameter_sets.rb b/db/migrate/20171114102438_drop_table_rule_parameter_sets.rb new file mode 100644 index 000000000..55dfd32df --- /dev/null +++ b/db/migrate/20171114102438_drop_table_rule_parameter_sets.rb @@ -0,0 +1,5 @@ +class DropTableRuleParameterSets < ActiveRecord::Migration + def change + drop_table :rule_parameter_sets + end +end diff --git a/db/schema.rb b/db/schema.rb index a992eb32b..af6a51f7a 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: 20171113101005) do +ActiveRecord::Schema.define(version: 20171114102438) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -408,9 +408,9 @@ ActiveRecord::Schema.define(version: 20171113101005) 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 @@ -491,8 +491,7 @@ ActiveRecord::Schema.define(version: 20171113101005) do t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.integer "sync_interval", default: 1 - t.string "objectid_format" + t.integer "sync_interval", default: 1 end create_table "lines", id: :bigserial, force: :cascade do |t| @@ -636,7 +635,6 @@ ActiveRecord::Schema.define(version: 20171113101005) do t.integer "created_from_id", limit: 8 t.boolean "ready", default: false t.integer "referential_suite_id", limit: 8 - t.string "objectid_format" end add_index "referentials", ["created_from_id"], name: "index_referentials_on_created_from_id", using: :btree @@ -682,14 +680,6 @@ ActiveRecord::Schema.define(version: 20171113101005) do t.integer "line_id", limit: 8 end - create_table "rule_parameter_sets", id: :bigserial, force: :cascade do |t| - t.text "parameters" - t.string "name" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "organisation_id", limit: 8 - end - create_table "stop_area_referential_memberships", id: :bigserial, force: :cascade do |t| t.integer "organisation_id", limit: 8 t.integer "stop_area_referential_id", limit: 8 @@ -722,7 +712,6 @@ ActiveRecord::Schema.define(version: 20171113101005) do t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.string "objectid_format" end create_table "stop_areas", id: :bigserial, force: :cascade do |t| @@ -961,7 +950,6 @@ ActiveRecord::Schema.define(version: 20171113101005) do 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" end add_index "workbenches", ["line_referential_id"], name: "index_workbenches_on_line_referential_id", using: :btree |
