nurpax / nurpawiki

Automatically exported from code.google.com/p/nurpawiki
GNU General Public License v2.0
0 stars 3 forks source link

Make DB installation possible on both Postgresql 8.2 and 8.3 #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Current schema.psql doesn't work on Postgresql 8.3 as the new 8.3 version
already includes tsearch2 by default.

Things that need to be done:

1) Take out tsearch2 statements out of schema.psql and extend docs to
mention that you need to install tsearch2.sql from the psql contrib
directory (if memory serves me right)

2) For new 8.2 installation, install tsearch2 into its own schema so that
users can export the DB contents *without* tsearch2 functions & datatypes.
 Doing this manually for DB dumps if too hard.  Need to also add DB dump
instructions that explain how to dump only nurpawiki tables without
tsearch2 functions.

Original issue reported on code.google.com by jjhel...@gmail.com on 20 Feb 2008 at 9:18

GoogleCodeExporter commented 9 years ago
See http://www.postgresql.org/docs/8.2/static/ddl-schemas.html on the use of 
schemas.

Original comment by jjhel...@gmail.com on 20 Feb 2008 at 9:20

GoogleCodeExporter commented 9 years ago
What to do:

- Create a schema for nurpawiki
- nurpawiki schema is used for the wiki data and created for both 8.2 and 8.3+. 
 The
search path will be set so that nurpawiki code doesn't need to change.
- For Postgresql 8.2 and earlier, load tsearch2.sql will be loaded into the 
public
schema, thus making it easier to export only nurpawiki data for backups and 
migrations.

Create new SQL scripts:

- nurpawiki_psql-8.2.sql -- use for earlier installations
- nurpawiki.sql -- for newer

The contents of nurpawiki_psql-8.2.sql would look something like this:

8<
\i tsearch2.sql
\i nurpawiki.sql -- creates nurpawiki schema and sets it current
8<

nurpawiki.sql could be used as-is on Postgresql 8.3 and later.

Original comment by jjhel...@gmail.com on 21 Feb 2008 at 11:16

GoogleCodeExporter commented 9 years ago
First stab at this in r364.  The change is actually quite a bit more 
complicated than
what's said above.

Ended up not using search_path for 'nw' schema.  Instead all DB ops are just 
prefixed
with nw.

The changes creates a new schema version and moves all the DB tables under the 
new
'nw' schema.

As Postgresql 8.2 and 8.3 have different names for some of the tsearch2 
functions,
the DB upgrade code needs to dynamically adapt to different versions by renaming
those functions depending on what it finds from pg_proc table.

Original comment by jjhel...@gmail.com on 22 Feb 2008 at 9:09

GoogleCodeExporter commented 9 years ago
Done.  See changes between r364-r380.

Original comment by jjhel...@gmail.com on 23 Feb 2008 at 9:42