Package buildbot :: Package db :: Package schema :: Module v2
[frames] | no frames]

Source Code for Module buildbot.db.schema.v2

 1   
 2  from buildbot.db.schema import base 
 3   
4 -class Upgrader(base.Upgrader):
5 - def upgrade(self):
6 self.add_columns() 7 self.set_version()
8
9 - def add_columns(self):
10 if self.dbapiName == 'MySQLdb': 11 default_text = "" 12 else: 13 default_text = "default ''" 14 15 cursor = self.conn.cursor() 16 cursor.execute(""" 17 ALTER TABLE changes 18 add column `repository` text not null %s 19 """ % default_text) 20 cursor.execute(""" 21 ALTER TABLE changes 22 add column `project` text not null %s 23 """ % default_text) 24 cursor.execute(""" 25 ALTER TABLE sourcestamps 26 add column `repository` text not null %s 27 """ % default_text) 28 cursor.execute(""" 29 ALTER TABLE sourcestamps 30 add column `project` text not null %s 31 """ % default_text)
32
33 - def set_version(self):
34 c = self.conn.cursor() 35 c.execute("""UPDATE version set version = 2 where version = 1""")
36