Package dak :: Package dakdb :: Module update129
[hide private]
[frames] | no frames]

Source Code for Module dak.dakdb.update129

 1  """add `keyrings.tag2upload` 
 2   
 3  @contact: Debian FTP Master <ftpmaster@debian.org> 
 4  @copyright: 2025 Ansgar <ansgar@debian.org> 
 5  @license: GNU General Public License version 2 or later 
 6  """ 
 7   
 8  # This program is free software; you can redistribute it and/or modify 
 9  # it under the terms of the GNU General Public License as published by 
10  # the Free Software Foundation; either version 2 of the License, or 
11  # (at your option) any later version. 
12   
13  # This program is distributed in the hope that it will be useful, 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  # GNU General Public License for more details. 
17   
18  # You should have received a copy of the GNU General Public License 
19  # along with this program; if not, write to the Free Software 
20  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
21   
22  ################################################################################ 
23   
24  import psycopg2 
25   
26  from daklib.dak_exceptions import DBUpdateError 
27   
28  statements = [ 
29      """ 
30      ALTER TABLE keyrings 
31      ADD COLUMN tag2upload BOOLEAN NOT NULL DEFAULT FALSE 
32      """, 
33      """ 
34      COMMENT ON COLUMN keyrings.tag2upload 
35          IS 'treat uploads as authorized by a developer via tag2upload' 
36      """, 
37  ] 
38   
39  ################################################################################ 
40   
41   
42 -def do_update(self):
43 print(__doc__) 44 try: 45 c = self.db.cursor() 46 47 for stmt in statements: 48 c.execute(stmt) 49 50 c.execute("UPDATE config SET value = '129' WHERE name = 'db_revision'") 51 self.db.commit() 52 53 except psycopg2.ProgrammingError as msg: 54 self.db.rollback() 55 raise DBUpdateError( 56 "Unable to apply sick update 129, rollback issued. Error message: {0}".format( 57 msg 58 ) 59 )
60