aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-07-31 15:34:12 +0100
committerLouise Crow <louise.crow@gmail.com>2013-09-16 12:12:29 +0100
commit136cf239bfa0230d33d741aa4b31c0291f20fe10 (patch)
tree7c92e8ba5b3e8e817354d3c5fdd3fc891157e64d
parenta23be37bb6b4c4991766e1ed0f9cd0922c8db3a7 (diff)
Re-annotate models with database fields
-rw-r--r--app/models/censor_rule.rb15
-rw-r--r--app/models/comment.rb17
-rw-r--r--app/models/foi_attachment.rb4
-rw-r--r--app/models/holiday.rb3
-rw-r--r--app/models/incoming_message.rb13
-rw-r--r--app/models/info_request.rb31
-rw-r--r--app/models/info_request_event.rb12
-rw-r--r--app/models/mail_server_log.rb11
-rw-r--r--app/models/mail_server_log_done.rb11
-rw-r--r--app/models/outgoing_message.rb17
-rw-r--r--app/models/post_redirect.rb15
-rw-r--r--app/models/profile_photo.rb7
-rw-r--r--app/models/public_body.rb36
-rw-r--r--app/models/purge_request.rb9
-rw-r--r--app/models/raw_email.rb3
-rw-r--r--app/models/request_classification.rb3
-rw-r--r--app/models/track_thing.rb11
-rw-r--r--app/models/track_things_sent_email.rb5
-rw-r--r--app/models/user.rb35
-rw-r--r--app/models/user_info_request_sent_alert.rb9
-rw-r--r--spec/fixtures/comments.yml15
-rw-r--r--spec/fixtures/holidays.yml9
-rw-r--r--spec/fixtures/incoming_messages.yml20
-rw-r--r--spec/fixtures/info_request_events.yml17
-rw-r--r--spec/fixtures/info_requests.yml24
-rw-r--r--spec/fixtures/outgoing_messages.yml16
-rw-r--r--spec/fixtures/public_bodies.yml23
-rw-r--r--spec/fixtures/raw_emails.yml7
-rw-r--r--spec/fixtures/track_things.yml16
-rw-r--r--spec/fixtures/users.yml26
-rw-r--r--spec/models/censor_rule_spec.rb17
-rw-r--r--spec/models/foi_attachment_spec.rb15
-rw-r--r--spec/models/holiday_spec.rb9
-rw-r--r--spec/models/incoming_message_spec.rb20
-rw-r--r--spec/models/info_request_event_spec.rb17
-rw-r--r--spec/models/info_request_spec.rb24
-rw-r--r--spec/models/mail_server_log_spec.rb13
-rw-r--r--spec/models/outgoing_message_spec.rb16
-rw-r--r--spec/models/post_redirect_spec.rb16
-rw-r--r--spec/models/profile_photo_spec.rb10
-rw-r--r--spec/models/public_body_spec.rb23
-rw-r--r--spec/models/purge_request_spec.rb11
-rw-r--r--spec/models/raw_email_spec.rb7
-rw-r--r--spec/models/track_thing_spec.rb16
-rw-r--r--spec/models/track_things_sent_email_spec.rb13
-rw-r--r--spec/models/user_info_request_sent_alert_spec.rb11
-rw-r--r--spec/models/user_spec.rb26
47 files changed, 561 insertions, 143 deletions
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb
index f0d06e088..3c5c77563 100644
--- a/app/models/censor_rule.rb
+++ b/app/models/censor_rule.rb
@@ -1,18 +1,17 @@
# == Schema Information
-# Schema version: 20120919140404
#
# Table name: censor_rules
#
-# id :integer not null, primary key
+# id :integer not null, primary key
# info_request_id :integer
# user_id :integer
# public_body_id :integer
-# text :text not null
-# replacement :text not null
-# last_edit_editor :string(255) not null
-# last_edit_comment :text not null
-# created_at :datetime not null
-# updated_at :datetime not null
+# text :text not null
+# replacement :text not null
+# last_edit_editor :string(255) not null
+# last_edit_comment :text not null
+# created_at :datetime not null
+# updated_at :datetime not null
# regexp :boolean
#
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 9527030a9..75d37e04f 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -1,17 +1,16 @@
# == Schema Information
-# Schema version: 114
#
# Table name: comments
#
-# id :integer not null, primary key
-# user_id :integer not null
-# comment_type :string(255) default("internal_error"), not null
+# id :integer not null, primary key
+# user_id :integer not null
+# comment_type :string(255) default("internal_error"), not null
# info_request_id :integer
-# body :text not null
-# visible :boolean default(TRUE), not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# locale :text default(""), not null
+# body :text not null
+# visible :boolean default(TRUE), not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# locale :text default(""), not null
#
# models/comments.rb:
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index 0340f2b83..914420a2b 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -1,11 +1,9 @@
# encoding: UTF-8
-
# == Schema Information
-# Schema version: 114
#
# Table name: foi_attachments
#
-# id :integer not null, primary key
+# id :integer not null, primary key
# content_type :text
# filename :text
# charset :text
diff --git a/app/models/holiday.rb b/app/models/holiday.rb
index 98f73e963..3076cc0fd 100644
--- a/app/models/holiday.rb
+++ b/app/models/holiday.rb
@@ -1,9 +1,8 @@
# == Schema Information
-# Schema version: 114
#
# Table name: holidays
#
-# id :integer not null, primary key
+# id :integer not null, primary key
# day :date
# description :text
#
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index ae3c3b407..cdb437a2d 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -1,15 +1,13 @@
# coding: utf-8
-
# == Schema Information
-# Schema version: 114
#
# Table name: incoming_messages
#
-# id :integer not null, primary key
-# info_request_id :integer not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# raw_email_id :integer not null
+# id :integer not null, primary key
+# info_request_id :integer not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# raw_email_id :integer not null
# cached_attachment_text_clipped :text
# cached_main_body_text_folded :text
# cached_main_body_text_unfolded :text
@@ -19,6 +17,7 @@
# last_parsed :datetime
# mail_from :text
# sent_at :datetime
+#
# models/incoming_message.rb:
# An (email) message from really anybody to be logged with a request. e.g. A
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 8f15a4ea4..c9bcc9bab 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1,26 +1,25 @@
# == Schema Information
-# Schema version: 20120919140404
#
# Table name: info_requests
#
-# id :integer not null, primary key
-# title :text not null
+# id :integer not null, primary key
+# title :text not null
# user_id :integer
-# public_body_id :integer not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# described_state :string(255) not null
-# awaiting_description :boolean default(FALSE), not null
-# prominence :string(255) default("normal"), not null
-# url_title :text not null
-# law_used :string(255) default("foi"), not null
-# allow_new_responses_from :string(255) default("anybody"), not null
-# handle_rejected_responses :string(255) default("bounce"), not null
-# idhash :string(255) not null
+# public_body_id :integer not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# described_state :string(255) not null
+# awaiting_description :boolean default(FALSE), not null
+# prominence :string(255) default("normal"), not null
+# url_title :text not null
+# law_used :string(255) default("foi"), not null
+# allow_new_responses_from :string(255) default("anybody"), not null
+# handle_rejected_responses :string(255) default("bounce"), not null
+# idhash :string(255) not null
# external_user_name :string(255)
# external_url :string(255)
-# attention_requested :boolean default(FALSE)
-# comments_allowed :boolean default(TRUE), not null
+# attention_requested :boolean default(FALSE)
+# comments_allowed :boolean default(TRUE), not null
#
require 'digest/sha1'
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 2350aea01..6c8d21f99 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -1,20 +1,18 @@
# == Schema Information
-# Schema version: 114
#
# Table name: info_request_events
#
-# id :integer not null, primary key
-# info_request_id :integer not null
-# event_type :text not null
-# params_yaml :text not null
-# created_at :datetime not null
+# id :integer not null, primary key
+# info_request_id :integer not null
+# event_type :text not null
+# params_yaml :text not null
+# created_at :datetime not null
# described_state :string(255)
# calculated_state :string(255)
# last_described_at :datetime
# incoming_message_id :integer
# outgoing_message_id :integer
# comment_id :integer
-# prominence :string(255) default("normal"), not null
#
# models/info_request_event.rb:
diff --git a/app/models/mail_server_log.rb b/app/models/mail_server_log.rb
index 7f61377ce..0e5b60ff1 100644
--- a/app/models/mail_server_log.rb
+++ b/app/models/mail_server_log.rb
@@ -1,15 +1,14 @@
# == Schema Information
-# Schema version: 20121010214348
#
# Table name: mail_server_logs
#
-# id :integer not null, primary key
+# id :integer not null, primary key
# mail_server_log_done_id :integer
# info_request_id :integer
-# order :integer not null
-# line :text not null
-# created_at :datetime not null
-# updated_at :datetime not null
+# order :integer not null
+# line :text not null
+# created_at :datetime not null
+# updated_at :datetime not null
#
# We load log file lines for requests in here, for display in the admin interface.
diff --git a/app/models/mail_server_log_done.rb b/app/models/mail_server_log_done.rb
index 0e7e9eec3..222b072c5 100644
--- a/app/models/mail_server_log_done.rb
+++ b/app/models/mail_server_log_done.rb
@@ -1,13 +1,12 @@
# == Schema Information
-# Schema version: 20121010214348
#
# Table name: mail_server_log_dones
#
-# id :integer not null, primary key
-# filename :text not null
-# last_stat :datetime not null
-# created_at :datetime not null
-# updated_at :datetime not null
+# id :integer not null, primary key
+# filename :text not null
+# last_stat :datetime not null
+# created_at :datetime not null
+# updated_at :datetime not null
#
# Stores that a particular mail server log file has been loaded in, see mail_server_log.rb
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index aedfb9cad..5bd5898f9 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -1,18 +1,17 @@
# == Schema Information
-# Schema version: 114
#
# Table name: outgoing_messages
#
-# id :integer not null, primary key
-# info_request_id :integer not null
-# body :text not null
-# status :string(255) not null
-# message_type :string(255) not null
-# created_at :datetime not null
-# updated_at :datetime not null
+# id :integer not null, primary key
+# info_request_id :integer not null
+# body :text not null
+# status :string(255) not null
+# message_type :string(255) not null
+# created_at :datetime not null
+# updated_at :datetime not null
# last_sent_at :datetime
# incoming_message_followup_id :integer
-# what_doing :string(255) not null
+# what_doing :string(255) not null
#
# models/outgoing_message.rb:
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index 409069cb6..5da3d2742 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -1,18 +1,17 @@
# == Schema Information
-# Schema version: 114
#
# Table name: post_redirects
#
-# id :integer not null, primary key
-# token :text not null
-# uri :text not null
+# id :integer not null, primary key
+# token :text not null
+# uri :text not null
# post_params_yaml :text
-# created_at :datetime not null
-# updated_at :datetime not null
-# email_token :text not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# email_token :text not null
# reason_params_yaml :text
# user_id :integer
-# circumstance :text default("normal"), not null
+# circumstance :text default("normal"), not null
#
# models/post_redirect.rb:
diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb
index 5d542daf1..322ebe53c 100644
--- a/app/models/profile_photo.rb
+++ b/app/models/profile_photo.rb
@@ -1,12 +1,11 @@
# == Schema Information
-# Schema version: 114
#
# Table name: profile_photos
#
-# id :integer not null, primary key
-# data :binary not null
+# id :integer not null, primary key
+# data :binary not null
# user_id :integer
-# draft :boolean default(FALSE), not null
+# draft :boolean default(FALSE), not null
#
# models/profile_photo.rb:
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index a76aeb189..4ae889906 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -1,27 +1,27 @@
+# -*- coding: utf-8 -*-
# == Schema Information
-# Schema version: 20120919140404
#
# Table name: public_bodies
#
-# id :integer not null, primary key
-# name :text not null
-# short_name :text not null
-# request_email :text not null
-# version :integer not null
-# last_edit_editor :string(255) not null
-# last_edit_comment :text not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# url_name :text not null
-# home_page :text default(""), not null
-# notes :text default(""), not null
-# first_letter :string(255) not null
-# publication_scheme :text default(""), not null
-# api_key :string(255) not null
-# info_requests_count :integer default(0), not null
+# id :integer not null, primary key
+# name :text not null
+# short_name :text not null
+# request_email :text not null
+# version :integer not null
+# last_edit_editor :string(255) not null
+# last_edit_comment :text not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# url_name :text not null
+# home_page :text default(""), not null
+# notes :text default(""), not null
+# first_letter :string(255) not null
+# publication_scheme :text default(""), not null
+# api_key :string(255) not null
+# info_requests_count :integer default(0), not null
+# disclosure_log :text default(""), not null
#
-# -*- coding: utf-8 -*-
require 'csv'
require 'securerandom'
require 'set'
diff --git a/app/models/purge_request.rb b/app/models/purge_request.rb
index e48f3cc6f..4e6267bd2 100644
--- a/app/models/purge_request.rb
+++ b/app/models/purge_request.rb
@@ -1,13 +1,12 @@
# == Schema Information
-# Schema version: 114
#
# Table name: purge_requests
#
-# id :integer not null, primary key
+# id :integer not null, primary key
# url :string(255)
-# created_at :datetime not null
-# model :string(255) not null
-# model_id :integer not null
+# created_at :datetime not null
+# model :string(255) not null
+# model_id :integer not null
#
# models/purge_request.rb:
diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb
index 6bf01bc74..21a53f493 100644
--- a/app/models/raw_email.rb
+++ b/app/models/raw_email.rb
@@ -1,9 +1,8 @@
# == Schema Information
-# Schema version: 114
#
# Table name: raw_emails
#
-# id :integer not null, primary key
+# id :integer not null, primary key
#
# models/raw_email.rb:
diff --git a/app/models/request_classification.rb b/app/models/request_classification.rb
index f5a1b4bee..6873d468b 100644
--- a/app/models/request_classification.rb
+++ b/app/models/request_classification.rb
@@ -1,9 +1,8 @@
# == Schema Information
-# Schema version: 20120919140404
#
# Table name: request_classifications
#
-# id :integer not null, primary key
+# id :integer not null, primary key
# user_id :integer
# info_request_event_id :integer
# created_at :datetime
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index 66b8a5c47..d5e1cdb75 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -1,16 +1,15 @@
# == Schema Information
-# Schema version: 114
#
# Table name: track_things
#
-# id :integer not null, primary key
-# tracking_user_id :integer not null
-# track_query :string(255) not null
+# id :integer not null, primary key
+# tracking_user_id :integer not null
+# track_query :string(255) not null
# info_request_id :integer
# tracked_user_id :integer
# public_body_id :integer
-# track_medium :string(255) not null
-# track_type :string(255) default("internal_error"), not null
+# track_medium :string(255) not null
+# track_type :string(255) default("internal_error"), not null
# created_at :datetime
# updated_at :datetime
#
diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb
index a9ea2520e..072d3bdea 100644
--- a/app/models/track_things_sent_email.rb
+++ b/app/models/track_things_sent_email.rb
@@ -1,10 +1,9 @@
# == Schema Information
-# Schema version: 114
#
# Table name: track_things_sent_emails
#
-# id :integer not null, primary key
-# track_thing_id :integer not null
+# id :integer not null, primary key
+# track_thing_id :integer not null
# info_request_event_id :integer
# user_id :integer
# public_body_id :integer
diff --git a/app/models/user.rb b/app/models/user.rb
index 9da4ad743..23d5f7f24 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,26 +1,27 @@
# == Schema Information
-# Schema version: 20120919140404
#
# Table name: users
#
-# id :integer not null, primary key
-# email :string(255) not null
-# name :string(255) not null
-# hashed_password :string(255) not null
-# salt :string(255) not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# email_confirmed :boolean default(FALSE), not null
-# url_name :text not null
-# last_daily_track_email :datetime default(Sat Jan 01 00:00:00 UTC 2000)
-# admin_level :string(255) default("none"), not null
-# ban_text :text default(""), not null
-# about_me :text default(""), not null
+# id :integer not null, primary key
+# email :string(255) not null
+# name :string(255) not null
+# hashed_password :string(255) not null
+# salt :string(255) not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# email_confirmed :boolean default(FALSE), not null
+# url_name :text not null
+# last_daily_track_email :datetime default(2000-01-01 00:00:00 UTC)
+# admin_level :string(255) default("none"), not null
+# ban_text :text default(""), not null
+# about_me :text default(""), not null
# locale :string(255)
# email_bounced_at :datetime
-# email_bounce_message :text default(""), not null
-# no_limit :boolean default(FALSE), not null
-# receive_email_alerts :boolean default(TRUE), not null
+# email_bounce_message :text default(""), not null
+# no_limit :boolean default(FALSE), not null
+# receive_email_alerts :boolean default(TRUE), not null
+# address :string(255)
+# dob :date
#
require 'digest/sha1'
diff --git a/app/models/user_info_request_sent_alert.rb b/app/models/user_info_request_sent_alert.rb
index 449a4c237..098b773f8 100644
--- a/app/models/user_info_request_sent_alert.rb
+++ b/app/models/user_info_request_sent_alert.rb
@@ -1,12 +1,11 @@
# == Schema Information
-# Schema version: 114
#
# Table name: user_info_request_sent_alerts
#
-# id :integer not null, primary key
-# user_id :integer not null
-# info_request_id :integer not null
-# alert_type :string(255) not null
+# id :integer not null, primary key
+# user_id :integer not null
+# info_request_id :integer not null
+# alert_type :string(255) not null
# info_request_event_id :integer
#
diff --git a/spec/fixtures/comments.yml b/spec/fixtures/comments.yml
index b73385a55..44db44d54 100644
--- a/spec/fixtures/comments.yml
+++ b/spec/fixtures/comments.yml
@@ -1,3 +1,18 @@
+# == Schema Information
+#
+# Table name: comments
+#
+# id :integer not null, primary key
+# user_id :integer not null
+# comment_type :string(255) default("internal_error"), not null
+# info_request_id :integer
+# body :text not null
+# visible :boolean default(TRUE), not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# locale :text default(""), not null
+#
+
silly_comment:
visible: t
updated_at: 2008-08-13 01:25:17.486939
diff --git a/spec/fixtures/holidays.yml b/spec/fixtures/holidays.yml
index 5a3d018bc..e6b8889c3 100644
--- a/spec/fixtures/holidays.yml
+++ b/spec/fixtures/holidays.yml
@@ -1,3 +1,12 @@
+# == Schema Information
+#
+# Table name: holidays
+#
+# id :integer not null, primary key
+# day :date
+# description :text
+#
+
date20071130:
id: '1'
day: '2007-11-30'
diff --git a/spec/fixtures/incoming_messages.yml b/spec/fixtures/incoming_messages.yml
index fca5c716c..d56c509c9 100644
--- a/spec/fixtures/incoming_messages.yml
+++ b/spec/fixtures/incoming_messages.yml
@@ -1,3 +1,23 @@
+# == Schema Information
+#
+# Table name: incoming_messages
+#
+# id :integer not null, primary key
+# info_request_id :integer not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# raw_email_id :integer not null
+# cached_attachment_text_clipped :text
+# cached_main_body_text_folded :text
+# cached_main_body_text_unfolded :text
+# subject :text
+# mail_from_domain :text
+# valid_to_reply_to :boolean
+# last_parsed :datetime
+# mail_from :text
+# sent_at :datetime
+#
+
useless_incoming_message:
id: 1
info_request_id: 101
diff --git a/spec/fixtures/info_request_events.yml b/spec/fixtures/info_request_events.yml
index 3907703d8..b2f40cc37 100644
--- a/spec/fixtures/info_request_events.yml
+++ b/spec/fixtures/info_request_events.yml
@@ -1,3 +1,20 @@
+# == Schema Information
+#
+# Table name: info_request_events
+#
+# id :integer not null, primary key
+# info_request_id :integer not null
+# event_type :text not null
+# params_yaml :text not null
+# created_at :datetime not null
+# described_state :string(255)
+# calculated_state :string(255)
+# last_described_at :datetime
+# incoming_message_id :integer
+# outgoing_message_id :integer
+# comment_id :integer
+#
+
useless_outgoing_message_event:
id: 900
params_yaml: "--- \n\
diff --git a/spec/fixtures/info_requests.yml b/spec/fixtures/info_requests.yml
index 97effd036..d64807a49 100644
--- a/spec/fixtures/info_requests.yml
+++ b/spec/fixtures/info_requests.yml
@@ -1,3 +1,27 @@
+# == Schema Information
+#
+# Table name: info_requests
+#
+# id :integer not null, primary key
+# title :text not null
+# user_id :integer
+# public_body_id :integer not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# described_state :string(255) not null
+# awaiting_description :boolean default(FALSE), not null
+# prominence :string(255) default("normal"), not null
+# url_title :text not null
+# law_used :string(255) default("foi"), not null
+# allow_new_responses_from :string(255) default("anybody"), not null
+# handle_rejected_responses :string(255) default("bounce"), not null
+# idhash :string(255) not null
+# external_user_name :string(255)
+# external_url :string(255)
+# attention_requested :boolean default(FALSE)
+# comments_allowed :boolean default(TRUE), not null
+#
+
fancy_dog_request:
id: 101
title: Why do you have & such a fancy dog?
diff --git a/spec/fixtures/outgoing_messages.yml b/spec/fixtures/outgoing_messages.yml
index c71ee08bf..971ce0cc5 100644
--- a/spec/fixtures/outgoing_messages.yml
+++ b/spec/fixtures/outgoing_messages.yml
@@ -1,3 +1,19 @@
+# == Schema Information
+#
+# Table name: outgoing_messages
+#
+# id :integer not null, primary key
+# info_request_id :integer not null
+# body :text not null
+# status :string(255) not null
+# message_type :string(255) not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# last_sent_at :datetime
+# incoming_message_followup_id :integer
+# what_doing :string(255) not null
+#
+
useless_outgoing_message:
id: 1
info_request_id: 101
diff --git a/spec/fixtures/public_bodies.yml b/spec/fixtures/public_bodies.yml
index 65cba4b28..6d16a91ea 100644
--- a/spec/fixtures/public_bodies.yml
+++ b/spec/fixtures/public_bodies.yml
@@ -1,3 +1,26 @@
+# == Schema Information
+#
+# Table name: public_bodies
+#
+# id :integer not null, primary key
+# name :text not null
+# short_name :text not null
+# request_email :text not null
+# version :integer not null
+# last_edit_editor :string(255) not null
+# last_edit_comment :text not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# url_name :text not null
+# home_page :text default(""), not null
+# notes :text default(""), not null
+# first_letter :string(255) not null
+# publication_scheme :text default(""), not null
+# api_key :string(255) not null
+# info_requests_count :integer default(0), not null
+# disclosure_log :text default(""), not null
+#
+
geraldine_public_body:
name: The Geraldine Quango
first_letter: T
diff --git a/spec/fixtures/raw_emails.yml b/spec/fixtures/raw_emails.yml
index ad2bc0a63..efdadde7b 100644
--- a/spec/fixtures/raw_emails.yml
+++ b/spec/fixtures/raw_emails.yml
@@ -1,3 +1,10 @@
+# == Schema Information
+#
+# Table name: raw_emails
+#
+# id :integer not null, primary key
+#
+
# The actual email messages are in fixtures/files/raw_emails
#
# Note that the words "money" and "bob" are used in some tests
diff --git a/spec/fixtures/track_things.yml b/spec/fixtures/track_things.yml
index 1c4b323fd..61f1ed532 100644
--- a/spec/fixtures/track_things.yml
+++ b/spec/fixtures/track_things.yml
@@ -1,3 +1,19 @@
+# == Schema Information
+#
+# Table name: track_things
+#
+# id :integer not null, primary key
+# tracking_user_id :integer not null
+# track_query :string(255) not null
+# info_request_id :integer
+# tracked_user_id :integer
+# public_body_id :integer
+# track_medium :string(255) not null
+# track_type :string(255) default("internal_error"), not null
+# created_at :datetime
+# updated_at :datetime
+#
+
track_fancy_dog_request:
id: "10"
track_query: request:why_do_you_have_such_a_fancy_dog
diff --git a/spec/fixtures/users.yml b/spec/fixtures/users.yml
index c9730d855..d996fd31e 100644
--- a/spec/fixtures/users.yml
+++ b/spec/fixtures/users.yml
@@ -1,3 +1,29 @@
+# == Schema Information
+#
+# Table name: users
+#
+# id :integer not null, primary key
+# email :string(255) not null
+# name :string(255) not null
+# hashed_password :string(255) not null
+# salt :string(255) not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# email_confirmed :boolean default(FALSE), not null
+# url_name :text not null
+# last_daily_track_email :datetime default(2000-01-01 00:00:00 UTC)
+# admin_level :string(255) default("none"), not null
+# ban_text :text default(""), not null
+# about_me :text default(""), not null
+# locale :string(255)
+# email_bounced_at :datetime
+# email_bounce_message :text default(""), not null
+# no_limit :boolean default(FALSE), not null
+# receive_email_alerts :boolean default(TRUE), not null
+# address :string(255)
+# dob :date
+#
+
bob_smith_user:
id: "1"
name: Bob Smith
diff --git a/spec/models/censor_rule_spec.rb b/spec/models/censor_rule_spec.rb
index 3782cc630..5b41cc0d4 100644
--- a/spec/models/censor_rule_spec.rb
+++ b/spec/models/censor_rule_spec.rb
@@ -1,3 +1,20 @@
+# == Schema Information
+#
+# Table name: censor_rules
+#
+# id :integer not null, primary key
+# info_request_id :integer
+# user_id :integer
+# public_body_id :integer
+# text :text not null
+# replacement :text not null
+# last_edit_editor :string(255) not null
+# last_edit_comment :text not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# regexp :boolean
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe CensorRule, "substituting things" do
diff --git a/spec/models/foi_attachment_spec.rb b/spec/models/foi_attachment_spec.rb
index 9b0115c44..882723d1e 100644
--- a/spec/models/foi_attachment_spec.rb
+++ b/spec/models/foi_attachment_spec.rb
@@ -1,3 +1,18 @@
+# == Schema Information
+#
+# Table name: foi_attachments
+#
+# id :integer not null, primary key
+# content_type :text
+# filename :text
+# charset :text
+# display_size :text
+# url_part_number :integer
+# within_rfc822_subject :text
+# incoming_message_id :integer
+# hexdigest :string(32)
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe FoiAttachment do
diff --git a/spec/models/holiday_spec.rb b/spec/models/holiday_spec.rb
index 5d3f76d24..89849abb7 100644
--- a/spec/models/holiday_spec.rb
+++ b/spec/models/holiday_spec.rb
@@ -1,3 +1,12 @@
+# == Schema Information
+#
+# Table name: holidays
+#
+# id :integer not null, primary key
+# day :date
+# description :text
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe Holiday, " when calculating due date" do
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index ff6a8e34e..9455f20db 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -1,4 +1,24 @@
# coding: utf-8
+# == Schema Information
+#
+# Table name: incoming_messages
+#
+# id :integer not null, primary key
+# info_request_id :integer not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# raw_email_id :integer not null
+# cached_attachment_text_clipped :text
+# cached_main_body_text_folded :text
+# cached_main_body_text_unfolded :text
+# subject :text
+# mail_from_domain :text
+# valid_to_reply_to :boolean
+# last_parsed :datetime
+# mail_from :text
+# sent_at :datetime
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe IncomingMessage, " when dealing with incoming mail" do
diff --git a/spec/models/info_request_event_spec.rb b/spec/models/info_request_event_spec.rb
index eb0de8c86..7f485454d 100644
--- a/spec/models/info_request_event_spec.rb
+++ b/spec/models/info_request_event_spec.rb
@@ -1,4 +1,21 @@
# coding: utf-8
+# == Schema Information
+#
+# Table name: info_request_events
+#
+# id :integer not null, primary key
+# info_request_id :integer not null
+# event_type :text not null
+# params_yaml :text not null
+# created_at :datetime not null
+# described_state :string(255)
+# calculated_state :string(255)
+# last_described_at :datetime
+# incoming_message_id :integer
+# outgoing_message_id :integer
+# comment_id :integer
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe InfoRequestEvent do
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index c9ee57c74..2846fa6dc 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -1,3 +1,27 @@
+# == Schema Information
+#
+# Table name: info_requests
+#
+# id :integer not null, primary key
+# title :text not null
+# user_id :integer
+# public_body_id :integer not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# described_state :string(255) not null
+# awaiting_description :boolean default(FALSE), not null
+# prominence :string(255) default("normal"), not null
+# url_title :text not null
+# law_used :string(255) default("foi"), not null
+# allow_new_responses_from :string(255) default("anybody"), not null
+# handle_rejected_responses :string(255) default("bounce"), not null
+# idhash :string(255) not null
+# external_user_name :string(255)
+# external_url :string(255)
+# attention_requested :boolean default(FALSE)
+# comments_allowed :boolean default(TRUE), not null
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe InfoRequest do
diff --git a/spec/models/mail_server_log_spec.rb b/spec/models/mail_server_log_spec.rb
index 2b44a4559..67709b130 100644
--- a/spec/models/mail_server_log_spec.rb
+++ b/spec/models/mail_server_log_spec.rb
@@ -1,3 +1,16 @@
+# == Schema Information
+#
+# Table name: mail_server_logs
+#
+# id :integer not null, primary key
+# mail_server_log_done_id :integer
+# info_request_id :integer
+# order :integer not null
+# line :text not null
+# created_at :datetime not null
+# updated_at :datetime not null
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe MailServerLog do
diff --git a/spec/models/outgoing_message_spec.rb b/spec/models/outgoing_message_spec.rb
index 60164fb31..d0816d01f 100644
--- a/spec/models/outgoing_message_spec.rb
+++ b/spec/models/outgoing_message_spec.rb
@@ -1,3 +1,19 @@
+# == Schema Information
+#
+# Table name: outgoing_messages
+#
+# id :integer not null, primary key
+# info_request_id :integer not null
+# body :text not null
+# status :string(255) not null
+# message_type :string(255) not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# last_sent_at :datetime
+# incoming_message_followup_id :integer
+# what_doing :string(255) not null
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe OutgoingMessage, " when making an outgoing message" do
diff --git a/spec/models/post_redirect_spec.rb b/spec/models/post_redirect_spec.rb
index 5f51b6de5..73740e914 100644
--- a/spec/models/post_redirect_spec.rb
+++ b/spec/models/post_redirect_spec.rb
@@ -1,3 +1,19 @@
+# == Schema Information
+#
+# Table name: post_redirects
+#
+# id :integer not null, primary key
+# token :text not null
+# uri :text not null
+# post_params_yaml :text
+# created_at :datetime not null
+# updated_at :datetime not null
+# email_token :text not null
+# reason_params_yaml :text
+# user_id :integer
+# circumstance :text default("normal"), not null
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe PostRedirect, " when constructing" do
diff --git a/spec/models/profile_photo_spec.rb b/spec/models/profile_photo_spec.rb
index 892cccd08..0e157e2c5 100644
--- a/spec/models/profile_photo_spec.rb
+++ b/spec/models/profile_photo_spec.rb
@@ -1,3 +1,13 @@
+# == Schema Information
+#
+# Table name: profile_photos
+#
+# id :integer not null, primary key
+# data :binary not null
+# user_id :integer
+# draft :boolean default(FALSE), not null
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe ProfilePhoto, "when constructing a new photo" do
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index 34a91a2c9..d1fdd2c47 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -1,3 +1,26 @@
+# == Schema Information
+#
+# Table name: public_bodies
+#
+# id :integer not null, primary key
+# name :text not null
+# short_name :text not null
+# request_email :text not null
+# version :integer not null
+# last_edit_editor :string(255) not null
+# last_edit_comment :text not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# url_name :text not null
+# home_page :text default(""), not null
+# notes :text default(""), not null
+# first_letter :string(255) not null
+# publication_scheme :text default(""), not null
+# api_key :string(255) not null
+# info_requests_count :integer default(0), not null
+# disclosure_log :text default(""), not null
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe PublicBody, " using tags" do
diff --git a/spec/models/purge_request_spec.rb b/spec/models/purge_request_spec.rb
index 7b67fca52..02b3d685d 100644
--- a/spec/models/purge_request_spec.rb
+++ b/spec/models/purge_request_spec.rb
@@ -1,3 +1,14 @@
+# == Schema Information
+#
+# Table name: purge_requests
+#
+# id :integer not null, primary key
+# url :string(255)
+# created_at :datetime not null
+# model :string(255) not null
+# model_id :integer not null
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'fakeweb'
diff --git a/spec/models/raw_email_spec.rb b/spec/models/raw_email_spec.rb
index ff2830a62..f86b35e99 100644
--- a/spec/models/raw_email_spec.rb
+++ b/spec/models/raw_email_spec.rb
@@ -1,3 +1,10 @@
+# == Schema Information
+#
+# Table name: raw_emails
+#
+# id :integer not null, primary key
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe User, "manipulating a raw email" do
diff --git a/spec/models/track_thing_spec.rb b/spec/models/track_thing_spec.rb
index c42eb5e8b..86d3c0cda 100644
--- a/spec/models/track_thing_spec.rb
+++ b/spec/models/track_thing_spec.rb
@@ -1,3 +1,19 @@
+# == Schema Information
+#
+# Table name: track_things
+#
+# id :integer not null, primary key
+# tracking_user_id :integer not null
+# track_query :string(255) not null
+# info_request_id :integer
+# tracked_user_id :integer
+# public_body_id :integer
+# track_medium :string(255) not null
+# track_type :string(255) default("internal_error"), not null
+# created_at :datetime
+# updated_at :datetime
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe TrackThing, "when tracking changes" do
diff --git a/spec/models/track_things_sent_email_spec.rb b/spec/models/track_things_sent_email_spec.rb
index 6166f42ab..4675d0847 100644
--- a/spec/models/track_things_sent_email_spec.rb
+++ b/spec/models/track_things_sent_email_spec.rb
@@ -1,3 +1,16 @@
+# == Schema Information
+#
+# Table name: track_things_sent_emails
+#
+# id :integer not null, primary key
+# track_thing_id :integer not null
+# info_request_event_id :integer
+# user_id :integer
+# public_body_id :integer
+# created_at :datetime
+# updated_at :datetime
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe TrackThingsSentEmail, "when tracking things sent email" do
diff --git a/spec/models/user_info_request_sent_alert_spec.rb b/spec/models/user_info_request_sent_alert_spec.rb
index 971c5b8c1..69be1092b 100644
--- a/spec/models/user_info_request_sent_alert_spec.rb
+++ b/spec/models/user_info_request_sent_alert_spec.rb
@@ -1,3 +1,14 @@
+# == Schema Information
+#
+# Table name: user_info_request_sent_alerts
+#
+# id :integer not null, primary key
+# user_id :integer not null
+# info_request_id :integer not null
+# alert_type :string(255) not null
+# info_request_event_id :integer
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe UserInfoRequestSentAlert, " when blah" do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 96c169604..f380f6f13 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1,3 +1,29 @@
+# == Schema Information
+#
+# Table name: users
+#
+# id :integer not null, primary key
+# email :string(255) not null
+# name :string(255) not null
+# hashed_password :string(255) not null
+# salt :string(255) not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# email_confirmed :boolean default(FALSE), not null
+# url_name :text not null
+# last_daily_track_email :datetime default(2000-01-01 00:00:00 UTC)
+# admin_level :string(255) default("none"), not null
+# ban_text :text default(""), not null
+# about_me :text default(""), not null
+# locale :string(255)
+# email_bounced_at :datetime
+# email_bounce_message :text default(""), not null
+# no_limit :boolean default(FALSE), not null
+# receive_email_alerts :boolean default(TRUE), not null
+# address :string(255)
+# dob :date
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe User, "making up the URL name" do