The SQL for the database schema is available in
buildbot/db/schema/tables.sql. However, note that this file is not used
for new installations or upgrades of the Buildbot database.
buildbot.db.schema.DBSchemaManager handles this task. The
operation of this class centers around a linear sequence of database versions.
Versions start at 0, which is the old pickle-file format. The manager has
methods to query the version of the database, and the current version from the
source code. It also has an
upgrade method which will upgrade the
database to the latest version. This operation is currently irreversible.
There is no operation to "install" the latest schema. Instead, a fresh install of buildbot begins with an (empty) version-0 database, and upgrades to the current version. This trades a bit of efficiency at install time for assurances that the upgrade code is well-tested.