Skip to content

Commit

Permalink
db fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Tardy committed Mar 6, 2014
1 parent 0b71bcb commit 645bc1f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions master/buildbot/db/migrate/versions/036_build_parent.py
Expand Up @@ -20,6 +20,7 @@ def upgrade(migrate_engine):
metadata = sa.MetaData()
metadata.bind = migrate_engine

sa.Table('builds', metadata, autoload=True)
buildsets_table = sa.Table('buildsets', metadata, autoload=True)

# optional parent build
Expand Down
Expand Up @@ -33,7 +33,31 @@ def test_migration(self):
def setup_thd(conn):
metadata = sa.MetaData()
metadata.bind = conn

# This table contains basic information about each build.
builds = sa.Table('builds', metadata,
sa.Column('id', sa.Integer, primary_key=True),
sa.Column('number', sa.Integer, nullable=False),
sa.Column('builderid', sa.Integer),
# note that there is 1:N relationship here.
# In case of slave loss, build has results RETRY
# and buildrequest is unclaimed
sa.Column('buildrequestid', sa.Integer,
nullable=False),
# slave which performed this build
# TODO: ForeignKey to buildslaves table, named buildslaveid
# TODO: keep nullable to support slave-free builds
sa.Column('buildslaveid', sa.Integer),
# master which controlled this build
sa.Column('masterid', sa.Integer,
nullable=False),
# start/complete times
sa.Column('started_at', sa.Integer, nullable=False),
sa.Column('complete_at', sa.Integer),
# a list of strings describing the build's state
sa.Column('state_strings_json', sa.Text, nullable=False),
sa.Column('results', sa.Integer),
)
builds.create()
buildsets = sa.Table('buildsets', metadata,
sa.Column('id', sa.Integer, primary_key=True),
sa.Column('external_idstring', sa.String(256)),
Expand Down

0 comments on commit 645bc1f

Please sign in to comment.