aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-07-20 14:58:34 +0100
committerDave Arter <davea@mysociety.org>2016-08-22 10:36:01 +0100
commitbbb067ec5ddc88862be50819076bfe63c744122e (patch)
tree49a3e2fe62f45848495e41394e37c6536b4def44 /db
parentf3649ee94bb80e8b33f0eea8a817760475157b3b (diff)
Add user planned reports.
A user with the appropriate permission can add/remove reports from their list of planned reports using a button on a report page. The list can be viewed at /my/planned.
Diffstat (limited to 'db')
-rw-r--r--db/downgrade_0042---0041.sql1
-rw-r--r--db/schema.sql8
-rw-r--r--db/schema_0042-planned_reports.sql11
3 files changed, 20 insertions, 0 deletions
diff --git a/db/downgrade_0042---0041.sql b/db/downgrade_0042---0041.sql
new file mode 100644
index 000000000..507ab22c4
--- /dev/null
+++ b/db/downgrade_0042---0041.sql
@@ -0,0 +1 @@
+drop table user_planned_reports;
diff --git a/db/schema.sql b/db/schema.sql
index f285922ac..48f0fd07e 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -458,6 +458,14 @@ create table user_body_permissions (
unique(user_id, body_id, permission_type)
);
+create table user_planned_reports (
+ id serial not null primary key,
+ user_id int references users(id) not null,
+ report_id int references problem(id) not null,
+ added timestamp not null default current_timestamp,
+ removed timestamp
+);
+
create table response_templates (
id serial not null primary key,
body_id int references body(id) not null,
diff --git a/db/schema_0042-planned_reports.sql b/db/schema_0042-planned_reports.sql
new file mode 100644
index 000000000..55ad1cc64
--- /dev/null
+++ b/db/schema_0042-planned_reports.sql
@@ -0,0 +1,11 @@
+begin;
+
+create table user_planned_reports (
+ id serial not null primary key,
+ user_id int references users(id) not null,
+ report_id int references problem(id) not null,
+ added timestamp not null default current_timestamp,
+ removed timestamp
+);
+
+commit;