4 Add view for new generate_filelist command.
6 @contact: Debian FTP Master <ftpmaster@debian.org>
7 @copyright: 2009 Torsten Werner <twerner@debian.org>
8 @license: GNU General Public License version 2 or later
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 print "Add views for generate_filelist to database."
33 print "Drop old views."
34 c.execute("DROP VIEW IF EXISTS binfiles_suite_component_arch CASCADE")
35 c.execute("DROP VIEW IF EXISTS srcfiles_suite_component CASCADE")
37 print "Create new views."
39 CREATE VIEW binfiles_suite_component_arch AS
40 SELECT files.filename, binaries.type, location.path, location.component,
41 bin_associations.suite, binaries.architecture
43 JOIN bin_associations ON binaries.id = bin_associations.bin
44 JOIN files ON binaries.file = files.id
45 JOIN location ON files.location = location.id;
48 CREATE VIEW srcfiles_suite_component AS
49 SELECT files.filename, location.path, location.component,
50 src_associations.suite
52 JOIN src_associations ON source.id = src_associations.source
53 JOIN files ON source.file = files.id
54 JOIN location ON files.location = location.id;
58 c.execute("UPDATE config SET value = '23' WHERE name = 'db_revision'")
61 except psycopg2.InternalError, msg:
63 raise DBUpdateError, "Database error, rollback issued. Error message : %s" % (str(msg))