To make a change to the database schema, follow these steps:
CURRENT_VERSION
in buildbot/db/schema/manager.py
by
one. This is your new version number.
buildbot.db.schema.base.Updater
named Updater
.
The class must define the method upgrade
, which takes no arguments. It
should upgrade the database from the previous version to your version,
including incrementing the number in the VERSION
table, probably with an
UPDATE
query.
Consult the API documentation for the base class for information on the attributes that are available.
fill_basedir
to add some test data.
Add code to assertDatabaseOKEmpty
to check that your upgrade works on an
empty database.
Add code to assertDatabaseOKFull
to check that your upgrade works on a
database with pre-existing data. Do this even if your changes do not move any
data from the basedir.
Run the tests to find the bugs you introduced in step 2.
test_get_current_version
test in the
same file. Only do this after you've finished the previous step - a failure of
this test is a good reminder that testing isn't done yet.