diff options
Diffstat (limited to 'db/migrate')
4 files changed, 14 insertions, 6 deletions
diff --git a/db/migrate/074_create_holidays.rb b/db/migrate/074_create_holidays.rb index 46b1ab684..f2197e89e 100644 --- a/db/migrate/074_create_holidays.rb +++ b/db/migrate/074_create_holidays.rb @@ -59,7 +59,7 @@ class CreateHolidays < ActiveRecord::Migration '2010-12-28' => "Boxing Day" } - holidays.sort.each { |date, desc| + holidays.sort.each { |date, desc| Holiday.create :day => date, :description => desc } diff --git a/db/migrate/101_add_hash_to_info_request.rb b/db/migrate/101_add_hash_to_info_request.rb index 20608aac1..e21bf0989 100644 --- a/db/migrate/101_add_hash_to_info_request.rb +++ b/db/migrate/101_add_hash_to_info_request.rb @@ -6,7 +6,7 @@ class AddHashToInfoRequest < ActiveRecord::Migration # Create the missing events for requests already sent InfoRequest.find(:all).each do |info_request| - info_request.idhash = Digest::SHA1.hexdigest(info_request.id.to_s + MySociety::Config.get("INCOMING_EMAIL_SECRET", 'dummysecret'))[0,8] + info_request.idhash = Digest::SHA1.hexdigest(info_request.id.to_s + Configuration::incoming_email_secret)[0,8] info_request.save! puts info_request.idhash end diff --git a/db/migrate/20120912170035_add_info_requests_count_to_public_bodies.rb b/db/migrate/20120912170035_add_info_requests_count_to_public_bodies.rb index d77dbaa64..d187dcfa5 100644 --- a/db/migrate/20120912170035_add_info_requests_count_to_public_bodies.rb +++ b/db/migrate/20120912170035_add_info_requests_count_to_public_bodies.rb @@ -2,11 +2,10 @@ class AddInfoRequestsCountToPublicBodies < ActiveRecord::Migration def self.up add_column :public_bodies, :info_requests_count, :integer, :null => false, :default => 0 - PublicBody.reset_column_information + PublicBody.connection.execute("UPDATE public_bodies + SET info_requests_count = (SELECT COUNT(*) FROM info_requests + WHERE public_body_id = public_bodies.id);") - PublicBody.find_each do |public_body| - public_body.update_attribute :info_requests_count, public_body.info_requests.length - end end diff --git a/db/migrate/20120919140404_add_comments_allowed_to_info_request.rb b/db/migrate/20120919140404_add_comments_allowed_to_info_request.rb new file mode 100644 index 000000000..4ae0bce18 --- /dev/null +++ b/db/migrate/20120919140404_add_comments_allowed_to_info_request.rb @@ -0,0 +1,9 @@ +class AddCommentsAllowedToInfoRequest < ActiveRecord::Migration + def self.up + add_column :info_requests, :comments_allowed, :boolean, :null => false, :default => true + end + + def self.down + remove_column :info_requests, :comments_allowed + end +end |