e07b3e91b91d379d1b8eaaace564beea4895a17d
[mir.git] / dbscripts / dupetrigger / INSTALL
1 The dupetrigger
2
3 MOTIVATION
4
5 Often, users commit their comments and articles multiple times if they
6 don't believe the comment has been inserted into the databases. This is
7 clearly one of the disadvantages of the otherwise clever caching strategy
8 used by Mir. Without proper handling, this duplicate content will enlarge
9 the database and make the appearance of the generated web pages be less
10 satisfactory. 
11
12
13 SOLUTIONS
14
15 There are two approaches to get rid of these duplicate entries
16 (hereafter called "dupes"). The first approach is the dupetrigger that 
17 ensures that no entries in a given table are the same. This is the approach
18 currently pursued in Mir. If this trigger cannot be compiled or doesn't work
19 for any reason, you may work-around this problem by issuing the following
20 commands on your psql prompt:
21
22 CREATE UNIQUE INDEX idx_content_dupe ON content (title, subtitle, creator, description, content_data);
23 CREATE UNIQUE INDEX idx_comment_dupe ON comment (creator, to_media, description, title);
24
25 Please note that this approach will work but the implications on the Mir 
26 software have not been tested, yet. Maybe Mir will respond with an error 
27 or with other unexpected behaviour, but it should do no harm to the
28 database. The dupetrigger has been tested with Mir and is currently being 
29 operated on de.indymedia.org.
30
31
32 HOW TO INSTALL THE DUPE TRIGGER
33
34 To install the trigger do the following:
35
36 # cp Makefile-dist Makefile
37
38 # edit Makefile
39 (and change pathnames and PGVERSION if neccessary).
40
41 # make
42 (This makes the trigger binary and places it in INSTALLDIR with permissions 644)
43
44 # edit postgresql.script
45 (And change the path to dupetrigger.so to INSTALLDIR)
46
47 # psql -Upostgres -f postgresql.script Mir 
48 (This installs the the trigger binary and creates a new trigger.)