Skip to content

Commit

Permalink
make a base class for Upgraders
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin J. Mitchell committed Mar 2, 2010
1 parent 1539d25 commit 8a4942d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 10 additions & 0 deletions buildbot/db/schema/base.py
@@ -0,0 +1,10 @@
class Upgrader(object):

def __init__(self, dbapi, conn, basedir, quiet=False):
self.dbapi = dbapi
self.conn = conn
self.basedir = basedir
self.quiet = quiet

def upgrade(self):
raise NotImplementedError
9 changes: 2 additions & 7 deletions buildbot/db/schema/v1.py
Expand Up @@ -48,6 +48,7 @@
import json

from buildbot.db import util
from buildbot.db.schema import base

# This is version 1, so it introduces a lot of new tables over version 0,
# which had no database.
Expand Down Expand Up @@ -241,13 +242,7 @@
"""),
]

class Upgrader(object):
def __init__(self, dbapi, conn, basedir, quiet=False):
self.dbapi = dbapi
self.conn = conn
self.basedir = basedir
self.quiet = quiet

class Upgrader(base.Upgrader):
def upgrade(self):
self.add_tables()
self.migrate_changes()
Expand Down

0 comments on commit 8a4942d

Please sign in to comment.