1 """
2 Add column to store compression type of indices
3
4 @contact: Debian FTP Master <ftpmaster@debian.org>
5 @copyright: 2012, Ansgar Burchardt <ansgar@debian.org>
6 @license: GNU General Public License version 2 or later
7 """
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import psycopg2
26 from daklib.dak_exceptions import DBUpdateError
27
28
29
30
32 """
33 Add column to store compression type of indices
34 """
35 print(__doc__)
36 try:
37 c = self.db.cursor()
38
39 c.execute("""
40 ALTER TABLE suite
41 ADD COLUMN indices_compression TEXT[] DEFAULT ARRAY['gzip', 'bzip2'],
42 ADD COLUMN i18n_compression TEXT[] DEFAULT ARRAY['bzip2']
43 """)
44
45 c.execute("""
46 ALTER TABLE suite
47 ALTER COLUMN indices_compression DROP DEFAULT,
48 ALTER COLUMN i18n_compression DROP DEFAULT
49 """)
50
51 c.execute("UPDATE config SET value = '101' WHERE name = 'db_revision'")
52 self.db.commit()
53
54 except psycopg2.ProgrammingError as msg:
55 self.db.rollback()
56 raise DBUpdateError('Unable to apply sick update 101, rollback issued. Error message : %s' % (str(msg)))
57