|
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members
sa.Column('who', sa.String(256), nullable=False), sa.Column('writing', sa.Integer, nullable=False), sa.Column('last_access', sa.Integer, nullable=False), )
sa.Column('next_changeid', sa.Integer), )
sa.Column('changeid', sa.Integer, autoincrement=False, primary_key=True), sa.Column('author', sa.String(256), nullable=False), sa.Column('comments', sa.String(1024), nullable=False), sa.Column('is_dir', sa.SmallInteger, nullable=False), sa.Column('branch', sa.String(256)), sa.Column('revision', sa.String(256)), sa.Column('revlink', sa.String(256)), sa.Column('when_timestamp', sa.Integer, nullable=False), sa.Column('category', sa.String(256)), )
sa.Column('changeid', sa.Integer, sa.ForeignKey('changes.changeid'), nullable=False), sa.Column('link', sa.String(1024), nullable=False), )
sa.Column('changeid', sa.Integer, sa.ForeignKey('changes.changeid'), nullable=False), sa.Column('filename', sa.String(1024), nullable=False), )
sa.Column('changeid', sa.Integer, sa.ForeignKey('changes.changeid'), nullable=False), sa.Column('property_name', sa.String(256), nullable=False), sa.Column('property_value', sa.String(1024), nullable=False), )
sa.Column('schedulerid', sa.Integer, autoincrement=False, primary_key=True), sa.Column('name', sa.String(128), nullable=False), sa.Column('state', sa.String(1024), nullable=False), )
sa.Column('schedulerid', sa.Integer, sa.ForeignKey('schedulers.schedulerid')), sa.Column('changeid', sa.Integer, sa.ForeignKey('changes.changeid')), sa.Column('important', sa.SmallInteger), )
sa.Column('buildsetid', sa.Integer, sa.ForeignKey('buildsets.id')), sa.Column('schedulerid', sa.Integer, sa.ForeignKey('schedulers.schedulerid')), sa.Column('active', sa.SmallInteger), )
sa.Column('id', sa.Integer, autoincrement=False, primary_key=True), sa.Column('branch', sa.String(256)), sa.Column('revision', sa.String(256)), sa.Column('patchid', sa.Integer, sa.ForeignKey('patches.id')), )
sa.Column('id', sa.Integer, autoincrement=False, primary_key=True), sa.Column('patchlevel', sa.Integer, nullable=False), sa.Column('patch_base64', sa.Text, nullable=False), sa.Column('subdir', sa.Text), )
sa.Column('sourcestampid', sa.Integer, sa.ForeignKey('sourcestamps.id'), nullable=False), sa.Column('changeid', sa.Integer, sa.ForeignKey('changes.changeid'), nullable=False), )
sa.Column('id', sa.Integer, autoincrement=False, primary_key=True), sa.Column('external_idstring', sa.String(256)), sa.Column('reason', sa.String(256)), sa.Column('sourcestampid', sa.Integer, sa.ForeignKey('sourcestamps.id'), nullable=False), sa.Column('submitted_at', sa.Integer, nullable=False), sa.Column('complete', sa.SmallInteger, nullable=False, server_default=sa.DefaultClause("0")), sa.Column('complete_at', sa.Integer), sa.Column('results', sa.SmallInteger), )
sa.Column('buildsetid', sa.Integer, sa.ForeignKey('buildsets.id'), nullable=False), sa.Column('property_name', sa.String(256), nullable=False), sa.Column('property_value', sa.String(1024), nullable=False), )
sa.Column('id', sa.Integer, autoincrement=False, primary_key=True), sa.Column('buildsetid', sa.Integer, sa.ForeignKey("buildsets.id"), nullable=False), sa.Column('buildername', sa.String(length=256), nullable=False), sa.Column('priority', sa.Integer, nullable=False, server_default=sa.DefaultClause("0")), sa.Column('claimed_at', sa.Integer, server_default=sa.DefaultClause("0")), sa.Column('claimed_by_name', sa.String(length=256)), sa.Column('claimed_by_incarnation', sa.String(length=256)), sa.Column('complete', sa.Integer, server_default=sa.DefaultClause("0")), sa.Column('results', sa.SmallInteger), sa.Column('submitted_at', sa.Integer, nullable=False), sa.Column('complete_at', sa.Integer), )
sa.Column('id', sa.Integer, autoincrement=False, primary_key=True), sa.Column('number', sa.Integer, nullable=False), sa.Column('brid', sa.Integer, sa.ForeignKey('buildrequests.id'), nullable=False), sa.Column('start_time', sa.Integer, nullable=False), sa.Column('finish_time', sa.Integer), )
"""Test that the database can handle inserting and selecting Unicode""" # set up a subsidiary MetaData object to hold this temporary table
sa.Column('u', sa.Unicode(length=100)), sa.Column('b', sa.LargeBinary), )
# insert a unicode value in there
# see if the data is intact
# drop the test table
# get the basedir from the engine - see model.py if you're wondering # how it got there
# strip None from any of these values, just in case else:
# if we still have a changes.pck, then we need to migrate it next_changeid=1)
#if not quiet: print "migrating changes.pck to database"
# 'source' will be an old b.c.changes.ChangeMaster instance, with a # .changes attribute. Note that we use 'r', and not 'rb', because these # pickles were written using the old text pickle format, which requires # newline translation
#if not quiet: print " (%d Change objects)" % len(source.changes)
# first, scan for changes without a number. If we find any, then we'll # renumber the changes sequentially
# insert the changes changeid=c.number, author=c.who, comments=c.comments, is_dir=c.isdir, branch=c.branch, revision=c.revision, revlink=c.revlink, when_timestamp=c.when, category=c.category)
# NOTE: change_links is not populated, since it is deleted in db # version 20. The table is still created, though.
# sometimes c.files contains nested lists -- why, I do not know! But we deal with # it all the same - see bug #915. We'll assume for now that c.files contains *either* # lists of filenames or plain filenames, not both. else: else: changeid=c.number, filename=filename)
changeid=c.number, property_name=propname, property_value=encoded_value)
# update next_changeid next_changeid=max_changeid+1)
#if not quiet: # print "moving changes.pck to changes.pck.old; delete it or keep it as a backup"
# do some tests before getting started
# create the initial schema
# and import some changes |