aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/006_version_public_body.rb2
-rw-r--r--db/migrate/101_add_hash_to_info_request.rb4
-rw-r--r--db/seeds.rb7
3 files changed, 10 insertions, 3 deletions
diff --git a/db/migrate/006_version_public_body.rb b/db/migrate/006_version_public_body.rb
index 34586add2..0e4527133 100644
--- a/db/migrate/006_version_public_body.rb
+++ b/db/migrate/006_version_public_body.rb
@@ -1,6 +1,8 @@
class VersionPublicBody < ActiveRecord::Migration
def self.up
PublicBody.create_versioned_table
+
+ add_timestamps(:public_body_versions)
end
def self.down
diff --git a/db/migrate/101_add_hash_to_info_request.rb b/db/migrate/101_add_hash_to_info_request.rb
index e21bf0989..924e50829 100644
--- a/db/migrate/101_add_hash_to_info_request.rb
+++ b/db/migrate/101_add_hash_to_info_request.rb
@@ -5,13 +5,11 @@ class AddHashToInfoRequest < ActiveRecord::Migration
add_column :info_requests, :idhash, :string
# Create the missing events for requests already sent
- InfoRequest.find(:all).each do |info_request|
+ InfoRequest.all.each do |info_request|
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
change_column :info_requests, :idhash, :string, :null => false
- puts InfoRequest.find_by_idhash
end
def self.down
remove_column :info_requests, :idhash
diff --git a/db/seeds.rb b/db/seeds.rb
new file mode 100644
index 000000000..664d8c74c
--- /dev/null
+++ b/db/seeds.rb
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
+# Mayor.create(:name => 'Daley', :city => cities.first)