aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rwxr-xr-xdb/rerun_dbic_loader.pl5
-rw-r--r--db/schema.sql10
2 files changed, 8 insertions, 7 deletions
diff --git a/db/rerun_dbic_loader.pl b/db/rerun_dbic_loader.pl
index a21fea301..7c38fae58 100755
--- a/db/rerun_dbic_loader.pl
+++ b/db/rerun_dbic_loader.pl
@@ -3,7 +3,7 @@
use strict;
use warnings;
-# This script inspects the current state of the database and then ammends the
+# This script inspects the current state of the database and then amends the
# FixMyStreet::DB::Result::* files to suit. After running the changes should be
# inspected before the code is commited.
@@ -20,7 +20,6 @@ my @tables_to_ignore = (
'debugdate', #
'flickr_imported', #
'partial_user', #
- 'questionnaire', #
'secret', #
'textmystreet', #
);
@@ -30,7 +29,7 @@ make_schema_at(
'FixMyStreet::DB',
{
debug => 0, # switch on to be chatty
- dump_directory => './lib', # edit files in place
+ dump_directory => './perllib', # edit files in place
exclude => qr{$exclude}, # ignore some tables
generate_pod => 0, # no need for pod
overwrite_modifications => 1, # don't worry that the md5 is wrong
diff --git a/db/schema.sql b/db/schema.sql
index 86a9598c4..9c5b3d8fd 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -262,8 +262,9 @@ create function problem_find_nearby(double precision, double precision, double p
create table comment (
id serial not null primary key,
problem_id integer not null references problem(id),
+ user_id int references users(id) not null,
+ anonymous bool not null,
name text, -- null means anonymous
- email text not null,
website text,
created timestamp not null default ms_current_timestamp(),
confirmed timestamp,
@@ -283,6 +284,7 @@ create table comment (
-- and should be highlighted in the display?
);
+create index comment_user_id_idx on comment(user_id);
create index comment_problem_id_idx on comment(problem_id);
create index comment_problem_id_created_idx on comment(problem_id, created);
@@ -318,7 +320,7 @@ create table alert (
alert_type text not null references alert_type(ref),
parameter text, -- e.g. Problem ID for new updates, Longitude for local problem alerts
parameter2 text, -- e.g. Latitude for local problem alerts
- email text not null,
+ user_id int references users(id) not null,
confirmed integer not null default 0,
lang text not null default 'en-gb',
cobrand text not null default '' check (cobrand ~* '^[a-z0-9]*$'),
@@ -326,11 +328,11 @@ create table alert (
whensubscribed timestamp not null default ms_current_timestamp(),
whendisabled timestamp default null
);
-create index alert_email_idx on alert(email);
+create index alert_user_id_idx on alert ( user_id );
create index alert_alert_type_confirmed_whendisabled_idx on alert(alert_type, confirmed, whendisabled);
create index alert_whendisabled_cobrand_idx on alert(whendisabled, cobrand);
create index alert_whensubscribed_confirmed_cobrand_idx on alert(whensubscribed, confirmed, cobrand);
--- Possible indexes - unique (alert_type,email,parameter)
+-- Possible indexes - unique (alert_type,user_id,parameter)
create table alert_sent (
alert_id integer not null references alert(id),