Mercurial > p > roundup > code
diff roundup/backends/back_postgresql.py @ 6604:0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
back_postgreql.py - schema version changes for schema version 7.
configuration.py - added indexer_language checks for postgresql. Hardcoded
list for now.
Docs admin_guide and upgrading
Tests.
This also restructures the version upgrade tests for the rdbms
backends. They can run all of them now as the proper cascade is
developed to roll back changes to version 6.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 27 Jan 2022 19:48:48 -0500 |
| parents | 39189dd94f2c |
| children | db3f0ba75b4a |
line wrap: on
line diff
--- a/roundup/backends/back_postgresql.py Thu Jan 27 08:05:20 2022 +0100 +++ b/roundup/backends/back_postgresql.py Thu Jan 27 19:48:48 2022 -0500 @@ -200,6 +200,8 @@ # Need to commit here, otherwise otk/session will not find # the necessary tables (in a parallel connection!) self.commit() + self._add_fts_table() + self.commit() def checkpoint_data(self): """Commit the state of the database. Allows recovery/retry @@ -264,6 +266,13 @@ self.sql('''CREATE INDEX words_both_idx ON public.__words USING btree (_word, _textid)''') + def _add_fts_table(self): + self.sql('CREATE TABLE __fts (_class VARCHAR(255), ' + '_itemid VARCHAR(255), _prop VARCHAR(255), _tsv tsvector)' + ) + + self.sql('CREATE INDEX __fts_idx ON __fts USING GIN (_tsv)') + def fix_version_6_tables(self): # Modify length for __words._word column. c = self.cursor @@ -273,6 +282,8 @@ # column length and maxlength. c.execute(sql, (self.indexer.maxlength + 5,)) + self._add_fts_table() + def add_actor_column(self): # update existing tables to have the new actor column tables = self.database_schema['tables']
