diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/generate_secret.sql | 8 | ||||
-rw-r--r-- | db/migrate_from_osgb36_to_wgs84.pl | 10 | ||||
-rw-r--r-- | db/schema.sql | 20 | ||||
-rw-r--r-- | db/schema_0021-add_external_source_columns_to_problem.sql | 8 | ||||
-rw-r--r-- | db/schema_0022-add_interest_count_to_problems.sql | 6 | ||||
-rw-r--r-- | db/schema_0023-add_can_be_devolved_and_category_config.sql | 13 | ||||
-rw-r--r-- | db/schema_0026-change_interest_count_default.sql | 9 |
7 files changed, 66 insertions, 8 deletions
diff --git a/db/generate_secret.sql b/db/generate_secret.sql new file mode 100644 index 000000000..ad4b48200 --- /dev/null +++ b/db/generate_secret.sql @@ -0,0 +1,8 @@ +-- assumes there's a secret table (from the schema.sql) +-- use your own secret if you have one :-) +-- otherwise you can use this to populate the secret table with a random secret + +-- empty the table in case it has a value already (i.e., this is *destructive*!) +delete from secret; + +insert into secret values (md5(random()::text)); diff --git a/db/migrate_from_osgb36_to_wgs84.pl b/db/migrate_from_osgb36_to_wgs84.pl index abd504fb8..676ffea9b 100644 --- a/db/migrate_from_osgb36_to_wgs84.pl +++ b/db/migrate_from_osgb36_to_wgs84.pl @@ -21,11 +21,11 @@ use Utils; BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); mySociety::DBHandle::configure( - Name => mySociety::Config::get('BCI_DB_NAME'), - User => mySociety::Config::get('BCI_DB_USER'), - Password => mySociety::Config::get('BCI_DB_PASS'), - Host => mySociety::Config::get( 'BCI_DB_HOST', undef ), - Port => mySociety::Config::get( 'BCI_DB_PORT', undef ) + Name => mySociety::Config::get('FMS_DB_NAME'), + User => mySociety::Config::get('FMS_DB_USER'), + Password => mySociety::Config::get('FMS_DB_PASS'), + Host => mySociety::Config::get( 'FMS_DB_HOST', undef ), + Port => mySociety::Config::get( 'FMS_DB_PORT', undef ) ); } diff --git a/db/schema.sql b/db/schema.sql index 6e9396f45..7cb2f3257 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -84,7 +84,13 @@ create table contacts ( extra text, -- for things like missed bin collections - non_public boolean default 'f' + non_public boolean default 'f', + + -- per contact endpoint configuration + endpoint text, + jurisdiction text default '', + api_key text default '', + send_method text ); create unique index contacts_area_id_category_idx on contacts(area_id, category); @@ -204,7 +210,14 @@ create table problem ( send_method_used text, -- for things like missed bin collections - non_public BOOLEAN default 'f' + non_public BOOLEAN default 'f', + + -- record details about messages from external sources, eg. message manager + external_source text, + external_source_id text, + + -- number of me toos + interest_count integer default 0 ); create index problem_state_latitude_longitude_idx on problem(state, latitude, longitude); create index problem_user_id_idx on problem ( user_id ); @@ -444,5 +457,6 @@ create table open311conf ( send_method text, send_comments boolean not null default 'f', comment_user_id int references users(id), - suppress_alerts boolean not null default 'f' + suppress_alerts boolean not null default 'f', + can_be_devolved boolean not null default 'f' ); diff --git a/db/schema_0021-add_external_source_columns_to_problem.sql b/db/schema_0021-add_external_source_columns_to_problem.sql new file mode 100644 index 000000000..a74bcce7d --- /dev/null +++ b/db/schema_0021-add_external_source_columns_to_problem.sql @@ -0,0 +1,8 @@ +begin; + +ALTER table problem + ADD column external_source TEXT; +ALTER table problem + ADD column external_source_id TEXT; + +commit; diff --git a/db/schema_0022-add_interest_count_to_problems.sql b/db/schema_0022-add_interest_count_to_problems.sql new file mode 100644 index 000000000..62092aa0a --- /dev/null +++ b/db/schema_0022-add_interest_count_to_problems.sql @@ -0,0 +1,6 @@ +begin; + +ALTER table problem + ADD COLUMN interest_count integer; + +commit; diff --git a/db/schema_0023-add_can_be_devolved_and_category_config.sql b/db/schema_0023-add_can_be_devolved_and_category_config.sql new file mode 100644 index 000000000..6eba0919a --- /dev/null +++ b/db/schema_0023-add_can_be_devolved_and_category_config.sql @@ -0,0 +1,13 @@ +begin; + +ALTER table open311conf + ADD column can_be_devolved BOOL NOT NULL DEFAULT 'f'; + +ALTER table contacts + ADD column endpoint TEXT, + ADD column jurisdiction TEXT DEFAULT '', + ADD column api_key TEXT DEFAULT '', + ADD column send_method TEXT +; + +commit; diff --git a/db/schema_0026-change_interest_count_default.sql b/db/schema_0026-change_interest_count_default.sql new file mode 100644 index 000000000..7c78f6fe8 --- /dev/null +++ b/db/schema_0026-change_interest_count_default.sql @@ -0,0 +1,9 @@ +BEGIN; + + ALTER TABLE problem + ALTER COLUMN interest_count SET DEFAULT 0; + + UPDATE problem SET interest_count = 0 + WHERE interest_count IS NULL; + +COMMIT; |