Skip to content

Commit

Permalink
MySQL doesn't like default vals for text fields.
Browse files Browse the repository at this point in the history
Don't try to pass them if the DB api is MySQLdb. Fixes #776.
  • Loading branch information
Amber Yust committed Oct 4, 2010
1 parent b713e2f commit 790ba89
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions master/buildbot/db/schema/v2.py
Expand Up @@ -7,23 +7,28 @@ def upgrade(self):
self.set_version()

def add_columns(self):
if self.dbapiName == 'MySQLdb':
default_text = ""
else:
default_text = "default ''"

cursor = self.conn.cursor()
cursor.execute("""
ALTER TABLE changes
add column `repository` text not null default ''
""")
add column `repository` text not null %s
""" % default_text)
cursor.execute("""
ALTER TABLE changes
add column `project` text not null default ''
""")
add column `project` text not null %s
""" % default_text)
cursor.execute("""
ALTER TABLE sourcestamps
add column `repository` text not null default ''
""")
add column `repository` text not null %s
""" % default_text)
cursor.execute("""
ALTER TABLE sourcestamps
add column `project` text not null default ''
""")
add column `project` text not null %s
""" % default_text)

def set_version(self):
c = self.conn.cursor()
Expand Down

0 comments on commit 790ba89

Please sign in to comment.