aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock16
-rw-r--r--README.md2
-rw-r--r--app/helpers/admin_helper.rb8
-rw-r--r--app/views/admin_censor_rule/_show.rhtml6
-rw-r--r--app/views/admin_censor_rule/edit.rhtml16
-rw-r--r--app/views/admin_censor_rule/new.rhtml2
-rw-r--r--app/views/admin_general/_admin_navbar.rhtml2
-rw-r--r--app/views/admin_general/index.rhtml5
-rw-r--r--app/views/admin_general/stats.rhtml1
-rw-r--r--app/views/admin_general/timeline.rhtml13
-rw-r--r--app/views/admin_public_body/_locale_selector.rhtml10
-rw-r--r--app/views/admin_public_body/edit.rhtml8
-rw-r--r--app/views/admin_public_body/list.rhtml6
-rw-r--r--app/views/admin_public_body/new.rhtml2
-rw-r--r--app/views/admin_public_body/show.rhtml2
-rw-r--r--app/views/admin_request/_incoming_message_actions.rhtml8
-rw-r--r--app/views/admin_request/_some_requests.rhtml2
-rw-r--r--app/views/admin_request/edit.rhtml8
-rw-r--r--app/views/admin_request/edit_comment.rhtml6
-rw-r--r--app/views/admin_request/edit_outgoing.rhtml8
-rw-r--r--app/views/admin_request/show.rhtml24
-rw-r--r--app/views/admin_request/show_raw_email.rhtml54
-rw-r--r--app/views/admin_track/_some_tracks.rhtml4
-rw-r--r--app/views/admin_track/list.rhtml2
-rw-r--r--app/views/admin_user/_form.rhtml2
-rw-r--r--app/views/admin_user/edit.rhtml16
-rw-r--r--app/views/admin_user/list.rhtml2
-rw-r--r--app/views/admin_user/list_banned.rhtml2
-rw-r--r--app/views/admin_user/show.rhtml9
-rw-r--r--app/views/user/_signup.rhtml6
-rw-r--r--config/routes.rb8
-rw-r--r--db/.gitignore1
-rw-r--r--db/development_structure.sql2095
-rw-r--r--spec/fixtures/info_request_events.yml11
-rw-r--r--spec/fixtures/info_requests.yml12
-rw-r--r--spec/fixtures/outgoing_messages.yml11
-rw-r--r--spec/fixtures/public_bodies.yml15
-rw-r--r--spec/fixtures/public_body_translations.yml13
-rw-r--r--spec/fixtures/users.yml22
-rw-r--r--spec/script/mailin_spec.rb2
-rw-r--r--spec/spec_helper.rb13
43 files changed, 2333 insertions, 124 deletions
diff --git a/.gitignore b/.gitignore
index 31df17a96..e0b1e3b21 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,7 +9,6 @@
._*
.DS_Store
.autotest
-/db/test_structure.sql
*#*#
TAGS
/vendor/plugins/*theme
diff --git a/Gemfile b/Gemfile
index 7cd8c22dc..851ed38ff 100644
--- a/Gemfile
+++ b/Gemfile
@@ -48,6 +48,7 @@ group :test do
gem 'fakeweb'
gem 'rspec-rails', '~> 1.3.4'
gem 'test-unit', '~> 1.2.3', :platforms => :ruby_19
+ gem 'coveralls', :require => false
end
group :development do
diff --git a/Gemfile.lock b/Gemfile.lock
index 25b156184..27f574f4f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -34,11 +34,18 @@ GEM
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
chunky_png (1.2.6)
+ colorize (0.5.8)
columnize (0.3.6)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
+ coveralls (0.6.0)
+ colorize
+ multi_json (~> 1.3)
+ rest-client
+ simplecov (>= 0.7)
+ thor
daemons (1.1.9)
erubis (2.7.0)
eventmachine (1.0.0)
@@ -78,6 +85,7 @@ GEM
thin
memcache-client (1.8.5)
mime-types (1.19)
+ multi_json (1.6.1)
net-http-local (0.1.2)
net-purge (0.1.0)
net-scp (1.1.0)
@@ -96,6 +104,8 @@ GEM
rdoc (3.12.1)
json (~> 1.4)
recaptcha (0.3.4)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
rmagick (2.13.1)
routing-filter (0.2.4)
actionpack
@@ -123,6 +133,10 @@ GEM
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
sass (3.2.1)
+ simplecov (0.7.1)
+ multi_json (~> 1.0)
+ simplecov-html (~> 0.7.1)
+ simplecov-html (0.7.1)
sinatra (1.2.8)
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
@@ -139,6 +153,7 @@ GEM
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
+ thor (0.17.0)
tilt (1.3.3)
treetop (1.4.11)
polyglot
@@ -157,6 +172,7 @@ DEPENDENCIES
bootstrap-sass
capistrano
compass
+ coveralls
erubis
fakeweb
fast_gettext (>= 0.6.0)
diff --git a/README.md b/README.md
index 7313df071..a7e4e0dc5 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Welcome to Alaveteli!
-[![Build Status](https://secure.travis-ci.org/mysociety/alaveteli.png)](http://travis-ci.org/mysociety/alaveteli) [![Dependency Status](https://gemnasium.com/mysociety/alaveteli.png)](https://gemnasium.com/mysociety/alaveteli)
+[![Build Status](https://secure.travis-ci.org/mysociety/alaveteli.png)](http://travis-ci.org/mysociety/alaveteli) [![Dependency Status](https://gemnasium.com/mysociety/alaveteli.png)](https://gemnasium.com/mysociety/alaveteli) [![Coverage Status](https://coveralls.io/repos/mysociety/alaveteli/badge.png?branch=master)](https://coveralls.io/r/mysociety/alaveteli) [![Code Climate](https://codeclimate.com/github/mysociety/alaveteli.png)](https://codeclimate.com/github/mysociety/alaveteli)
This is an open source project to create a standard, internationalised
platform for making Freedom of Information (FOI) requests in different
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
index 1219629ee..059cebdfa 100644
--- a/app/helpers/admin_helper.rb
+++ b/app/helpers/admin_helper.rb
@@ -21,17 +21,17 @@ module AdminHelper
def request_both_links(info_request)
link_to(eye, request_path(info_request), :title => "view request on public website") + " " +
- link_to(info_request.title, admin_request_show_url(info_request), :title => "view full details")
+ link_to(info_request.title, admin_request_show_path(info_request), :title => "view full details")
end
def public_body_both_links(public_body)
- link_to(eye, public_body_url(public_body), :title => "view authority on public website") + " " +
+ link_to(eye, public_body_path(public_body), :title => "view authority on public website") + " " +
link_to(h(public_body.name), admin_body_show_path(public_body), :title => "view full details")
end
def user_both_links(user)
- link_to(eye, user_url(user), :title => "view user's page on public website") + " " +
- link_to(h(user.name), admin_user_show_url(user), :title => "view full details")
+ link_to(eye, user_path(user), :title => "view user's page on public website") + " " +
+ link_to(h(user.name), admin_user_show_path(user), :title => "view full details")
end
end
diff --git a/app/views/admin_censor_rule/_show.rhtml b/app/views/admin_censor_rule/_show.rhtml
index baa93e832..0d4cece93 100644
--- a/app/views/admin_censor_rule/_show.rhtml
+++ b/app/views/admin_censor_rule/_show.rhtml
@@ -16,7 +16,7 @@
<td><%=h censor_rule.send(column) %></td>
<% end %>
<td>
- <%= link_to "Edit", '../../censor/edit/' + censor_rule.id.to_s %>
+ <%= link_to "Edit", admin_rule_edit_path(censor_rule) %>
</td>
</tr>
<% end %>
@@ -26,10 +26,10 @@
<% end %>
<% if defined? info_request %>
- <%= link_to "New censor rule (for this request only)", "../../censor/new?info_request_id=#{info_request.id}", :class => "btn btn-info" %>
+ <%= link_to "New censor rule (for this request only)", admin_rule_new_path(:info_request_id => info_request.id), :class => "btn btn-info" %>
<% end %>
<% if defined? user %>
- <%= link_to "New censor rule", "../../censor/new?user_id=#{user.id}", :class => "btn btn-info" %> <span class="label label-info">for all requests by this user</span>
+ <%= link_to "New censor rule", admin_rule_new_path(:user_id => user.id), :class => "btn btn-info" %> <span class="label label-info">for all requests by this user</span>
<% end %>
diff --git a/app/views/admin_censor_rule/edit.rhtml b/app/views/admin_censor_rule/edit.rhtml
index e34e022a0..4eb99ce57 100644
--- a/app/views/admin_censor_rule/edit.rhtml
+++ b/app/views/admin_censor_rule/edit.rhtml
@@ -2,15 +2,17 @@
<h1><%=@title%></h1>
-<% form_tag '../update/' + @censor_rule.id.to_s do %>
+<% form_tag admin_rule_update_path(@censor_rule), :class => "form form-horizontal" do %>
<%= render :partial => 'form', :locals => { :info_request => @censor_rule.info_request, :user => @censor_rule.user } %>
- <p><%= submit_tag 'Save', :accesskey => 's' %></p>
+ <div class="form-actions">
+ <%= submit_tag 'Save', :accesskey => 's', :class => "btn btn-primary" %>
+ </div>
<% end %>
-<% form_tag('../destroy/' + @censor_rule.id.to_s) do %>
- <p>
- <%= hidden_field_tag(:censor_rule_id, @censor_rule.id) %>
- Permanent! --&gt; <%= submit_tag "Destroy rule" %>
- </p>
+<% form_tag admin_rule_destroy_path(@censor_rule), :class => "form form-horizontal" do %>
+ <%= hidden_field_tag(:censor_rule_id, @censor_rule.id) %>
+ <div class="form-actions">
+ Permanent! --&gt; <%= submit_tag "Destroy rule", :class => "btn btn-primary" %>
+ </div>
<% end %>
diff --git a/app/views/admin_censor_rule/new.rhtml b/app/views/admin_censor_rule/new.rhtml
index c991f327e..f6978c07c 100644
--- a/app/views/admin_censor_rule/new.rhtml
+++ b/app/views/admin_censor_rule/new.rhtml
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<% form_tag 'create', :class => "form form-horizontal" do %>
+<% form_tag admin_rule_create_path, :class => "form form-horizontal" do %>
<%= render :partial => 'form', :locals => { :info_request => @info_request, :user => @censor_user } %>
<div class="form-actions">
<%= submit_tag "Create", :class => "btn btn-primary" %>
diff --git a/app/views/admin_general/_admin_navbar.rhtml b/app/views/admin_general/_admin_navbar.rhtml
index 49592c545..5cc740f70 100644
--- a/app/views/admin_general/_admin_navbar.rhtml
+++ b/app/views/admin_general/_admin_navbar.rhtml
@@ -20,5 +20,3 @@
</div>
</div>
</div>
-
-
diff --git a/app/views/admin_general/index.rhtml b/app/views/admin_general/index.rhtml
index 977af204f..9940434ac 100644
--- a/app/views/admin_general/index.rhtml
+++ b/app/views/admin_general/index.rhtml
@@ -16,6 +16,7 @@
</div>
</div>
+<hr>
<div class="row">
<div class="span12">
@@ -36,9 +37,9 @@
<tr>
<td>
<% if message.get_body_for_quoting.strip.size == 0 %>
- <%= link_to "(no body)", "request/show_raw_email/" + message.raw_email_id.to_s %>
+ <%= link_to "(no body)", admin_request_show_raw_email_path(message.raw_email_id) %>
<% else %>
- <%= link_to excerpt(message.get_body_for_quoting, "", 60), "request/show_raw_email/" + message.raw_email_id.to_s %>
+ <%= link_to excerpt(message.get_body_for_quoting, "", 60), admin_request_show_raw_email_path(message.raw_email_id) %>
<% end %>
</td>
<td class="span2">
diff --git a/app/views/admin_general/stats.rhtml b/app/views/admin_general/stats.rhtml
index 1a8035006..27dc25ee0 100644
--- a/app/views/admin_general/stats.rhtml
+++ b/app/views/admin_general/stats.rhtml
@@ -1,5 +1,4 @@
<% @title = "Statistics" %>
-
<div class="hero-unit">
<h2><%=@public_body_count%> public authorities</h2>
<h2><%=@info_request_count%> requests, <%=@outgoing_message_count%> outgoing messages, <%=@incoming_message_count%> incoming messages</h2>
diff --git a/app/views/admin_general/timeline.rhtml b/app/views/admin_general/timeline.rhtml
index 9b9f0918e..8fd8875b6 100644
--- a/app/views/admin_general/timeline.rhtml
+++ b/app/views/admin_general/timeline.rhtml
@@ -1,12 +1,12 @@
<% @title = "Timeline" %>
<div class="btn-toolbar">
<div class="btn-group">
- <a class="btn" href="?hour=1">Hour</a>
- <a class="btn" href="?day=1">Day</a>
- <a class="btn" href="?">2 days</a>
- <a class="btn" href="?week=1">Week</a>
- <a class="btn" href="?month=1">Month</a>
- <a class="btn" href="?all=1">All time</a>
+ <%= link_to "Hour", admin_timeline_path(:hour => 1), :class => "btn" %>
+ <%= link_to "Day", admin_timeline_path(:day => 1), :class => "btn" %>
+ <%= link_to "2 days", admin_timeline_path, :class => "btn" %>
+ <%= link_to "Week", admin_timeline_path(:week => 1), :class => "btn" %>
+ <%= link_to "Month", admin_timeline_path(:month => 1), :class => "btn" %>
+ <%= link_to "All time", admin_timeline_path(:all => 1), :class => "btn" %>
</div>
</div>
<div class="row">
@@ -32,7 +32,6 @@
<% if event.is_a? InfoRequestEvent %>
<%= request_both_links(event.info_request) %>
-
<% if event.event_type == 'edit' %>
was edited by administrator <strong><%=h event.params[:editor] %></strong>.
<% for p in ['title', 'prominence', 'described_state', 'awaiting_description']
diff --git a/app/views/admin_public_body/_locale_selector.rhtml b/app/views/admin_public_body/_locale_selector.rhtml
deleted file mode 100644
index 5ef79f2df..000000000
--- a/app/views/admin_public_body/_locale_selector.rhtml
+++ /dev/null
@@ -1,10 +0,0 @@
-<div id="locale_switcher">
-<%= _('Edit language version:') %>
-<% for possible_locale in @locales %>
- <% if possible_locale == @locale %>
- <%= possible_locale %>
- <% else %>
- <a href="?show_locale=<%=possible_locale%>"><%= possible_locale %></a>
- <% end %>
-<% end %>
-</div>
diff --git a/app/views/admin_public_body/edit.rhtml b/app/views/admin_public_body/edit.rhtml
index 629f64257..eb0c45f19 100644
--- a/app/views/admin_public_body/edit.rhtml
+++ b/app/views/admin_public_body/edit.rhtml
@@ -3,7 +3,7 @@
<div class="row">
<div class="span8">
<div id="public_body_form">
- <% form_for @public_body, :url => "../update/#{@public_body.id}", :html => { :class => "form form-horizontal" } do |f| %>
+ <% form_for @public_body, :url => admin_body_update_path(@public_body), :html => { :class => "form form-horizontal" } do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<div class="form-actions">
<%= f.submit 'Save', :accesskey => 's', :class => "btn btn-success" %></p>
@@ -13,14 +13,14 @@
<div class="row">
<div class="span8">
<div class="well">
- <%= link_to 'Show', "../show/#{@public_body.id}", :class => "btn" %>
- <%= link_to 'List all', '../list', :class => "btn" %>
+ <%= link_to 'Show', admin_body_show_path(@public_body), :class => "btn" %>
+ <%= link_to 'List all', admin_body_list_path, :class => "btn" %>
</div>
</div>
</div>
<% if @public_body.info_requests.empty? %>
- <% form_tag("../destroy/#{@public_body.id}", :class => "form form-inline") do %>
+ <% form_tag(admin_body_destroy_path(@public_body), :class => "form form-inline") do %>
<%= hidden_field_tag(:public_body_id, { :value => @public_body.id } ) %>
<%= submit_tag _("Destroy {{name}}", :name => @public_body.name), :class => "btn btn-danger" %> (this is permanent!)
<% end %>
diff --git a/app/views/admin_public_body/list.rhtml b/app/views/admin_public_body/list.rhtml
index b4328bcad..acc05f50d 100644
--- a/app/views/admin_public_body/list.rhtml
+++ b/app/views/admin_public_body/list.rhtml
@@ -8,10 +8,10 @@
<div class="btn-toolbar">
<div class="btn-group">
- <%= link_to 'New public authority', 'new', :class => "btn btn-primary" %>
+ <%= link_to 'New public authority', admin_body_new_path, :class => "btn btn-primary" %>
</div>
<div class="btn-group">
- <%= link_to 'Import from CSV file', 'import_csv', :class => "btn btn-warning" %>
+ <%= link_to 'Import from CSV file', admin_body_import_csv_path, :class => "btn btn-warning" %>
</div>
</div>
@@ -19,7 +19,7 @@
<%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query" } %>
<%= submit_tag "Search", :class => "btn" %>
<% if !@query.nil? %>
- <%= link_to 'Show all', 'list', :class => "btn" %>
+ <%= link_to 'Show all', admin_body_list_path, :class => "btn" %>
<% end %><br>
(substring search in names and emails; exact match of tags)
<% end %>
diff --git a/app/views/admin_public_body/new.rhtml b/app/views/admin_public_body/new.rhtml
index e03ebab00..6ead1810c 100644
--- a/app/views/admin_public_body/new.rhtml
+++ b/app/views/admin_public_body/new.rhtml
@@ -4,7 +4,7 @@
<div class="row">
<div class="span8">
<div id="public_body_form">
- <% form_for :public_body, @public_body, :url => "create", :html => {:class => "form form-horizontal"} do |f| %>
+ <% form_for :public_body, @public_body, :url => admin_body_create_path, :html => {:class => "form form-horizontal"} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<div class="form-actions">
<%= f.submit "Create", :class => "btn btn-primary" %>
diff --git a/app/views/admin_public_body/show.rhtml b/app/views/admin_public_body/show.rhtml
index c59b90697..cfb10b24e 100644
--- a/app/views/admin_public_body/show.rhtml
+++ b/app/views/admin_public_body/show.rhtml
@@ -45,7 +45,7 @@
</tr>
</tbody>
</table>
-<%= link_to _("Edit"), "../edit/#{@public_body.id}", :class => "btn btn-primary" %>
+<%= link_to _("Edit"), admin_body_edit_path(@public_body), :class => "btn btn-primary" %>
<% unless @public_body.url_name.nil? %>
<%=link_to _("Public page"), public_body_path(@public_body), :class => "btn" %>
<% else %>
diff --git a/app/views/admin_request/_incoming_message_actions.rhtml b/app/views/admin_request/_incoming_message_actions.rhtml
index 0ebeb5f9b..84c29dcc3 100644
--- a/app/views/admin_request/_incoming_message_actions.rhtml
+++ b/app/views/admin_request/_incoming_message_actions.rhtml
@@ -1,6 +1,6 @@
<fieldset class="form-horizontal">
<legend>Actions</legend>
- <% form_tag '../redeliver_incoming', :class => "form form-inline" do %>
+ <% form_tag admin_request_redeliver_incoming_path, :class => "form form-inline" do %>
<div class="control-group">
<label class="control-label" for="url_title_<%= incoming_message.id %>">Redeliver message to one or more other requests</label>
<div class="controls">
@@ -18,11 +18,11 @@
<div class="control-group">
<label class="control-label">Generate FOI officer upload URL</label>
<div class="controls">
- <%= link_to 'Generate and take me there', "../generate_upload_url/#{incoming_message.info_request.id}?incoming_message_id=#{incoming_message.id}", :class => "btn" %>
+ <%= link_to 'Generate and take me there', admin_request_generate_upload_url_path(incoming_message.info_request, :incoming_message_id => incoming_message.id), :class => "btn" %>
</div>
</div>
- <% form_tag '../destroy_incoming', :class => "form form-inline" do %>
+ <% form_tag admin_request_destroy_incoming_path, :class => "form form-inline" do %>
<div class="control-group">
<label class="control-label" for="destroy_message_<%= incoming_message.id %>">Destroy message</label>
<div class="controls">
@@ -37,7 +37,7 @@
<div class="control-group">
<label class="control-label">Inspect email</label>
<div class="controls">
- <%= link_to "View raw email", "../show_raw_email/#{incoming_message.raw_email_id}", :class => "btn" %>
+ <%= link_to "View raw email", admin_request_show_raw_email_path(incoming_message.raw_email_id), :class => "btn" %>
</div>
</div>
<% end %>
diff --git a/app/views/admin_request/_some_requests.rhtml b/app/views/admin_request/_some_requests.rhtml
index 379947b8a..cff94956d 100644
--- a/app/views/admin_request/_some_requests.rhtml
+++ b/app/views/admin_request/_some_requests.rhtml
@@ -4,7 +4,7 @@
<div class="accordion-heading accordion-toggle row">
<span class="item-title span6">
<a href="#request_<%=info_request.id%>" data-toggle="collapse" data-parent="requests"><%= chevron_right %></a>
- <%= link_to(info_request.title, admin_request_show_url(info_request), :title => "view full details") %>
+ <%= link_to(info_request.title, admin_request_show_path(info_request), :title => "view full details") %>
</span>
<span class="item-metadata span6">
<%= user_admin_link_for_request(info_request) %> <%= arrow_right %> <%= link_to("#{info_request.public_body.name}", admin_body_show_path(info_request.public_body)) %>, <%= time_ago_in_words(info_request.updated_at) %> ago
diff --git a/app/views/admin_request/edit.rhtml b/app/views/admin_request/edit.rhtml
index 11c017aab..1cf5d4f12 100644
--- a/app/views/admin_request/edit.rhtml
+++ b/app/views/admin_request/edit.rhtml
@@ -2,7 +2,7 @@
<%= error_messages_for 'info_request' %>
-<% form_tag '../update/' + @info_request.id.to_s do %>
+<% form_tag admin_request_update_path(@info_request) do %>
<p><label for="info_request_title"><strong>Title</strong></label> (warning: editing this will break URLs right now)<br/>
<%= text_field 'info_request', 'title', :size => 50 %></p>
@@ -43,13 +43,13 @@
<% end %>
<p>
-<%= link_to 'Show', '../show/' + @info_request.id.to_s %> |
-<%= link_to 'List all', '../list' %>
+<%= link_to 'Show', admin_request_show_path(@info_request) %> |
+<%= link_to 'List all', admin_request_list_path %>
</p>
<hr>
-<% form_tag '../destroy/' + @info_request.id.to_s do %>
+<% form_tag admin_request_destroy_path(@info_request) do %>
<p>
<strong>This is permanent and irreversible!</strong> <%= submit_tag 'Destroy request entirely' %>
<br>Use it mainly if someone posts private information, e.g. made a Data Protection request. It
diff --git a/app/views/admin_request/edit_comment.rhtml b/app/views/admin_request/edit_comment.rhtml
index a79c096e3..07031f5f2 100644
--- a/app/views/admin_request/edit_comment.rhtml
+++ b/app/views/admin_request/edit_comment.rhtml
@@ -2,7 +2,7 @@
<%= error_messages_for 'comment' %>
-<% form_tag '../update_comment/' + @comment.id.to_s do %>
+<% form_tag admin_request_update_comment_path(@comment) do %>
<p><label for="comment_body">Body of annotation</label><br/>
<%= text_area 'comment', 'body', :rows => 10, :cols => 60 %></p>
@@ -16,7 +16,7 @@
<% end %>
<p>
-<%= link_to 'Show', '../show/' + @comment.info_request.id.to_s %> |
-<%= link_to 'List all', '../list' %>
+<%= link_to 'Show', admin_request_show_path(@comment.info_request) %> |
+<%= link_to 'List all', admin_request_list_path %>
</p>
diff --git a/app/views/admin_request/edit_outgoing.rhtml b/app/views/admin_request/edit_outgoing.rhtml
index 4932cb52f..ab209be0d 100644
--- a/app/views/admin_request/edit_outgoing.rhtml
+++ b/app/views/admin_request/edit_outgoing.rhtml
@@ -2,7 +2,7 @@
<%= error_messages_for 'outgoing_message' %>
-<% form_tag '../update_outgoing/' + @outgoing_message.id.to_s do %>
+<% form_tag admin_request_update_outgoing_path(@outgoing_message) do %>
<p><label for="outgoing_message_body">Body of message</label><br/>
<%= text_area 'outgoing_message', 'body', :rows => 10, :cols => 60 %></p>
@@ -18,11 +18,11 @@
<% end %>
<p>
-<%= link_to 'Show', '../show/' + @outgoing_message.info_request.id.to_s %> |
-<%= link_to 'List all', '../list' %>
+<%= link_to 'Show', admin_request_show_path(@outgoing_message.info_request) %> |
+<%= link_to 'List all', admin_request_list_path %>
</p>
-<% form_tag '../destroy_outgoing' do %>
+<% form_tag admin_request_destroy_outgoing_path do %>
<div>
<%= hidden_field_tag 'outgoing_message_id', @outgoing_message.id %>
Warning, this is permanent! ---&gt;
diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml
index 2f4424477..1401a7b94 100644
--- a/app/views/admin_request/show.rhtml
+++ b/app/views/admin_request/show.rhtml
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<% form_tag '../move_request', { :class => "form form-horizontal" } do %>
+<% form_tag admin_request_move_request_path, { :class => "form form-horizontal" } do %>
<%= hidden_field_tag 'info_request_id', @info_request.id %>
<div class="accordion" id="info_request">
<div class="accordion-group">
@@ -16,7 +16,7 @@
<thead>
<tr>
<td colspan="2">
- <%= link_to 'Edit metadata', '../edit/' + @info_request.id.to_s, :class => "btn" %>
+ <%= link_to 'Edit metadata', admin_request_edit_path(@info_request), :class => "btn" %>
</td>
</tr>
</thead>
@@ -47,7 +47,7 @@
<% end %>
</td>
</tr>
- <% end %>
+ <% end %>
<tr>
<td>
<b>Created by</b>
@@ -101,7 +101,7 @@
<tfoot>
<tr>
<td colspan="2">
- <%= link_to 'Edit metadata', '../edit/' + @info_request.id.to_s, :class => "btn" %>
+ <%= link_to 'Edit metadata', admin_request_edit_path(@info_request), :class => "btn" %>
</td>
</tr>
</tfoot>
@@ -117,11 +117,11 @@
FOI officer upload URL
</label>
<div class="controls">
- <%= link_to 'Generate URL', '../generate_upload_url/' + @info_request.id.to_s, :class => "btn" %>
+ <%= link_to 'Generate URL', admin_request_generate_upload_url_path(@info_request), :class => "btn" %>
<p class="help-block">(see also option to general URLs for individual incoming messages below)</p>
</div>
</div>
- <% form_tag '../hide/' + @info_request.id.to_s, :class => "form form-inline", :id => "hide_request_form" do %>
+ <% form_tag admin_request_hide_path(@info_request), :class => "form form-inline", :id => "hide_request_form" do %>
<div class="control-group">
<% if @info_request.is_external? %>
<label class="control-label">Hide the request:</label>
@@ -191,7 +191,7 @@
<tr>
<td>
<% if info_request_event.described_state != 'waiting_clarification' and info_request_event.event_type == 'response' %>
- <% form_tag '../mark_event_as_clarification', :class => "form form-inline admin-table-form admin-inline-form" do %>
+ <% form_tag admin_request_clarification_path, :class => "form form-inline admin-table-form admin-inline-form" do %>
<%= hidden_field_tag 'info_request_event_id', info_request_event.id, :id => nil %>
<%= submit_tag "Was clarification request", :class => "btn btn-mini btn-primary" %>
<% end %>
@@ -233,9 +233,9 @@
<div class="accordion-group">
<div class="accordion-heading">
<a href="#outgoing_<%=outgoing_message.id%>" data-toggle="collapse" data-parent="#outgoing_messages"><%= chevron_right %></a>
- <a href="../edit_outgoing/<%= outgoing_message.id %>">
+ <% link_to admin_request_edit_outgoing_path(outgoing_message) do %>
#<%= outgoing_message.id %> -- <%= outgoing_message.status.humanize %> <%= outgoing_message.message_type.humanize %>
- </a>
+ <% end %>
<blockquote>
<%= truncate(outgoing_message.body, :length => 400) %>
</blockquote>
@@ -245,7 +245,7 @@
<tbody>
<tr>
<td colspan="2">
- <% form_tag '../resend', :class => "admin-table-form" do %>
+ <% form_tag admin_request_resend_path, :class => "admin-table-form" do %>
<%= hidden_field_tag 'outgoing_message_id', outgoing_message.id %>
<%= submit_tag "Resend", :class => "btn" %>
<% end %>
@@ -326,12 +326,12 @@
<div class="accordion-group">
<div class="accordion-heading">
<a href="#comment_<%=comment.id%>" data-toggle="collapse" data-parent="#comments"><%= chevron_right %></a>
- <a href="../edit_comment/<%= comment.id %>">
+ <% link_to admin_request_edit_comment_path(comment) do %>
#<%=comment.id%>
--
<%=h(comment.user.name)%>
<%=admin_value(comment.created_at)%>
- </a>
+ <% end %>
<blockquote class="incoming-message">
<%= truncate(comment.body, :length => 400) %>
</blockquote>
diff --git a/app/views/admin_request/show_raw_email.rhtml b/app/views/admin_request/show_raw_email.rhtml
index c770d432d..72c782ad6 100644
--- a/app/views/admin_request/show_raw_email.rhtml
+++ b/app/views/admin_request/show_raw_email.rhtml
@@ -1,24 +1,56 @@
-<% @title = 'Incoming message ' + @raw_email.incoming_message.id.to_s + ' of FOI request \'' + h(@raw_email.incoming_message.info_request.title) + "'" %>
+<% @title = "Incoming message #{@raw_email.incoming_message.id} of FOI request '#{@raw_email.incoming_message.info_request.title}'" %>
-<h1>Incoming message <%=@raw_email.incoming_message.id.to_s %></h1>
+<h1>Incoming message <%=@raw_email.incoming_message.id %></h1>
<p>
FOI request: <%= request_both_links(@raw_email.incoming_message.info_request) %>
- <% if @holding_pen %>
+ <% if @holding_pen %>
<br>This is in the holding pen because: <strong><%= @rejected_reason %></strong>
<% if @public_bodies.size > 0 %>
<br>Guessed authority:
- <% for public_body in @public_bodies %>
- <%=public_body_both_links(public_body)%>
+ <% @public_bodies.each do |public_body| %>
+ <%=public_body_both_links(public_body)%>
<% end %>
(based on From: email domain)
<% end %>
<% if @info_requests.size > 0 %>
- <br>Guessed request:
- <% for info_request in @info_requests %>
- <%=request_both_links(info_request)%>
- <% end %>
- (based on id, not hash, in To/Cc email)
+ <div class="accordion" id="guessed-requests">
+ Guessed request:
+ <% @info_requests.each do |info_request| %>
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <a href="#info_request_<%= info_request.id %>" data-toggle="collapse"><i class="icon-chevron-right"></i></a>
+ <%=request_both_links(info_request)%>
+ </div>
+ <div class="accordion-body collapse" id="info_request_<%= info_request.id %>">
+ <table class="table table-striped table-condensed">
+ <tr>
+ <td><strong>Last outgoing message:</strong></td>
+ <td><%= info_request.outgoing_messages.last.body %></td>
+ </tr>
+ <tr>
+ <td><strong>Created by:</strong></td>
+ <td><%= user_admin_link_for_request(info_request) %></td>
+ </tr>
+ <tr>
+ <td><strong>Authority:</strong></td>
+ <td>
+ <%= link_to(info_request.public_body.name, admin_body_show_path(info_request.public_body)) %>
+ </td>
+ </tr>
+ <tr>
+ <td><strong>url_title:</strong></td>
+ <td><%= info_request.url_title %></td>
+ </tr>
+ </table>
+ <p>
+ This request was guessed because it has an incoming email address of <strong><%= info_request.incoming_email %></strong> and this incoming message was sent to <strong><%= @raw_email.incoming_message.mail.to %></strong>.
+ </p>
+ </div>
+ </div>
+ <% end %>
+ (based on id, not hash, in To/Cc email)
+ </div>
<% end %>
<% end %>
</p>
@@ -29,7 +61,7 @@
<h2>Raw email</h2>
-<p><%= link_to "Download", "../download_raw_email/" + @raw_email.id.to_s %></p>
+<p><%= link_to "Download", admin_request_download_raw_email_path(@raw_email) %></p>
<pre><%=h(@raw_email.data).gsub(/\n/, '<br>').html_safe %></pre>
diff --git a/app/views/admin_track/_some_tracks.rhtml b/app/views/admin_track/_some_tracks.rhtml
index 46741bdf3..95101cb55 100644
--- a/app/views/admin_track/_some_tracks.rhtml
+++ b/app/views/admin_track/_some_tracks.rhtml
@@ -32,7 +32,7 @@
<% if include_destroy %>
<tr>
<td colspan="2">
- <% form_tag '../../user/destroy_track', :class => "form form-inline admin-table-form" do %>
+ <% form_tag admin_user_destroy_track_path, :class => "form form-inline admin-table-form" do %>
<div>
<%= hidden_field_tag 'track_id', track_thing.id %>
<%= submit_tag "Destroy track", :class => "btn btn-warning" %>
@@ -52,7 +52,7 @@
<%= I18n.l(track_thing.send(column.name), :format => "%e %B %Y %H:%M:%S") %>
(<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(track_thing.send(column.name))) %>)
<% elsif column.name == 'track_medium' and track_thing.track_medium == 'feed' %>
- <%= link_to track_thing.track_medium, atom_feed_url(:track_id => track_thing.id) %>
+ <%= link_to track_thing.track_medium, atom_feed_path(:track_id => track_thing.id) %>
<% else %>
<%= h track_thing.send(column.name)%>
<% end %>
diff --git a/app/views/admin_track/list.rhtml b/app/views/admin_track/list.rhtml
index fa4d02eec..9cff5635b 100644
--- a/app/views/admin_track/list.rhtml
+++ b/app/views/admin_track/list.rhtml
@@ -14,7 +14,7 @@
<h2>Current top tracks:</h2>
<ol>
<% for row in @popular %>
- <li><%= link_to row['title'], admin_request_show_url(row['info_request_id']) %> (<%= row['count'] %> people following)</li>
+ <li><%= link_to row['title'], admin_request_show_path(row['info_request_id']) %> (<%= row['count'] %> people following)</li>
<% end %>
</ol>
diff --git a/app/views/admin_user/_form.rhtml b/app/views/admin_user/_form.rhtml
index 756806d2a..e7175d09c 100644
--- a/app/views/admin_user/_form.rhtml
+++ b/app/views/admin_user/_form.rhtml
@@ -41,7 +41,7 @@
user from filing new requests, making annotations or messaging other users;
the text is shown in public on the user's page and when they try to do a
forbidden action; write in the second person (you); see
- <%= link_to 'banned users', '../banned' %> for examples</small>
+ <%= link_to 'banned users', admin_user_list_banned_path %> for examples</small>
</div>
</div>
</div>
diff --git a/app/views/admin_user/edit.rhtml b/app/views/admin_user/edit.rhtml
index c3ee3012b..3333a1e48 100644
--- a/app/views/admin_user/edit.rhtml
+++ b/app/views/admin_user/edit.rhtml
@@ -1,21 +1,11 @@
<h1><%=@title%></h1>
-<% form_tag "../update/#{@admin_user.id}", :class => "form form-horizontal" do %>
+<% form_tag admin_user_update_path(@admin_user), :class => "form form-horizontal" do %>
<%= render :partial => 'form' %>
<div class="form-actions">
<%= submit_tag 'Save', :accesskey => 's', :class => "btn btn-primary" %>
</div>
<% end %>
-<%= link_to 'Show', "../show/#{@admin_user.id}", :class => "btn" %>
-<%= link_to 'List all', '../list', :class => "btn" %>
-
-<% if false #@admin_user.info_requests.size == 0 %>
- <% form_tag('../destroy/' + @admin_user.id.to_s) do %>
- <p>
- <%= hidden_field_tag(:admin_user_id, { :value => @admin_user.id } ) %>
- <%= submit_tag "Destroy " + @admin_user.name %> (this is permanent!)
- </p>
- <% end %>
-<% end %>
-
+<%= link_to 'Show', admin_user_show_path(@admin_user), :class => "btn" %>
+<%= link_to 'List all', admin_user_list_path, :class => "btn" %>
diff --git a/app/views/admin_user/list.rhtml b/app/views/admin_user/list.rhtml
index afe166f1f..23f75c159 100644
--- a/app/views/admin_user/list.rhtml
+++ b/app/views/admin_user/list.rhtml
@@ -5,7 +5,7 @@
<% form_tag({}, :method => "get", :class => "form form-search") do %>
<%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query"} %>
<%= submit_tag "Search", :class => "btn" %> (substring search, names and emails)
- <%= link_to 'Banned users', 'banned', :class => "btn btn-info" %>
+ <%= link_to 'Banned users', admin_user_list_banned_path, :class => "btn btn-info" %>
<% end %>
<%= render :partial => 'user_table', :locals => { :users => @admin_users, :banned_column => false } %>
diff --git a/app/views/admin_user/list_banned.rhtml b/app/views/admin_user/list_banned.rhtml
index be2d45399..e535415e6 100644
--- a/app/views/admin_user/list_banned.rhtml
+++ b/app/views/admin_user/list_banned.rhtml
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<p><%= link_to 'List all', 'list' %></p>
+<p><%= link_to 'List all', admin_user_list_path %></p>
<%= render :partial => 'user_table', :locals => { :users => @banned_users, :banned_column => true } %>
diff --git a/app/views/admin_user/show.rhtml b/app/views/admin_user/show.rhtml
index 0b3adb332..279758f03 100644
--- a/app/views/admin_user/show.rhtml
+++ b/app/views/admin_user/show.rhtml
@@ -4,13 +4,12 @@
<% if @admin_user.profile_photo %>
<div class="user_photo_on_admin">
- <% form_tag "../clear_profile_photo/#{@admin_user.id}", :multipart => true, :class => "form" do %>
+ <% form_tag admin_clear_profile_photo_path(@admin_user), :multipart => true, :class => "form" do %>
<img src="<%= get_profile_photo_url(:url_name => @admin_user.url_name) %>">
<br>
<%= submit_tag "Clear photo", :class => "btn btn-info" %>
<% end %>
</div>
-
<% end %>
<table class="table table-striped table-condensed">
@@ -39,7 +38,7 @@
<%=h admin_value(value)%>
<% end %>
<% if column_name == 'email_bounced_at' && !@admin_user.email_bounced_at.nil? %>
- <% form_tag "../clear_bounce/#{@admin_user.id}", :class => "form form-inline" do %>
+ <% form_tag admin_user_clear_bounce_path(@admin_user), :class => "form form-inline" do %>
<input type="submit" name="action" value="Clear bounce" class="btn btn-info">
<% end %>
<% end %>
@@ -50,9 +49,9 @@
</table>
-<%= link_to 'Edit', '../edit/' + @admin_user.id.to_s, :class => "btn btn-primary" %>
+<%= link_to 'Edit', admin_user_edit_path(@admin_user), :class => "btn btn-primary" %>
<%= link_to 'Public page', user_path(@admin_user), :class => "btn" %>
-<%= link_to "Log in as #{@admin_user.name} (also confirms their email)", "../login_as/#{@admin_user.id}", :class => "btn btn-info" %>
+<%= link_to "Log in as #{@admin_user.name} (also confirms their email)", admin_user_login_as_path(@admin_user), :class => "btn btn-info" %>
<hr>
diff --git a/app/views/user/_signup.rhtml b/app/views/user/_signup.rhtml
index 913423ffa..89ab19b7e 100644
--- a/app/views/user/_signup.rhtml
+++ b/app/views/user/_signup.rhtml
@@ -16,7 +16,7 @@
<p>
<label class="form_label" for="user_signup_name"> <%= _('Your name:')%></label>
- <%= text_field 'user_signup', 'name', { :size => 20, :tabindex => 70 } %>
+ <%= text_field 'user_signup', 'name', { :size => 20, :tabindex => 70, :autocomplete => "off" } %>
</p>
<div class="form_item_note">
<%= raw(_('Your <strong>name will appear publicly</strong>
@@ -28,12 +28,12 @@
<p>
<label class="form_label" for="user_signup_password"> <%= _('Password:')%></label>
- <%= password_field 'user_signup', 'password', { :size => 15, :tabindex => 80 } %>
+ <%= password_field 'user_signup', 'password', { :size => 15, :tabindex => 80, :autocomplete => "off" } %>
</p>
<p>
<label class="form_label" for="user_signup_password_confirmation"> <%= _('Password: (again)')%></label>
- <%= password_field 'user_signup', 'password_confirmation', { :size => 15, :tabindex => 90 } %>
+ <%= password_field 'user_signup', 'password_confirmation', { :size => 15, :tabindex => 90, :autocomplete => "off" } %>
</p>
<% if @request_from_foreign_country %>
diff --git a/config/routes.rb b/config/routes.rb
index 159a0eb60..ee7ebdcac 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -171,10 +171,10 @@ ActionController::Routing::Routes.draw do |map|
body.admin_body_index '/admin/body', :action => 'index'
body.admin_body_list '/admin/body/list', :action => 'list'
body.admin_body_show '/admin/body/show/:id', :action => 'show'
- body.admin_body_new '/admin/body/new/:id', :action => 'new'
+ body.admin_body_new '/admin/body/new', :action => 'new'
body.admin_body_edit '/admin/body/edit/:id', :action => 'edit'
body.admin_body_update '/admin/body/update/:id', :action => 'update'
- body.admin_body_create '/admin/body/create/:id', :action => 'create'
+ body.admin_body_create '/admin/body/create', :action => 'create'
body.admin_body_destroy '/admin/body/destroy/:id', :action => 'destroy'
body.admin_body_import_csv '/admin/body/import_csv', :action => 'import_csv'
body.admin_body_mass_tag_add '/admin/body/mass_tag_add', :action => 'mass_tag_add'
@@ -197,11 +197,11 @@ ActionController::Routing::Routes.draw do |map|
admin.admin_request_update '/admin/request/update/:id', :action => 'update'
admin.admin_request_destroy '/admin/request/destroy/:id', :action => 'fully_destroy'
admin.admin_request_edit_outgoing '/admin/request/edit_outgoing/:id', :action => 'edit_outgoing'
- admin.admin_request_destroy_outgoing '/admin/request/destroy_outgoing/:id', :action => 'destroy_outgoing'
+ admin.admin_request_destroy_outgoing '/admin/request/destroy_outgoing', :action => 'destroy_outgoing'
admin.admin_request_update_outgoing '/admin/request/update_outgoing/:id', :action => 'update_outgoing'
admin.admin_request_edit_comment '/admin/request/edit_comment/:id', :action => 'edit_comment'
admin.admin_request_update_comment '/admin/request/update_comment/:id', :action => 'update_comment'
- admin.admin_request_destroy_incoming '/admin/request/destroy_incoming/:id', :action => 'destroy_incoming'
+ admin.admin_request_destroy_incoming '/admin/request/destroy_incoming', :action => 'destroy_incoming'
admin.admin_request_redeliver_incoming '/admin/request/redeliver_incoming', :action => 'redeliver_incoming'
admin.admin_request_move_request '/admin/request/move_request', :action => 'move_request'
admin.admin_request_generate_upload_url '/admin/request/generate_upload_url/:id', :action => 'generate_upload_url'
diff --git a/db/.gitignore b/db/.gitignore
index f3aee50a1..846a7b9b3 100644
--- a/db/.gitignore
+++ b/db/.gitignore
@@ -1,2 +1 @@
schema.rb
-development_structure.sql
diff --git a/db/development_structure.sql b/db/development_structure.sql
new file mode 100644
index 000000000..bd4870948
--- /dev/null
+++ b/db/development_structure.sql
@@ -0,0 +1,2095 @@
+--
+-- PostgreSQL database dump
+--
+
+SET statement_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = on;
+SET check_function_bodies = false;
+SET client_min_messages = warning;
+
+--
+-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
+--
+
+CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
+
+
+--
+-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
+--
+
+COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
+
+
+SET search_path = public, pg_catalog;
+
+SET default_tablespace = '';
+
+SET default_with_oids = false;
+
+--
+-- Name: acts_as_xapian_jobs; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE acts_as_xapian_jobs (
+ id integer NOT NULL,
+ model character varying(255) NOT NULL,
+ model_id integer NOT NULL,
+ action character varying(255) NOT NULL
+);
+
+
+--
+-- Name: acts_as_xapian_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE acts_as_xapian_jobs_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: acts_as_xapian_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE acts_as_xapian_jobs_id_seq OWNED BY acts_as_xapian_jobs.id;
+
+
+--
+-- Name: censor_rules; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE censor_rules (
+ id integer NOT NULL,
+ info_request_id integer,
+ user_id integer,
+ public_body_id integer,
+ text text NOT NULL,
+ replacement text NOT NULL,
+ last_edit_editor character varying(255) NOT NULL,
+ last_edit_comment text NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ regexp boolean
+);
+
+
+--
+-- Name: censor_rules_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE censor_rules_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: censor_rules_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE censor_rules_id_seq OWNED BY censor_rules.id;
+
+
+--
+-- Name: comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE comments (
+ id integer NOT NULL,
+ user_id integer NOT NULL,
+ comment_type character varying(255) DEFAULT 'internal_error'::character varying NOT NULL,
+ info_request_id integer,
+ body text NOT NULL,
+ visible boolean DEFAULT true NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ locale text DEFAULT ''::text NOT NULL
+);
+
+
+--
+-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE comments_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE comments_id_seq OWNED BY comments.id;
+
+
+--
+-- Name: mail_server_log_dones; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE mail_server_log_dones (
+ id integer NOT NULL,
+ filename text NOT NULL,
+ last_stat timestamp without time zone NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: exim_log_dones_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE exim_log_dones_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: exim_log_dones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE exim_log_dones_id_seq OWNED BY mail_server_log_dones.id;
+
+
+--
+-- Name: mail_server_logs; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE mail_server_logs (
+ id integer NOT NULL,
+ mail_server_log_done_id integer,
+ info_request_id integer,
+ "order" integer NOT NULL,
+ line text NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: exim_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE exim_logs_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: exim_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE exim_logs_id_seq OWNED BY mail_server_logs.id;
+
+
+--
+-- Name: foi_attachments; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE foi_attachments (
+ id integer NOT NULL,
+ content_type text,
+ filename text,
+ charset text,
+ display_size text,
+ url_part_number integer,
+ within_rfc822_subject text,
+ incoming_message_id integer,
+ hexdigest character varying(32)
+);
+
+
+--
+-- Name: foi_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE foi_attachments_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: foi_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE foi_attachments_id_seq OWNED BY foi_attachments.id;
+
+
+--
+-- Name: has_tag_string_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE has_tag_string_tags (
+ id integer NOT NULL,
+ model_id integer NOT NULL,
+ name text NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ value text,
+ model character varying(255) NOT NULL
+);
+
+
+--
+-- Name: holidays; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE holidays (
+ id integer NOT NULL,
+ day date,
+ description text
+);
+
+
+--
+-- Name: holidays_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE holidays_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: holidays_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE holidays_id_seq OWNED BY holidays.id;
+
+
+--
+-- Name: incoming_messages; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE incoming_messages (
+ id integer NOT NULL,
+ info_request_id integer NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone 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 timestamp without time zone,
+ mail_from text,
+ sent_at timestamp without time zone
+);
+
+
+--
+-- Name: incoming_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE incoming_messages_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: incoming_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE incoming_messages_id_seq OWNED BY incoming_messages.id;
+
+
+--
+-- Name: info_request_events; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE info_request_events (
+ id integer NOT NULL,
+ info_request_id integer NOT NULL,
+ event_type text NOT NULL,
+ params_yaml text NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ described_state character varying(255),
+ calculated_state character varying(255) DEFAULT NULL::character varying,
+ last_described_at timestamp without time zone,
+ incoming_message_id integer,
+ outgoing_message_id integer,
+ comment_id integer,
+ prominence character varying(255) DEFAULT 'normal'::character varying NOT NULL
+);
+
+
+--
+-- Name: info_request_events_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE info_request_events_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: info_request_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE info_request_events_id_seq OWNED BY info_request_events.id;
+
+
+--
+-- Name: info_requests; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE info_requests (
+ id integer NOT NULL,
+ title text NOT NULL,
+ user_id integer,
+ public_body_id integer NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ described_state character varying(255) NOT NULL,
+ awaiting_description boolean DEFAULT false NOT NULL,
+ prominence character varying(255) DEFAULT 'normal'::character varying NOT NULL,
+ url_title text NOT NULL,
+ law_used character varying(255) DEFAULT 'foi'::character varying NOT NULL,
+ allow_new_responses_from character varying(255) DEFAULT 'anybody'::character varying NOT NULL,
+ handle_rejected_responses character varying(255) DEFAULT 'bounce'::character varying NOT NULL,
+ idhash character varying(255) NOT NULL,
+ external_user_name character varying(255),
+ external_url character varying(255),
+ attention_requested boolean DEFAULT false,
+ comments_allowed boolean DEFAULT true NOT NULL,
+ CONSTRAINT info_requests_external_ck CHECK ((((user_id IS NULL) = (external_url IS NOT NULL)) AND ((external_url IS NOT NULL) OR (external_user_name IS NULL))))
+);
+
+
+--
+-- Name: info_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE info_requests_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: info_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE info_requests_id_seq OWNED BY info_requests.id;
+
+
+--
+-- Name: outgoing_messages; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE outgoing_messages (
+ id integer NOT NULL,
+ info_request_id integer NOT NULL,
+ body text NOT NULL,
+ status character varying(255) NOT NULL,
+ message_type character varying(255) NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ last_sent_at timestamp without time zone,
+ incoming_message_followup_id integer,
+ what_doing character varying(255) NOT NULL
+);
+
+
+--
+-- Name: outgoing_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE outgoing_messages_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: outgoing_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE outgoing_messages_id_seq OWNED BY outgoing_messages.id;
+
+
+--
+-- Name: post_redirects; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE post_redirects (
+ id integer NOT NULL,
+ token text NOT NULL,
+ uri text NOT NULL,
+ post_params_yaml text,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ email_token text NOT NULL,
+ reason_params_yaml text,
+ user_id integer,
+ circumstance text DEFAULT 'normal'::text NOT NULL
+);
+
+
+--
+-- Name: post_redirects_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE post_redirects_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: post_redirects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE post_redirects_id_seq OWNED BY post_redirects.id;
+
+
+--
+-- Name: profile_photos; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE profile_photos (
+ id integer NOT NULL,
+ data bytea NOT NULL,
+ user_id integer,
+ draft boolean DEFAULT false NOT NULL
+);
+
+
+--
+-- Name: profile_photos_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE profile_photos_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: profile_photos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE profile_photos_id_seq OWNED BY profile_photos.id;
+
+
+--
+-- Name: public_bodies; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE public_bodies (
+ id integer NOT NULL,
+ name text NOT NULL,
+ short_name text NOT NULL,
+ request_email text NOT NULL,
+ version integer NOT NULL,
+ last_edit_editor character varying(255) NOT NULL,
+ last_edit_comment text NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ url_name text NOT NULL,
+ home_page text DEFAULT ''::text NOT NULL,
+ notes text DEFAULT ''::text NOT NULL,
+ first_letter character varying(255) NOT NULL,
+ publication_scheme text DEFAULT ''::text NOT NULL,
+ api_key character varying(255) NOT NULL,
+ info_requests_count integer DEFAULT 0 NOT NULL,
+ disclosure_log text DEFAULT ''::text NOT NULL
+);
+
+
+--
+-- Name: public_bodies_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public_bodies_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: public_bodies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public_bodies_id_seq OWNED BY public_bodies.id;
+
+
+--
+-- Name: public_body_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public_body_tags_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: public_body_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public_body_tags_id_seq OWNED BY has_tag_string_tags.id;
+
+
+--
+-- Name: public_body_translations; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE public_body_translations (
+ id integer NOT NULL,
+ public_body_id integer,
+ locale character varying(255),
+ short_name text,
+ publication_scheme text,
+ url_name text,
+ first_letter character varying(255),
+ notes text,
+ name text,
+ request_email text,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ disclosure_log text
+);
+
+
+--
+-- Name: public_body_translations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public_body_translations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: public_body_translations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public_body_translations_id_seq OWNED BY public_body_translations.id;
+
+
+--
+-- Name: public_body_versions; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE public_body_versions (
+ id integer NOT NULL,
+ public_body_id integer,
+ version integer,
+ name text,
+ short_name text,
+ request_email text,
+ updated_at timestamp without time zone,
+ last_edit_editor character varying(255),
+ last_edit_comment text,
+ url_name text,
+ home_page text,
+ notes text,
+ publication_scheme text DEFAULT ''::text NOT NULL,
+ charity_number text DEFAULT ''::text NOT NULL,
+ disclosure_log text DEFAULT ''::text NOT NULL
+);
+
+
+--
+-- Name: public_body_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public_body_versions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: public_body_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public_body_versions_id_seq OWNED BY public_body_versions.id;
+
+
+--
+-- Name: purge_requests; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE purge_requests (
+ id integer NOT NULL,
+ url character varying(255),
+ created_at timestamp without time zone NOT NULL,
+ model character varying(255) NOT NULL,
+ model_id integer NOT NULL
+);
+
+
+--
+-- Name: purge_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE purge_requests_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: purge_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE purge_requests_id_seq OWNED BY purge_requests.id;
+
+
+--
+-- Name: raw_emails; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE raw_emails (
+ id integer NOT NULL
+);
+
+
+--
+-- Name: raw_emails_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE raw_emails_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: raw_emails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE raw_emails_id_seq OWNED BY raw_emails.id;
+
+
+--
+-- Name: request_classifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE request_classifications (
+ id integer NOT NULL,
+ user_id integer,
+ info_request_event_id integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: request_classifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE request_classifications_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: request_classifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE request_classifications_id_seq OWNED BY request_classifications.id;
+
+
+--
+-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE schema_migrations (
+ version character varying(255) NOT NULL
+);
+
+
+--
+-- Name: track_things; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE track_things (
+ id integer NOT NULL,
+ tracking_user_id integer NOT NULL,
+ track_query character varying(255) NOT NULL,
+ info_request_id integer,
+ tracked_user_id integer,
+ public_body_id integer,
+ track_medium character varying(255) NOT NULL,
+ track_type character varying(255) DEFAULT 'internal_error'::character varying NOT NULL,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: track_things_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE track_things_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: track_things_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE track_things_id_seq OWNED BY track_things.id;
+
+
+--
+-- Name: track_things_sent_emails; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE track_things_sent_emails (
+ id integer NOT NULL,
+ track_thing_id integer NOT NULL,
+ info_request_event_id integer,
+ user_id integer,
+ public_body_id integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: track_things_sent_emails_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE track_things_sent_emails_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: track_things_sent_emails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE track_things_sent_emails_id_seq OWNED BY track_things_sent_emails.id;
+
+
+--
+-- Name: user_info_request_sent_alerts; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE user_info_request_sent_alerts (
+ id integer NOT NULL,
+ user_id integer NOT NULL,
+ info_request_id integer NOT NULL,
+ alert_type character varying(255) NOT NULL,
+ info_request_event_id integer
+);
+
+
+--
+-- Name: user_info_request_sent_alerts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE user_info_request_sent_alerts_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: user_info_request_sent_alerts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE user_info_request_sent_alerts_id_seq OWNED BY user_info_request_sent_alerts.id;
+
+
+--
+-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE TABLE users (
+ id integer NOT NULL,
+ email character varying(255) NOT NULL,
+ name character varying(255) NOT NULL,
+ hashed_password character varying(255) NOT NULL,
+ salt character varying(255) NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ email_confirmed boolean DEFAULT false NOT NULL,
+ url_name text NOT NULL,
+ last_daily_track_email timestamp without time zone DEFAULT '2000-01-01 00:00:00'::timestamp without time zone,
+ admin_level character varying(255) DEFAULT 'none'::character varying NOT NULL,
+ ban_text text DEFAULT ''::text NOT NULL,
+ about_me text DEFAULT ''::text NOT NULL,
+ locale character varying(255),
+ email_bounced_at timestamp without time zone,
+ email_bounce_message text DEFAULT ''::text NOT NULL,
+ no_limit boolean DEFAULT false NOT NULL,
+ receive_email_alerts boolean DEFAULT true NOT NULL
+);
+
+
+--
+-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE users_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE users_id_seq OWNED BY users.id;
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY acts_as_xapian_jobs ALTER COLUMN id SET DEFAULT nextval('acts_as_xapian_jobs_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY censor_rules ALTER COLUMN id SET DEFAULT nextval('censor_rules_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY foi_attachments ALTER COLUMN id SET DEFAULT nextval('foi_attachments_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY has_tag_string_tags ALTER COLUMN id SET DEFAULT nextval('public_body_tags_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY holidays ALTER COLUMN id SET DEFAULT nextval('holidays_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY incoming_messages ALTER COLUMN id SET DEFAULT nextval('incoming_messages_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY info_request_events ALTER COLUMN id SET DEFAULT nextval('info_request_events_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY info_requests ALTER COLUMN id SET DEFAULT nextval('info_requests_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY mail_server_log_dones ALTER COLUMN id SET DEFAULT nextval('exim_log_dones_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY mail_server_logs ALTER COLUMN id SET DEFAULT nextval('exim_logs_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY outgoing_messages ALTER COLUMN id SET DEFAULT nextval('outgoing_messages_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY post_redirects ALTER COLUMN id SET DEFAULT nextval('post_redirects_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY profile_photos ALTER COLUMN id SET DEFAULT nextval('profile_photos_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public_bodies ALTER COLUMN id SET DEFAULT nextval('public_bodies_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public_body_translations ALTER COLUMN id SET DEFAULT nextval('public_body_translations_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public_body_versions ALTER COLUMN id SET DEFAULT nextval('public_body_versions_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY purge_requests ALTER COLUMN id SET DEFAULT nextval('purge_requests_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY raw_emails ALTER COLUMN id SET DEFAULT nextval('raw_emails_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY request_classifications ALTER COLUMN id SET DEFAULT nextval('request_classifications_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY track_things ALTER COLUMN id SET DEFAULT nextval('track_things_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY track_things_sent_emails ALTER COLUMN id SET DEFAULT nextval('track_things_sent_emails_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY user_info_request_sent_alerts ALTER COLUMN id SET DEFAULT nextval('user_info_request_sent_alerts_id_seq'::regclass);
+
+
+--
+-- Name: id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
+
+
+--
+-- Name: acts_as_xapian_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY acts_as_xapian_jobs
+ ADD CONSTRAINT acts_as_xapian_jobs_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: censor_rules_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY censor_rules
+ ADD CONSTRAINT censor_rules_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY comments
+ ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: exim_log_dones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY mail_server_log_dones
+ ADD CONSTRAINT exim_log_dones_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: exim_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY mail_server_logs
+ ADD CONSTRAINT exim_logs_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: foi_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY foi_attachments
+ ADD CONSTRAINT foi_attachments_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: holidays_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY holidays
+ ADD CONSTRAINT holidays_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: incoming_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY incoming_messages
+ ADD CONSTRAINT incoming_messages_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: info_request_events_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY info_request_events
+ ADD CONSTRAINT info_request_events_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: info_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY info_requests
+ ADD CONSTRAINT info_requests_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: outgoing_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY outgoing_messages
+ ADD CONSTRAINT outgoing_messages_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: post_redirects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY post_redirects
+ ADD CONSTRAINT post_redirects_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: profile_photos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY profile_photos
+ ADD CONSTRAINT profile_photos_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: public_bodies_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY public_bodies
+ ADD CONSTRAINT public_bodies_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: public_body_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY has_tag_string_tags
+ ADD CONSTRAINT public_body_tags_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: public_body_translations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY public_body_translations
+ ADD CONSTRAINT public_body_translations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: public_body_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY public_body_versions
+ ADD CONSTRAINT public_body_versions_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: purge_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY purge_requests
+ ADD CONSTRAINT purge_requests_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: raw_emails_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY raw_emails
+ ADD CONSTRAINT raw_emails_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: request_classifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY request_classifications
+ ADD CONSTRAINT request_classifications_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: track_things_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY track_things
+ ADD CONSTRAINT track_things_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: track_things_sent_emails_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY track_things_sent_emails
+ ADD CONSTRAINT track_things_sent_emails_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: user_info_request_sent_alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY user_info_request_sent_alerts
+ ADD CONSTRAINT user_info_request_sent_alerts_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY users
+ ADD CONSTRAINT users_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: by_model_and_model_id_and_name_and_value; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX by_model_and_model_id_and_name_and_value ON has_tag_string_tags USING btree (model, model_id, name, value);
+
+
+--
+-- Name: index_acts_as_xapian_jobs_on_model_and_model_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE UNIQUE INDEX index_acts_as_xapian_jobs_on_model_and_model_id ON acts_as_xapian_jobs USING btree (model, model_id);
+
+
+--
+-- Name: index_censor_rules_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_censor_rules_on_info_request_id ON censor_rules USING btree (info_request_id);
+
+
+--
+-- Name: index_censor_rules_on_public_body_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_censor_rules_on_public_body_id ON censor_rules USING btree (public_body_id);
+
+
+--
+-- Name: index_censor_rules_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_censor_rules_on_user_id ON censor_rules USING btree (user_id);
+
+
+--
+-- Name: index_exim_log_dones_on_last_stat; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_exim_log_dones_on_last_stat ON mail_server_log_dones USING btree (last_stat);
+
+
+--
+-- Name: index_exim_logs_on_exim_log_done_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_exim_logs_on_exim_log_done_id ON mail_server_logs USING btree (mail_server_log_done_id);
+
+
+--
+-- Name: index_exim_logs_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_exim_logs_on_info_request_id ON mail_server_logs USING btree (info_request_id);
+
+
+--
+-- Name: index_foi_attachments_on_incoming_message_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_foi_attachments_on_incoming_message_id ON foi_attachments USING btree (incoming_message_id);
+
+
+--
+-- Name: index_has_tag_string_tags_on_model_and_model_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_has_tag_string_tags_on_model_and_model_id ON has_tag_string_tags USING btree (model, model_id);
+
+
+--
+-- Name: index_has_tag_string_tags_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_has_tag_string_tags_on_name ON has_tag_string_tags USING btree (name);
+
+
+--
+-- Name: index_holidays_on_day; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_holidays_on_day ON holidays USING btree (day);
+
+
+--
+-- Name: index_incoming_messages_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_incoming_messages_on_info_request_id ON incoming_messages USING btree (info_request_id);
+
+
+--
+-- Name: index_incoming_messages_on_raw_email_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_incoming_messages_on_raw_email_id ON incoming_messages USING btree (raw_email_id);
+
+
+--
+-- Name: index_info_request_events_on_comment_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_info_request_events_on_comment_id ON info_request_events USING btree (comment_id);
+
+
+--
+-- Name: index_info_request_events_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_info_request_events_on_created_at ON info_request_events USING btree (created_at);
+
+
+--
+-- Name: index_info_request_events_on_incoming_message_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_info_request_events_on_incoming_message_id ON info_request_events USING btree (incoming_message_id);
+
+
+--
+-- Name: index_info_request_events_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_info_request_events_on_info_request_id ON info_request_events USING btree (info_request_id);
+
+
+--
+-- Name: index_info_request_events_on_outgoing_message_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_info_request_events_on_outgoing_message_id ON info_request_events USING btree (outgoing_message_id);
+
+
+--
+-- Name: index_info_requests_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_info_requests_on_created_at ON info_requests USING btree (created_at);
+
+
+--
+-- Name: index_info_requests_on_public_body_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_info_requests_on_public_body_id ON info_requests USING btree (public_body_id);
+
+
+--
+-- Name: index_info_requests_on_title; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_info_requests_on_title ON info_requests USING btree (title);
+
+
+--
+-- Name: index_info_requests_on_url_title; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE UNIQUE INDEX index_info_requests_on_url_title ON info_requests USING btree (url_title);
+
+
+--
+-- Name: index_info_requests_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_info_requests_on_user_id ON info_requests USING btree (user_id);
+
+
+--
+-- Name: index_outgoing_messages_on_incoming_message_followup_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_outgoing_messages_on_incoming_message_followup_id ON outgoing_messages USING btree (incoming_message_followup_id);
+
+
+--
+-- Name: index_outgoing_messages_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_outgoing_messages_on_info_request_id ON outgoing_messages USING btree (info_request_id);
+
+
+--
+-- Name: index_outgoing_messages_on_what_doing; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_outgoing_messages_on_what_doing ON outgoing_messages USING btree (what_doing);
+
+
+--
+-- Name: index_post_redirects_on_email_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_post_redirects_on_email_token ON post_redirects USING btree (email_token);
+
+
+--
+-- Name: index_post_redirects_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_post_redirects_on_token ON post_redirects USING btree (token);
+
+
+--
+-- Name: index_post_redirects_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_post_redirects_on_updated_at ON post_redirects USING btree (updated_at);
+
+
+--
+-- Name: index_post_redirects_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_post_redirects_on_user_id ON post_redirects USING btree (user_id);
+
+
+--
+-- Name: index_public_bodies_on_first_letter; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_public_bodies_on_first_letter ON public_bodies USING btree (first_letter);
+
+
+--
+-- Name: index_public_bodies_on_url_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE UNIQUE INDEX index_public_bodies_on_url_name ON public_bodies USING btree (url_name);
+
+
+--
+-- Name: index_public_body_translations_on_public_body_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_public_body_translations_on_public_body_id ON public_body_translations USING btree (public_body_id);
+
+
+--
+-- Name: index_public_body_versions_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_public_body_versions_on_updated_at ON public_body_versions USING btree (updated_at);
+
+
+--
+-- Name: index_request_classifications_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_request_classifications_on_user_id ON request_classifications USING btree (user_id);
+
+
+--
+-- Name: index_track_things_on_tracking_user_id_and_track_query; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE UNIQUE INDEX index_track_things_on_tracking_user_id_and_track_query ON track_things USING btree (tracking_user_id, track_query);
+
+
+--
+-- Name: index_track_things_sent_emails_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_track_things_sent_emails_on_created_at ON track_things_sent_emails USING btree (created_at);
+
+
+--
+-- Name: index_track_things_sent_emails_on_info_request_event_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_track_things_sent_emails_on_info_request_event_id ON track_things_sent_emails USING btree (info_request_event_id);
+
+
+--
+-- Name: index_track_things_sent_emails_on_track_thing_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_track_things_sent_emails_on_track_thing_id ON track_things_sent_emails USING btree (track_thing_id);
+
+
+--
+-- Name: index_user_info_request_sent_alerts_on_info_request_event_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX index_user_info_request_sent_alerts_on_info_request_event_id ON user_info_request_sent_alerts USING btree (info_request_event_id);
+
+
+--
+-- Name: index_users_on_url_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE UNIQUE INDEX index_users_on_url_name ON users USING btree (url_name);
+
+
+--
+-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
+
+
+--
+-- Name: user_info_request_sent_alerts_unique_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE UNIQUE INDEX user_info_request_sent_alerts_unique_index ON user_info_request_sent_alerts USING btree (user_id, info_request_id, alert_type, (COALESCE(info_request_event_id, (-1))));
+
+
+--
+-- Name: users_email_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE UNIQUE INDEX users_email_index ON users USING btree (lower((email)::text));
+
+
+--
+-- Name: users_lower_email_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
+--
+
+CREATE INDEX users_lower_email_index ON users USING btree (lower((email)::text));
+
+
+--
+-- Name: fk_censor_rules_info_request; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY censor_rules
+ ADD CONSTRAINT fk_censor_rules_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id);
+
+
+--
+-- Name: fk_censor_rules_public_body; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY censor_rules
+ ADD CONSTRAINT fk_censor_rules_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id);
+
+
+--
+-- Name: fk_censor_rules_user; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY censor_rules
+ ADD CONSTRAINT fk_censor_rules_user FOREIGN KEY (user_id) REFERENCES users(id);
+
+
+--
+-- Name: fk_comments_info_request; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY comments
+ ADD CONSTRAINT fk_comments_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id);
+
+
+--
+-- Name: fk_comments_user; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY comments
+ ADD CONSTRAINT fk_comments_user FOREIGN KEY (user_id) REFERENCES users(id);
+
+
+--
+-- Name: fk_exim_log_done; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY mail_server_logs
+ ADD CONSTRAINT fk_exim_log_done FOREIGN KEY (mail_server_log_done_id) REFERENCES mail_server_log_dones(id);
+
+
+--
+-- Name: fk_exim_log_info_request; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY mail_server_logs
+ ADD CONSTRAINT fk_exim_log_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id);
+
+
+--
+-- Name: fk_incoming_message_followup_info_request; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY outgoing_messages
+ ADD CONSTRAINT fk_incoming_message_followup_info_request FOREIGN KEY (incoming_message_followup_id) REFERENCES incoming_messages(id);
+
+
+--
+-- Name: fk_incoming_messages_info_request; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY incoming_messages
+ ADD CONSTRAINT fk_incoming_messages_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id);
+
+
+--
+-- Name: fk_incoming_messages_raw_email; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY incoming_messages
+ ADD CONSTRAINT fk_incoming_messages_raw_email FOREIGN KEY (raw_email_id) REFERENCES raw_emails(id);
+
+
+--
+-- Name: fk_info_request_events_comment_id; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY info_request_events
+ ADD CONSTRAINT fk_info_request_events_comment_id FOREIGN KEY (comment_id) REFERENCES comments(id);
+
+
+--
+-- Name: fk_info_request_events_incoming_message_id; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY info_request_events
+ ADD CONSTRAINT fk_info_request_events_incoming_message_id FOREIGN KEY (incoming_message_id) REFERENCES incoming_messages(id);
+
+
+--
+-- Name: fk_info_request_events_info_request; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY info_request_events
+ ADD CONSTRAINT fk_info_request_events_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id);
+
+
+--
+-- Name: fk_info_request_events_outgoing_message_id; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY info_request_events
+ ADD CONSTRAINT fk_info_request_events_outgoing_message_id FOREIGN KEY (outgoing_message_id) REFERENCES outgoing_messages(id);
+
+
+--
+-- Name: fk_info_request_sent_alerts_info_request; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY user_info_request_sent_alerts
+ ADD CONSTRAINT fk_info_request_sent_alerts_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id);
+
+
+--
+-- Name: fk_info_request_sent_alerts_user; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY user_info_request_sent_alerts
+ ADD CONSTRAINT fk_info_request_sent_alerts_user FOREIGN KEY (user_id) REFERENCES users(id);
+
+
+--
+-- Name: fk_info_requests_public_body; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY info_requests
+ ADD CONSTRAINT fk_info_requests_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id);
+
+
+--
+-- Name: fk_info_requests_user; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY info_requests
+ ADD CONSTRAINT fk_info_requests_user FOREIGN KEY (user_id) REFERENCES users(id);
+
+
+--
+-- Name: fk_outgoing_messages_info_request; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY outgoing_messages
+ ADD CONSTRAINT fk_outgoing_messages_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id);
+
+
+--
+-- Name: fk_post_redirects_user; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY post_redirects
+ ADD CONSTRAINT fk_post_redirects_user FOREIGN KEY (user_id) REFERENCES users(id);
+
+
+--
+-- Name: fk_profile_photos_user; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY profile_photos
+ ADD CONSTRAINT fk_profile_photos_user FOREIGN KEY (user_id) REFERENCES users(id);
+
+
+--
+-- Name: fk_public_body_versions_public_body; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public_body_versions
+ ADD CONSTRAINT fk_public_body_versions_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id);
+
+
+--
+-- Name: fk_track_request_info_request; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY track_things
+ ADD CONSTRAINT fk_track_request_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id);
+
+
+--
+-- Name: fk_track_request_info_request_event; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY track_things_sent_emails
+ ADD CONSTRAINT fk_track_request_info_request_event FOREIGN KEY (info_request_event_id) REFERENCES info_request_events(id);
+
+
+--
+-- Name: fk_track_request_public_body; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY track_things
+ ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id);
+
+
+--
+-- Name: fk_track_request_public_body; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY track_things_sent_emails
+ ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (user_id) REFERENCES users(id);
+
+
+--
+-- Name: fk_track_request_tracked_user; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY track_things
+ ADD CONSTRAINT fk_track_request_tracked_user FOREIGN KEY (tracked_user_id) REFERENCES users(id);
+
+
+--
+-- Name: fk_track_request_tracking_user; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY track_things
+ ADD CONSTRAINT fk_track_request_tracking_user FOREIGN KEY (tracking_user_id) REFERENCES users(id);
+
+
+--
+-- Name: fk_track_request_user; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY track_things_sent_emails
+ ADD CONSTRAINT fk_track_request_user FOREIGN KEY (user_id) REFERENCES users(id);
+
+
+--
+-- Name: fk_user_info_request_sent_alert_info_request_event; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY user_info_request_sent_alerts
+ ADD CONSTRAINT fk_user_info_request_sent_alert_info_request_event FOREIGN KEY (info_request_event_id) REFERENCES info_request_events(id);
+
+
+--
+-- PostgreSQL database dump complete
+--
+
+INSERT INTO schema_migrations (version) VALUES ('1');
+
+INSERT INTO schema_migrations (version) VALUES ('2');
+
+INSERT INTO schema_migrations (version) VALUES ('4');
+
+INSERT INTO schema_migrations (version) VALUES ('5');
+
+INSERT INTO schema_migrations (version) VALUES ('6');
+
+INSERT INTO schema_migrations (version) VALUES ('7');
+
+INSERT INTO schema_migrations (version) VALUES ('8');
+
+INSERT INTO schema_migrations (version) VALUES ('9');
+
+INSERT INTO schema_migrations (version) VALUES ('10');
+
+INSERT INTO schema_migrations (version) VALUES ('11');
+
+INSERT INTO schema_migrations (version) VALUES ('12');
+
+INSERT INTO schema_migrations (version) VALUES ('13');
+
+INSERT INTO schema_migrations (version) VALUES ('14');
+
+INSERT INTO schema_migrations (version) VALUES ('15');
+
+INSERT INTO schema_migrations (version) VALUES ('16');
+
+INSERT INTO schema_migrations (version) VALUES ('17');
+
+INSERT INTO schema_migrations (version) VALUES ('18');
+
+INSERT INTO schema_migrations (version) VALUES ('21');
+
+INSERT INTO schema_migrations (version) VALUES ('22');
+
+INSERT INTO schema_migrations (version) VALUES ('23');
+
+INSERT INTO schema_migrations (version) VALUES ('24');
+
+INSERT INTO schema_migrations (version) VALUES ('25');
+
+INSERT INTO schema_migrations (version) VALUES ('26');
+
+INSERT INTO schema_migrations (version) VALUES ('27');
+
+INSERT INTO schema_migrations (version) VALUES ('28');
+
+INSERT INTO schema_migrations (version) VALUES ('29');
+
+INSERT INTO schema_migrations (version) VALUES ('30');
+
+INSERT INTO schema_migrations (version) VALUES ('31');
+
+INSERT INTO schema_migrations (version) VALUES ('32');
+
+INSERT INTO schema_migrations (version) VALUES ('33');
+
+INSERT INTO schema_migrations (version) VALUES ('34');
+
+INSERT INTO schema_migrations (version) VALUES ('35');
+
+INSERT INTO schema_migrations (version) VALUES ('36');
+
+INSERT INTO schema_migrations (version) VALUES ('37');
+
+INSERT INTO schema_migrations (version) VALUES ('38');
+
+INSERT INTO schema_migrations (version) VALUES ('39');
+
+INSERT INTO schema_migrations (version) VALUES ('40');
+
+INSERT INTO schema_migrations (version) VALUES ('41');
+
+INSERT INTO schema_migrations (version) VALUES ('42');
+
+INSERT INTO schema_migrations (version) VALUES ('43');
+
+INSERT INTO schema_migrations (version) VALUES ('44');
+
+INSERT INTO schema_migrations (version) VALUES ('45');
+
+INSERT INTO schema_migrations (version) VALUES ('46');
+
+INSERT INTO schema_migrations (version) VALUES ('47');
+
+INSERT INTO schema_migrations (version) VALUES ('48');
+
+INSERT INTO schema_migrations (version) VALUES ('49');
+
+INSERT INTO schema_migrations (version) VALUES ('50');
+
+INSERT INTO schema_migrations (version) VALUES ('51');
+
+INSERT INTO schema_migrations (version) VALUES ('52');
+
+INSERT INTO schema_migrations (version) VALUES ('53');
+
+INSERT INTO schema_migrations (version) VALUES ('54');
+
+INSERT INTO schema_migrations (version) VALUES ('55');
+
+INSERT INTO schema_migrations (version) VALUES ('56');
+
+INSERT INTO schema_migrations (version) VALUES ('57');
+
+INSERT INTO schema_migrations (version) VALUES ('58');
+
+INSERT INTO schema_migrations (version) VALUES ('59');
+
+INSERT INTO schema_migrations (version) VALUES ('60');
+
+INSERT INTO schema_migrations (version) VALUES ('61');
+
+INSERT INTO schema_migrations (version) VALUES ('62');
+
+INSERT INTO schema_migrations (version) VALUES ('63');
+
+INSERT INTO schema_migrations (version) VALUES ('64');
+
+INSERT INTO schema_migrations (version) VALUES ('65');
+
+INSERT INTO schema_migrations (version) VALUES ('66');
+
+INSERT INTO schema_migrations (version) VALUES ('67');
+
+INSERT INTO schema_migrations (version) VALUES ('68');
+
+INSERT INTO schema_migrations (version) VALUES ('69');
+
+INSERT INTO schema_migrations (version) VALUES ('70');
+
+INSERT INTO schema_migrations (version) VALUES ('71');
+
+INSERT INTO schema_migrations (version) VALUES ('72');
+
+INSERT INTO schema_migrations (version) VALUES ('73');
+
+INSERT INTO schema_migrations (version) VALUES ('74');
+
+INSERT INTO schema_migrations (version) VALUES ('75');
+
+INSERT INTO schema_migrations (version) VALUES ('76');
+
+INSERT INTO schema_migrations (version) VALUES ('77');
+
+INSERT INTO schema_migrations (version) VALUES ('78');
+
+INSERT INTO schema_migrations (version) VALUES ('79');
+
+INSERT INTO schema_migrations (version) VALUES ('80');
+
+INSERT INTO schema_migrations (version) VALUES ('81');
+
+INSERT INTO schema_migrations (version) VALUES ('82');
+
+INSERT INTO schema_migrations (version) VALUES ('83');
+
+INSERT INTO schema_migrations (version) VALUES ('84');
+
+INSERT INTO schema_migrations (version) VALUES ('85');
+
+INSERT INTO schema_migrations (version) VALUES ('86');
+
+INSERT INTO schema_migrations (version) VALUES ('87');
+
+INSERT INTO schema_migrations (version) VALUES ('88');
+
+INSERT INTO schema_migrations (version) VALUES ('89');
+
+INSERT INTO schema_migrations (version) VALUES ('90');
+
+INSERT INTO schema_migrations (version) VALUES ('91');
+
+INSERT INTO schema_migrations (version) VALUES ('92');
+
+INSERT INTO schema_migrations (version) VALUES ('93');
+
+INSERT INTO schema_migrations (version) VALUES ('94');
+
+INSERT INTO schema_migrations (version) VALUES ('95');
+
+INSERT INTO schema_migrations (version) VALUES ('96');
+
+INSERT INTO schema_migrations (version) VALUES ('97');
+
+INSERT INTO schema_migrations (version) VALUES ('98');
+
+INSERT INTO schema_migrations (version) VALUES ('99');
+
+INSERT INTO schema_migrations (version) VALUES ('100');
+
+INSERT INTO schema_migrations (version) VALUES ('101');
+
+INSERT INTO schema_migrations (version) VALUES ('102');
+
+INSERT INTO schema_migrations (version) VALUES ('103');
+
+INSERT INTO schema_migrations (version) VALUES ('104');
+
+INSERT INTO schema_migrations (version) VALUES ('105');
+
+INSERT INTO schema_migrations (version) VALUES ('106');
+
+INSERT INTO schema_migrations (version) VALUES ('107');
+
+INSERT INTO schema_migrations (version) VALUES ('108');
+
+INSERT INTO schema_migrations (version) VALUES ('109');
+
+INSERT INTO schema_migrations (version) VALUES ('110');
+
+INSERT INTO schema_migrations (version) VALUES ('111');
+
+INSERT INTO schema_migrations (version) VALUES ('112');
+
+INSERT INTO schema_migrations (version) VALUES ('113');
+
+INSERT INTO schema_migrations (version) VALUES ('114');
+
+INSERT INTO schema_migrations (version) VALUES ('115');
+
+INSERT INTO schema_migrations (version) VALUES ('116');
+
+INSERT INTO schema_migrations (version) VALUES ('117');
+
+INSERT INTO schema_migrations (version) VALUES ('118');
+
+INSERT INTO schema_migrations (version) VALUES ('20120822145640');
+
+INSERT INTO schema_migrations (version) VALUES ('20120910153022');
+
+INSERT INTO schema_migrations (version) VALUES ('20120912111713');
+
+INSERT INTO schema_migrations (version) VALUES ('20120912112036');
+
+INSERT INTO schema_migrations (version) VALUES ('20120912112312');
+
+INSERT INTO schema_migrations (version) VALUES ('20120912112655');
+
+INSERT INTO schema_migrations (version) VALUES ('20120912113004');
+
+INSERT INTO schema_migrations (version) VALUES ('20120912113720');
+
+INSERT INTO schema_migrations (version) VALUES ('20120912114022');
+
+INSERT INTO schema_migrations (version) VALUES ('20120912170035');
+
+INSERT INTO schema_migrations (version) VALUES ('20120913074940');
+
+INSERT INTO schema_migrations (version) VALUES ('20120913080807');
+
+INSERT INTO schema_migrations (version) VALUES ('20120913081136');
+
+INSERT INTO schema_migrations (version) VALUES ('20120913135745');
+
+INSERT INTO schema_migrations (version) VALUES ('20120919140404');
+
+INSERT INTO schema_migrations (version) VALUES ('20121010214348');
+
+INSERT INTO schema_migrations (version) VALUES ('20121022031914'); \ No newline at end of file
diff --git a/spec/fixtures/info_request_events.yml b/spec/fixtures/info_request_events.yml
index c1a00ad47..3907703d8 100644
--- a/spec/fixtures/info_request_events.yml
+++ b/spec/fixtures/info_request_events.yml
@@ -171,3 +171,14 @@ anonymous_external_outgoing_message_event:
created_at: 2009-01-03 02:23:45.6789100
described_state: waiting_response
calculated_state: waiting_response
+
+other_request_outgoing_message_event:
+ id: 916
+ params_yaml: "--- \n\
+ :outgoing_message_id: 10\n"
+ outgoing_message_id: 10
+ info_request_id: 111
+ event_type: sent
+ created_at: <%= Time.now %>
+ described_state: waiting_response
+ calculated_state: waiting_response
diff --git a/spec/fixtures/info_requests.yml b/spec/fixtures/info_requests.yml
index 9361ec486..97effd036 100644
--- a/spec/fixtures/info_requests.yml
+++ b/spec/fixtures/info_requests.yml
@@ -107,3 +107,15 @@ anonymous_external_request:
awaiting_description: false
comments_allowed: true
idhash: 7654321a
+other_request:
+ id: 111
+ title: Another request
+ url_title: another_request
+ created_at: 2010-01-01 02:23:45.6789100
+ updated_at: 2010-01-01 02:23:45.6789100
+ public_body_id: 7
+ user_id: 6
+ described_state: waiting_response
+ awaiting_description: false
+ comments_allowed: true
+ idhash: b234567
diff --git a/spec/fixtures/outgoing_messages.yml b/spec/fixtures/outgoing_messages.yml
index 55df8473e..c71ee08bf 100644
--- a/spec/fixtures/outgoing_messages.yml
+++ b/spec/fixtures/outgoing_messages.yml
@@ -108,3 +108,14 @@ anonymous_external_outgoing_message:
updated_at: 2009-01-12 01:56:58.586598
what_doing: normal_sort
+other_outgoing_message:
+ id: 10
+ info_request_id: 111
+ message_type: initial_request
+ status: sent
+ body: "Just another request"
+ last_sent_at: <%= Time.now %>
+ created_at: 2009-01-12 01:56:58.586598
+ updated_at: 2009-01-12 01:56:58.586598
+ what_doing: normal_sort
+
diff --git a/spec/fixtures/public_bodies.yml b/spec/fixtures/public_bodies.yml
index 615c4bcb6..65cba4b28 100644
--- a/spec/fixtures/public_bodies.yml
+++ b/spec/fixtures/public_bodies.yml
@@ -72,3 +72,18 @@ sensible_walks_public_body:
created_at: 2008-10-25 10:51:01.161639
api_key: 5
info_requests_count: 1
+other_public_body:
+ id: 7
+ version: 1
+ name: 'Another Public Body'
+ first_letter: A
+ request_email: other@localhost
+ short_name: Another Public Body
+ url_name: another_public_body
+ notes: More notes
+ updated_at: 2008-10-25 10:51:01.161639
+ last_edit_comment: Another edit
+ last_edit_editor: louise
+ created_at: 2008-10-25 10:51:01.161639
+ api_key: 6
+ info_requests_count: 0
diff --git a/spec/fixtures/public_body_translations.yml b/spec/fixtures/public_body_translations.yml
index 24b14c470..61e07fb5b 100644
--- a/spec/fixtures/public_body_translations.yml
+++ b/spec/fixtures/public_body_translations.yml
@@ -88,3 +88,16 @@ sensible_walks_en_public_body_translation:
notes: I bet you’ve never heard of it.
publication_scheme: ""
disclosure_log: ""
+
+other_public_body_translation:
+ id: 8
+ public_body_id: 7
+ locale: en
+ name: "Another Public Body"
+ first_letter: A
+ request_email: other@localhost
+ short_name: Another Public Body
+ url_name: another_public_body
+ notes: More notes
+ publication_scheme: ""
+ disclosure_log: ""
diff --git a/spec/fixtures/users.yml b/spec/fixtures/users.yml
index d6391c5e8..c9730d855 100644
--- a/spec/fixtures/users.yml
+++ b/spec/fixtures/users.yml
@@ -1,4 +1,4 @@
-bob_smith_user:
+bob_smith_user:
id: "1"
name: Bob Smith
url_name: bob_smith
@@ -13,7 +13,7 @@ bob_smith_user:
locale: 'en'
about_me: 'I like making requests about fancy dogs and naughty chickens and stuff.'
receive_email_alerts: true
-silly_name_user:
+silly_name_user:
id: "2"
name: "Silly <em>Name</em>"
url_name: silly_emnameem
@@ -28,7 +28,7 @@ silly_name_user:
locale: 'en'
about_me: ''
receive_email_alerts: true
-admin_user:
+admin_user:
id: "3"
name: Joe Admin
url_name: joe_admin
@@ -43,7 +43,7 @@ admin_user:
locale: ''
about_me: ''
receive_email_alerts: true
-unconfirmed_user:
+unconfirmed_user:
id: "4"
name: "Unconfirmed"
url_name: unconfirmed
@@ -71,3 +71,17 @@ robin_user:
ban_text: ''
about_me: 'I am the best'
receive_email_alerts: true
+another_user:
+ id: 6
+ name: Another User
+ url_name: another_user
+ email: another@localhost
+ salt: "-6116981980.392287733335677"
+ hashed_password: 6b7cd45a5f35fd83febc0452a799530398bfb6e8 # jonespassword
+ updated_at: 2012-01-01 10:39:15.491593
+ created_at: 2012-01-01 10:39:15.491593
+ email_confirmed: true
+ admin_level: 'none'
+ ban_text: ''
+ about_me: 'Just another user'
+ receive_email_alerts: true
diff --git a/spec/script/mailin_spec.rb b/spec/script/mailin_spec.rb
index f0bca2297..ac04dcfcf 100644
--- a/spec/script/mailin_spec.rb
+++ b/spec/script/mailin_spec.rb
@@ -5,7 +5,7 @@ def mailin_test(email_filename)
Dir.chdir Rails.root do
xc = ExternalCommand.new("script/mailin")
mail = load_file_fixture(email_filename)
- ir = info_requests(:boring_request)
+ ir = info_requests(:other_request)
mail.gsub!('EMAIL_TO', ir.incoming_email)
mail.gsub!('EMAIL_FROM', 'responder@localhost')
xc.run(mail)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index d63c81208..e05ef75dd 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,3 +1,16 @@
+require 'simplecov'
+require 'coveralls'
+
+# Generate coverage locally in html as well as in coveralls.io
+SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
+ SimpleCov::Formatter::HTMLFormatter,
+ Coveralls::SimpleCov::Formatter
+]
+SimpleCov.start('rails') do
+ add_filter 'commonlib'
+ add_filter 'vendor/plugins'
+end
+
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] = 'test'