Trees | Indices | Help |
|
---|
|
1 """ 2 Remove redundant 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 # This program is free software; you can redistribute it and/or modify 10 # it under the terms of the GNU General Public License as published by 11 # the Free Software Foundation; either version 2 of the License, or 12 # (at your option) any later version. 13 14 # This program is distributed in the hope that it will be useful, 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 # GNU General Public License for more details. 18 19 # You should have received a copy of the GNU General Public License 20 # along with this program; if not, write to the Free Software 21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 23 ################################################################################ 24 25 import psycopg2 26 from daklib.dak_exceptions import DBUpdateError 27 from daklib.config import Config 28 29 ################################################################################ 30 3133 """ 34 Remove redundant indices 35 """ 36 print(__doc__) 37 try: 38 cnf = Config() 39 40 c = self.db.cursor() 41 42 indices = [ 43 # table 'binaries': 44 "binaries_id", # (id). already covered by binaries_pkey (id) 45 "binaries_by_package", # (id, package). already covered by binaries_pkey (id) 46 "binaries_files", # (file). already covered by binaries_file_key (file) 47 "jjt5", # (id, source). already covered by binaries_pkey (id) 48 # table 'changes': 49 "changesin_queue_approved_for", # (in_queue, approved_for). already covered by changesin_queue (in_queue) 50 # table 'files': 51 "jjt", # (id). already covered by files_pkey (id) 52 "jjt3", # (id, location). already covered by files_pkey (id) 53 # table 'override': 54 "override_suite_key", # (suite, component, package, type). same as override_pkey 55 # table 'suite': 56 "suite_hash", # (suite_name). already covered by suite_name_unique (suite_name) 57 # table 'suite_architectures': 58 "suite_architectures_suite_key", # (suite, architecture). same as suite_architectures_pkey 59 ] 60 for index in indices: 61 c.execute("DROP INDEX IF EXISTS {0}".format(index)) 62 63 c.execute("UPDATE config SET value = '72' WHERE name = 'db_revision'") 64 self.db.commit() 65 66 except psycopg2.ProgrammingError as msg: 67 self.db.rollback() 68 raise DBUpdateError('Unable to apply sick update 72, rollback issued. Error message : %s' % (str(msg)))69
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Oct 30 23:34:26 2024 | http://epydoc.sourceforge.net |