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

Source Code for Module buildbot.db.schema.v2

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