aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-07-29 09:03:56 +0100
committerMatthew Somerville <matthew@mysociety.org>2020-07-31 12:33:38 +0100
commitbd42d6a1fcb6c8e6d89413e0ee22617625d95bad (patch)
tree2bdbeff779e44d14aa2409f9660ab3c91c9a8377 /bin
parent34dd7c253d337ea922049390dc6ba44b8686e516 (diff)
Add database index for full text search.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update-schema4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/update-schema b/bin/update-schema
index 44e299b91..90876cf76 100755
--- a/bin/update-schema
+++ b/bin/update-schema
@@ -78,6 +78,8 @@ print "= Dry run =\n" unless $commit;
my $upgrade = !$downgrade;
+my $db_fts_config = FixMyStreet->config('DB_FULL_TEXT_SEARCH_CONFIG') || 'english';
+
sub get_statements {
my $path = shift;
open(my $FP, '<', $path) or die $!;
@@ -91,6 +93,7 @@ sub get_statements {
$in_function = 1 if /create (or replace )?function/i;
$in_function = 0 if /language (sql|'plpgsql')/i;
if ($s =~ /;/ && !$in_function) {
+ $s =~ s/DB_FULL_TEXT_SEARCH_CONFIG/$db_fts_config/g;
push @statements, $s;
$s = '';
}
@@ -212,6 +215,7 @@ else {
# (assuming schema change files are never half-applied, which should be the case)
sub get_db_version {
return 'EMPTY' if ! table_exists('problem');
+ return '0073' if index_exists('problem_fulltext_idx');
return '0072' if constraint_contains('contacts_state_check', 'staff');
return '0071' if table_exists('manifest_theme');
return '0070' if column_like('alert_type', "ref='new_problems'", 'head_title', '{{SITE_NAME}}');