diff options
Diffstat (limited to 'lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions')
23 files changed, 0 insertions, 1494 deletions
diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/001_initial.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/001_initial.py deleted file mode 100644 index 297d7a2c..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/001_initial.py +++ /dev/null @@ -1,283 +0,0 @@ -# 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 - -from __future__ import with_statement - -import os -import cPickle -from twisted.persisted import styles -from buildbot.util import json -import sqlalchemy as sa - -metadata = sa.MetaData() - -last_access = sa.Table('last_access', metadata, - sa.Column('who', sa.String(256), nullable=False), - sa.Column('writing', sa.Integer, nullable=False), - sa.Column('last_access', sa.Integer, nullable=False), -) - -changes_nextid = sa.Table('changes_nextid', metadata, - sa.Column('next_changeid', sa.Integer), -) - -changes = sa.Table('changes', metadata, - 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)), -) - -change_links = sa.Table('change_links', metadata, - sa.Column('changeid', sa.Integer, sa.ForeignKey('changes.changeid'), nullable=False), - sa.Column('link', sa.String(1024), nullable=False), -) - -change_files = sa.Table('change_files', metadata, - sa.Column('changeid', sa.Integer, sa.ForeignKey('changes.changeid'), nullable=False), - sa.Column('filename', sa.String(1024), nullable=False), -) - -change_properties = sa.Table('change_properties', metadata, - 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), -) - -schedulers = sa.Table("schedulers", metadata, - 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), -) - -scheduler_changes = sa.Table('scheduler_changes', metadata, - sa.Column('schedulerid', sa.Integer, sa.ForeignKey('schedulers.schedulerid')), - sa.Column('changeid', sa.Integer, sa.ForeignKey('changes.changeid')), - sa.Column('important', sa.SmallInteger), -) - -scheduler_upstream_buildsets = sa.Table('scheduler_upstream_buildsets', metadata, - sa.Column('buildsetid', sa.Integer, sa.ForeignKey('buildsets.id')), - sa.Column('schedulerid', sa.Integer, sa.ForeignKey('schedulers.schedulerid')), - sa.Column('active', sa.SmallInteger), -) - -sourcestamps = sa.Table('sourcestamps', metadata, - 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')), -) - -patches = sa.Table('patches', metadata, - 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), -) - -sourcestamp_changes = sa.Table('sourcestamp_changes', metadata, - sa.Column('sourcestampid', sa.Integer, sa.ForeignKey('sourcestamps.id'), nullable=False), - sa.Column('changeid', sa.Integer, sa.ForeignKey('changes.changeid'), nullable=False), -) - -buildsets = sa.Table('buildsets', metadata, - 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), -) - -buildset_properties = sa.Table('buildset_properties', metadata, - 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), -) - -buildrequests = sa.Table('buildrequests', metadata, - 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), -) - -builds = sa.Table('builds', metadata, - 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), -) - -def test_unicode(migrate_engine): - """Test that the database can handle inserting and selecting Unicode""" - # set up a subsidiary MetaData object to hold this temporary table - submeta = sa.MetaData() - submeta.bind = migrate_engine - - test_unicode = sa.Table('test_unicode', submeta, - sa.Column('u', sa.Unicode(length=100)), - sa.Column('b', sa.LargeBinary), - ) - test_unicode.create() - - # insert a unicode value in there - u = u"Frosty the \N{SNOWMAN}" - b='\xff\xff\x00' - ins = test_unicode.insert().values(u=u, b=b) - migrate_engine.execute(ins) - - # see if the data is intact - row = migrate_engine.execute(sa.select([test_unicode])).fetchall()[0] - assert type(row['u']) is unicode - assert row['u'] == u - assert type(row['b']) is str - assert row['b'] == b - - # drop the test table - test_unicode.drop() - -def import_changes(migrate_engine): - # get the basedir from the engine - see model.py if you're wondering - # how it got there - basedir = migrate_engine.buildbot_basedir - - # strip None from any of these values, just in case - def remove_none(x): - if x is None: return u"" - elif isinstance(x, str): - return x.decode("utf8") - else: - return x - - # if we still have a changes.pck, then we need to migrate it - changes_pickle = os.path.join(basedir, "changes.pck") - if not os.path.exists(changes_pickle): - migrate_engine.execute(changes_nextid.insert(), - next_changeid=1) - return - - #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 - with open(changes_pickle,"r") as f: - source = cPickle.load(f) - styles.doUpgrade() - - #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 - have_unnumbered = False - for c in source.changes: - if c.revision and c.number is None: - have_unnumbered = True - break - if have_unnumbered: - n = 1 - for c in source.changes: - if c.revision: - c.number = n - n = n + 1 - - # insert the changes - for c in source.changes: - if not c.revision: - continue - try: - values = dict( - 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) - values = dict([ (k, remove_none(v)) for k, v in values.iteritems() ]) - except UnicodeDecodeError, e: - raise UnicodeError("Trying to import change data as UTF-8 failed. Please look at contrib/fix_changes_pickle_encoding.py: %s" % str(e)) - - migrate_engine.execute(changes.insert(), **values) - - # 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. - def flatten(l): - if l and type(l[0]) == list: - rv = [] - for e in l: - if type(e) == list: - rv.extend(e) - else: - rv.append(e) - return rv - else: - return l - for filename in flatten(c.files): - migrate_engine.execute(change_files.insert(), - changeid=c.number, - filename=filename) - - for propname,propvalue in c.properties.properties.items(): - encoded_value = json.dumps(propvalue) - migrate_engine.execute(change_properties.insert(), - changeid=c.number, - property_name=propname, - property_value=encoded_value) - - # update next_changeid - max_changeid = max([ c.number for c in source.changes if c.revision ] + [ 0 ]) - migrate_engine.execute(changes_nextid.insert(), - next_changeid=max_changeid+1) - - #if not quiet: - # print "moving changes.pck to changes.pck.old; delete it or keep it as a backup" - os.rename(changes_pickle, changes_pickle+".old") - -def upgrade(migrate_engine): - metadata.bind = migrate_engine - - # do some tests before getting started - test_unicode(migrate_engine) - - # create the initial schema - metadata.create_all() - - # and import some changes - import_changes(migrate_engine) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/002_add_proj_repo.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/002_add_proj_repo.py deleted file mode 100644 index ad221553..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/002_add_proj_repo.py +++ /dev/null @@ -1,30 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # add project and repository columns to 'changes' an 'sourcestamps' - def add_cols(table): - repository = sa.Column('repository', sa.String(512), nullable=False, server_default=sa.DefaultClause('')) - repository.create(table, populate_default=True) - project = sa.Column('project', sa.String(512), nullable=False, server_default=sa.DefaultClause('')) - project.create(table, populate_default=True) - - add_cols(sa.Table('changes', metadata, autoload=True)) - add_cols(sa.Table('sourcestamps', metadata, autoload=True)) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/003_scheduler_class_name.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/003_scheduler_class_name.py deleted file mode 100644 index 0a3a4f36..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/003_scheduler_class_name.py +++ /dev/null @@ -1,29 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # add an empty class_name to the schedulers table - schedulers = sa.Table('schedulers', metadata, autoload=True) - class_name = sa.Column('class_name', sa.String(length=128), nullable=False, server_default=sa.DefaultClause('')) - class_name.create(schedulers, populate_default=True) - - # and an index since we'll be selecting with (name= AND class=) - idx = sa.Index('name_and_class', schedulers.c.name, schedulers.c.class_name) - idx.create(migrate_engine) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/004_add_autoincrement.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/004_add_autoincrement.py deleted file mode 100644 index c0ec66e6..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/004_add_autoincrement.py +++ /dev/null @@ -1,139 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # re-include some of the relevant tables, as they were in version 3, since - # sqlalchemy's reflection doesn't work very well for defaults. These must - # be complete table specifications as for some dialects sqlalchemy will - # create a brand new, temporary table, and copy data over - - sa.Table("schedulers", metadata, - 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('class_name', sa.String(128), nullable=False), - ) - - sa.Table('changes', metadata, - 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('repository', sa.Text, nullable=False, server_default=''), - sa.Column('project', sa.Text, nullable=False, server_default=''), - ) - - sa.Table('patches', metadata, - sa.Column('id', sa.Integer, primary_key=True), - sa.Column('patchlevel', sa.Integer, nullable=False), - sa.Column('patch_base64', sa.Text, nullable=False), - sa.Column('subdir', sa.Text), - ) - - sa.Table('sourcestamps', metadata, - sa.Column('id', sa.Integer, autoincrement=True, 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('repository', sa.Text(length=None), nullable=False, - server_default=''), - sa.Column('project', sa.Text(length=None), nullable=False, - server_default=''), - ) - - sa.Table('buildsets', metadata, - sa.Column('id', sa.Integer, 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.Table('buildrequests', metadata, - sa.Column('id', sa.Integer, primary_key=True), - sa.Column('buildsetid', sa.Integer, sa.ForeignKey("buildsets.id"), - nullable=False), - sa.Column('buildername', sa.String(length=None), 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=None)), - sa.Column('claimed_by_incarnation', sa.String(length=None)), - 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.Table('builds', metadata, - sa.Column('id', sa.Integer, 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), - ) - - to_autoinc = [ s.split(".") for s in - "schedulers.schedulerid", - "builds.id", - "changes.changeid", - "buildrequests.id", - "buildsets.id", - "patches.id", - "sourcestamps.id", - ] - - # It seems that SQLAlchemy's ALTER TABLE doesn't work when migrating from - # INTEGER to PostgreSQL's SERIAL data type (which is just pseudo data type - # for INTEGER with SEQUENCE), so we have to work-around this with raw SQL. - if migrate_engine.dialect.name in ('postgres', 'postgresql'): - for table_name, col_name in to_autoinc: - migrate_engine.execute("CREATE SEQUENCE %s_%s_seq" - % (table_name, col_name)) - migrate_engine.execute("ALTER TABLE %s ALTER COLUMN %s SET DEFAULT nextval('%s_%s_seq'::regclass)" - % (table_name, col_name, table_name, col_name)) - migrate_engine.execute("ALTER SEQUENCE %s_%s_seq OWNED BY %s.%s" - % (table_name, col_name, table_name, col_name)) - else: - for table_name, col_name in to_autoinc: - table = metadata.tables[table_name] - col = table.c[col_name] - col.alter(autoincrement=True) - - - # also drop the changes_nextid table here (which really should have been a - # sequence..) - table = sa.Table('changes_nextid', metadata, autoload=True) - table.drop() diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/005_add_indexes.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/005_add_indexes.py deleted file mode 100644 index bb0a3d65..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/005_add_indexes.py +++ /dev/null @@ -1,144 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # note that all of the tables defined here omit the ForeignKey constraints; - # this just lets this code specify the tables in any order; the tables are - # not re-created here, so this omission causes no problems - the key - # constraints are still defined in the table - - def add_index(table_name, col_name): - idx_name = "%s_%s" % (table_name, col_name) - idx = sa.Index(idx_name, metadata.tables[table_name].c[col_name]) - idx.create(migrate_engine) - - sa.Table('buildrequests', metadata, - sa.Column('id', sa.Integer, primary_key=True), - sa.Column('buildsetid', sa.Integer, nullable=False), - sa.Column('buildername', sa.String(length=None), nullable=False), - sa.Column('priority', sa.Integer, nullable=False), - sa.Column('claimed_at', sa.Integer, server_default=sa.DefaultClause("0")), - sa.Column('claimed_by_name', sa.String(length=None)), - sa.Column('claimed_by_incarnation', sa.String(length=None)), - 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), - ) - add_index("buildrequests", "buildsetid") - add_index("buildrequests", "buildername") - add_index("buildrequests", "complete") - add_index("buildrequests", "claimed_at") - add_index("buildrequests", "claimed_by_name") - - sa.Table('builds', metadata, - sa.Column('id', sa.Integer, primary_key=True), - sa.Column('number', sa.Integer, nullable=False), - sa.Column('brid', sa.Integer, nullable=False), - sa.Column('start_time', sa.Integer, nullable=False), - sa.Column('finish_time', sa.Integer), - ) - add_index("builds", "number") - add_index("builds", "brid") - - sa.Table('buildsets', metadata, - sa.Column('id', sa.Integer, primary_key=True), - sa.Column('external_idstring', sa.String(256)), - sa.Column('reason', sa.String(256)), - sa.Column('sourcestampid', sa.Integer, 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), - ) - add_index("buildsets", "complete") - add_index("buildsets", "submitted_at") - - sa.Table('buildset_properties', metadata, - sa.Column('buildsetid', sa.Integer, nullable=False), - sa.Column('property_name', sa.String(256), nullable=False), - sa.Column('property_value', sa.String(1024), nullable=False), - ) - add_index("buildset_properties", "buildsetid") - - sa.Table('changes', metadata, - sa.Column('changeid', sa.Integer, 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('repository', sa.Text, nullable=False, server_default=''), - sa.Column('project', sa.Text, nullable=False, server_default=''), - ) - add_index("changes", "branch") - add_index("changes", "revision") - add_index("changes", "author") - add_index("changes", "category") - add_index("changes", "when_timestamp") - - sa.Table('change_files', metadata, - sa.Column('changeid', sa.Integer, nullable=False), - sa.Column('filename', sa.String(1024), nullable=False), - ) - add_index("change_files", "changeid") - - sa.Table('change_links', metadata, - sa.Column('changeid', sa.Integer, nullable=False), - sa.Column('link', sa.String(1024), nullable=False), - ) - add_index("change_links", "changeid") - - sa.Table('change_properties', metadata, - sa.Column('changeid', sa.Integer, nullable=False), - sa.Column('property_name', sa.String(256), nullable=False), - sa.Column('property_value', sa.String(1024), nullable=False), - ) - add_index("change_properties", "changeid") - - # schedulers already has an index - - sa.Table('scheduler_changes', metadata, - sa.Column('schedulerid', sa.Integer), - sa.Column('changeid', sa.Integer), - sa.Column('important', sa.SmallInteger), - ) - add_index("scheduler_changes", "schedulerid") - add_index("scheduler_changes", "changeid") - - sa.Table('scheduler_upstream_buildsets', metadata, - sa.Column('buildsetid', sa.Integer), - sa.Column('schedulerid', sa.Integer), - sa.Column('active', sa.SmallInteger), - ) - add_index("scheduler_upstream_buildsets", "buildsetid") - add_index("scheduler_upstream_buildsets", "schedulerid") - add_index("scheduler_upstream_buildsets", "active") - - # sourcestamps are only queried by id, no need for additional indexes - - sa.Table('sourcestamp_changes', metadata, - sa.Column('sourcestampid', sa.Integer, nullable=False), - sa.Column('changeid', sa.Integer, nullable=False), - ) - add_index("sourcestamp_changes", "sourcestampid") diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/006_drop_last_access.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/006_drop_last_access.py deleted file mode 100644 index fc807714..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/006_drop_last_access.py +++ /dev/null @@ -1,23 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - table = sa.Table('last_access', metadata, autoload=True) - table.drop() diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/007_add_object_tables.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/007_add_object_tables.py deleted file mode 100644 index e09b0c8c..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/007_add_object_tables.py +++ /dev/null @@ -1,37 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - objects = sa.Table("objects", metadata, - sa.Column("id", sa.Integer, primary_key=True), - sa.Column('name', sa.String(128), nullable=False), - sa.Column('class_name', sa.String(128), nullable=False), - sa.UniqueConstraint('name', 'class_name', name='object_identity'), - ) - objects.create() - - object_state = sa.Table("object_state", metadata, - sa.Column("objectid", sa.Integer, sa.ForeignKey('objects.id'), - nullable=False), - sa.Column("name", sa.String(length=256), nullable=False), - sa.Column("value_json", sa.Text, nullable=False), - sa.UniqueConstraint('objectid', 'name', name='name_per_object'), - ) - object_state.create() diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/008_add_scheduler_changes_index.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/008_add_scheduler_changes_index.py deleted file mode 100644 index e758576b..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/008_add_scheduler_changes_index.py +++ /dev/null @@ -1,31 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - scheduler_changes = sa.Table('scheduler_changes', metadata, - sa.Column('schedulerid', sa.Integer), - sa.Column('changeid', sa.Integer), - sa.Column('important', sa.SmallInteger), - ) - - idx = sa.Index('scheduler_changes_unique', - scheduler_changes.c.schedulerid, - scheduler_changes.c.changeid, unique=True) - idx.create(migrate_engine) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/009_add_patch_author.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/009_add_patch_author.py deleted file mode 100644 index fc1771c2..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/009_add_patch_author.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # add patch_author and patch_comment to the patches table - - # mysql doesn't like default values on these columns - defaults = {} - if migrate_engine.dialect.name != "mysql": - defaults['server_default'] = sa.DefaultClause('') - - patches = sa.Table('patches', metadata, autoload=True) - patch_author= sa.Column('patch_author', sa.Text, nullable=False, - **defaults) - patch_author.create(patches, populate_default=True) - - patch_author= sa.Column('patch_comment', sa.Text, nullable=False, - **defaults) - patch_author.create(patches, populate_default=True) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/010_fix_column_lengths.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/010_fix_column_lengths.py deleted file mode 100644 index a3ae3e14..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/010_fix_column_lengths.py +++ /dev/null @@ -1,63 +0,0 @@ -# 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 - -import sqlalchemy as sa -from migrate import changeset - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # the old (non-sqlalchemy-migrate) migration scripts messed up the - # lengths of these columns, so fix them here. - changeset.alter_column( - sa.Column('class_name', sa.String(128), nullable=False), - table="schedulers", - metadata=metadata, - engine=migrate_engine) - - changeset.alter_column( - sa.Column('name', sa.String(128), nullable=False), - table="schedulers", - metadata=metadata, - engine=migrate_engine) - - # sqlalchemy's reflection gets the server_defaults wrong, so this - # table has to be included here. - changes = sa.Table('changes', metadata, - sa.Column('changeid', sa.Integer, 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('repository', sa.String(length=512), nullable=False, - server_default=''), - sa.Column('project', sa.String(length=512), nullable=False, - server_default=''), - ) - changeset.alter_column( - sa.Column('author', sa.String(256), nullable=False), - table=changes, - metadata=metadata, - engine=migrate_engine) - changeset.alter_column( - sa.Column('branch', sa.String(256)), - table=changes, - metadata=metadata, - engine=migrate_engine) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/011_add_buildrequest_claims.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/011_add_buildrequest_claims.py deleted file mode 100644 index 21e93c01..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/011_add_buildrequest_claims.py +++ /dev/null @@ -1,119 +0,0 @@ -# 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 - -import sqlalchemy as sa -import migrate -from buildbot.util import sautils - -def migrate_claims(migrate_engine, metadata, buildrequests, objects, - buildrequest_claims): - - # First, ensure there is an object row for each master - null_id = sa.null().label('id') - if migrate_engine.dialect.name == 'postgresql': - # postgres needs NULL cast to an integer: - null_id = sa.cast(null_id, sa.INTEGER) - new_objects = sa.select([ - null_id, - buildrequests.c.claimed_by_name.label("name"), - sa.literal_column("'BuildMaster'").label("class_name"), - ], - whereclause=buildrequests.c.claimed_by_name != None, - distinct=True) - - # this doesn't seem to work without str() -- verified in sqla 0.6.0 - 0.7.1 - migrate_engine.execute( - str(sautils.InsertFromSelect(objects, new_objects))) - - # now make a buildrequest_claims row for each claimed build request - join = buildrequests.join(objects, - (buildrequests.c.claimed_by_name == objects.c.name) - # (have to use sa.text because str, below, doesn't work - # with placeholders) - & (objects.c.class_name == sa.text("'BuildMaster'"))) - claims = sa.select([ - buildrequests.c.id.label('brid'), - objects.c.id.label('objectid'), - buildrequests.c.claimed_at, - ], from_obj=[ join ], - whereclause=buildrequests.c.claimed_by_name != None) - migrate_engine.execute( - str(sautils.InsertFromSelect(buildrequest_claims, claims))) - -def drop_columns(metadata, buildrequests): - # sqlalchemy-migrate <0.7.0 has a bug with sqlalchemy >=0.7.0, where - # it tries to change an immutable column; this is the workaround, from - # http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=112 - if not sa.__version__.startswith('0.6.'): - if not hasattr(migrate, '__version__'): # that is, older than 0.7 - buildrequests.columns = buildrequests._columns - - buildrequests.c.claimed_at.drop() - buildrequests.c.claimed_by_name.drop() - buildrequests.c.claimed_by_incarnation.drop() - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # a copy of the buildrequests table, but with the foreign keys stripped - buildrequests = sa.Table('buildrequests', metadata, - sa.Column('id', sa.Integer, primary_key=True), - sa.Column('buildsetid', sa.Integer, 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), - ) - - # existing objects table, used as a foreign key - objects = sa.Table("objects", metadata, - # unique ID for this object - sa.Column("id", sa.Integer, primary_key=True), - # object's user-given name - sa.Column('name', sa.String(128), nullable=False), - # object's class name, basically representing a "type" for the state - sa.Column('class_name', sa.String(128), nullable=False), - - # prohibit multiple id's for the same object - sa.UniqueConstraint('name', 'class_name', name='object_identity'), - ) - - # and a new buildrequest_claims table - buildrequest_claims = sa.Table('buildrequest_claims', metadata, - sa.Column('brid', sa.Integer, sa.ForeignKey('buildrequests.id'), - index=True, unique=True), - sa.Column('objectid', sa.Integer, sa.ForeignKey('objects.id'), - index=True, nullable=True), - sa.Column('claimed_at', sa.Integer, nullable=False), - ) - - # create the new table - buildrequest_claims.create() - - # migrate the claims into that table - migrate_claims(migrate_engine, metadata, buildrequests, - objects, buildrequest_claims) - - # and drop the claim-related columns in buildrequests - drop_columns(metadata, buildrequests) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/012_add_users_table.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/012_add_users_table.py deleted file mode 100644 index a485bcb1..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/012_add_users_table.py +++ /dev/null @@ -1,66 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # what defines a user - users = sa.Table("users", metadata, - sa.Column("uid", sa.Integer, primary_key=True), - sa.Column("identifier", sa.String(256), nullable=False), - ) - users.create() - - idx = sa.Index('users_identifier', users.c.identifier) - idx.create() - - # ways buildbot knows about users - users_info = sa.Table("users_info", metadata, - sa.Column("uid", sa.Integer, sa.ForeignKey('users.uid'), - nullable=False), - sa.Column("attr_type", sa.String(128), nullable=False), - sa.Column("attr_data", sa.String(128), nullable=False) - ) - users_info.create() - - idx = sa.Index('users_info_uid', users_info.c.uid) - idx.create() - idx = sa.Index('users_info_uid_attr_type', users_info.c.uid, - users_info.c.attr_type, unique=True) - idx.create() - idx = sa.Index('users_info_attrs', users_info.c.attr_type, - users_info.c.attr_data, unique=True) - idx.create() - - # correlates change authors and user uids - sa.Table('changes', metadata, autoload=True) - change_users = sa.Table("change_users", metadata, - sa.Column("changeid", sa.Integer, sa.ForeignKey('changes.changeid'), - nullable=False), - sa.Column("uid", sa.Integer, sa.ForeignKey('users.uid'), - nullable=False) - ) - change_users.create() - - idx = sa.Index('change_users_changeid', change_users.c.changeid) - idx.create() - - # note that existing changes are not added to the users table; this would - # be *very* time-consuming and would not be helpful to the vast majority of - # users. diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/013_remove_schedulers_state_column.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/013_remove_schedulers_state_column.py deleted file mode 100644 index 0bce4d47..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/013_remove_schedulers_state_column.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 - -import sqlalchemy as sa -from migrate import changeset - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # Specify what the new table should look like - schedulers = sa.Table("schedulers", metadata, - # unique ID for scheduler - sa.Column('schedulerid', sa.Integer, primary_key=True), # TODO: rename to id - # scheduler's name in master.cfg - sa.Column('name', sa.String(128), nullable=False), - # scheduler's class name, basically representing a "type" for the state - sa.Column('class_name', sa.String(128), nullable=False), - ) - - # Now drop column - changeset.drop_column( - sa.Column('state', sa.String(128), nullable=False), - table=schedulers, - metadata=metadata, - engine=migrate_engine) - - diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/014_add_users_userpass_columns.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/014_add_users_userpass_columns.py deleted file mode 100644 index b115a1e9..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/014_add_users_userpass_columns.py +++ /dev/null @@ -1,31 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - - metadata = sa.MetaData() - metadata.bind = migrate_engine - - users_table = sa.Table('users', metadata, autoload=True) - - username = sa.Column('bb_username', sa.String(128)) - username.create(users_table) - password = sa.Column('bb_password', sa.String(128)) - password.create(users_table) - - idx = sa.Index('users_bb_user', users_table.c.bb_username, unique=True) - idx.create() diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/015_remove_bad_master_objectid.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/015_remove_bad_master_objectid.py deleted file mode 100644 index 4f17f719..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/015_remove_bad_master_objectid.py +++ /dev/null @@ -1,71 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # older build masters stored some of their state with an object named - # 'master' with class 'buildbot.master.BuildMaster', while other state was - # stored with objects named after each master itself, with class - # BuildMaster. - - objects_table = sa.Table('objects', metadata, autoload=True) - object_state_table = sa.Table('object_state', metadata, autoload=True) - - # get the old, unwanted ID - q = sa.select([ objects_table.c.id ], - whereclause=(objects_table.c.name=='master') - & (objects_table.c.class_name == 'buildbot.master.BuildMaster')) - res = q.execute() - old_id = res.scalar() - - # if there's no such ID, there's nothing to change - if old_id is not None: - - # get the new ID - q = sa.select([ objects_table.c.id ], - whereclause=objects_table.c.class_name == 'BuildMaster') - res = q.execute() - ids = res.fetchall() - - # if there is exactly one ID, update the existing object_states. If - # there are zero or multiple object_states, then we do not know which - # master to assign last_processed_change to, so we just delete it. - # This indicates to the master that it has processed all changes, which - # is probably accurate. - if len(ids) == 1: - new_id = ids[0][0] - - # update rows with the old id to use the new id - q = object_state_table.update( - whereclause=(object_state_table.c.objectid == old_id)) - q.execute(objectid=new_id) - else: - q = object_state_table.delete( - whereclause=(object_state_table.c.objectid == old_id)) - q.execute() - - # in either case, delete the old object row - q = objects_table.delete( - whereclause=(objects_table.c.id == old_id)) - q.execute() - - # and update the class name for the new rows - q = objects_table.update( - whereclause=(objects_table.c.class_name == 'BuildMaster')) - q.execute(class_name='buildbot.master.BuildMaster') diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/016_restore_buildrequest_indices.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/016_restore_buildrequest_indices.py deleted file mode 100644 index 78d60051..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/016_restore_buildrequest_indices.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # the column drops in 011_add_buildrequest_claims.py unfortunately - # also drop a great deal of other stuff on sqlite. In particular, all - # indexes and foreign keys. - # - # The foreign keys do not matter anyway - SQLite tracks them but ignores - # them. The indices, however, are important, so they are re-added here, - # but only for the sqlite dialect. - - if migrate_engine.dialect.name != 'sqlite': - return - - buildrequests = sa.Table('buildrequests', metadata, autoload=True) - sa.Index('buildrequests_buildsetid', buildrequests.c.buildsetid).create() - sa.Index('buildrequests_buildername', buildrequests.c.buildername).create() - sa.Index('buildrequests_complete', buildrequests.c.complete).create() diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/017_restore_other_indices.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/017_restore_other_indices.py deleted file mode 100644 index 59d2f8aa..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/017_restore_other_indices.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # the column changes in 010_fix_column_lengths.py unfortunately also drop a - # great deal of other stuff on sqlite. In particular, all indexes and - # foreign keys on the 'changes' and 'schedulers' tables. - # - # The foreign keys do not matter anyway - SQLite tracks them but ignores - # them. The indices, however, are important, so they are re-added here, - # but only for the sqlite dialect. - - if migrate_engine.dialect.name == 'sqlite': - schedulers = sa.Table('schedulers', metadata, autoload=True) - - sa.Index('name_and_class', - schedulers.c.name, schedulers.c.class_name).create() - - changes = sa.Table('changes', metadata, autoload=True) - - sa.Index('changes_branch', changes.c.branch).create() - sa.Index('changes_revision', changes.c.revision).create() - sa.Index('changes_author', changes.c.author).create() - sa.Index('changes_category', changes.c.category).create() - sa.Index('changes_when_timestamp', changes.c.when_timestamp).create() - - # These were implemented as UniqueConstraint objects, which are - # recognized as indexes on non-sqlite DB's. So add them as explicit - # indexes on sqlite. - - objects = sa.Table('objects', metadata, autoload=True) - sa.Index('object_identity', objects.c.name, objects.c.class_name, - unique=True).create() - - object_state = sa.Table('object_state', metadata, autoload=True) - sa.Index('name_per_object', object_state.c.objectid, - object_state.c.name, unique=True).create() - - # Due to a coding bug in version 012, the users_identifier index is not - # unique (on any DB). SQLAlchemy-migrate does not provide an interface to - # drop columns, so we fake it here. - - users = sa.Table('users', metadata, autoload=True) - - dialect = migrate_engine.dialect.name - if dialect in ('sqlite', 'postgresql'): - migrate_engine.execute("DROP INDEX users_identifier") - elif dialect == 'mysql': - migrate_engine.execute("DROP INDEX users_identifier ON users") - - sa.Index('users_identifier', users.c.identifier, unique=True).create() diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/018_add_sourcestampset.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/018_add_sourcestampset.py deleted file mode 100644 index b8de49cb..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/018_add_sourcestampset.py +++ /dev/null @@ -1,64 +0,0 @@ -# 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 - -import sqlalchemy as sa -from migrate.changeset import constraint -from buildbot.util import sautils - -def upgrade(migrate_engine): - - metadata = sa.MetaData() - metadata.bind = migrate_engine - - sourcestamps_table = sa.Table('sourcestamps', metadata, autoload=True) - buildsets_table = sa.Table('buildsets', metadata, autoload=True) - - # Create the sourcestampset table - # that defines a sourcestampset - sourcestampsets_table = sa.Table("sourcestampsets", metadata, - sa.Column("id", sa.Integer, primary_key=True), - ) - sourcestampsets_table.create() - - # All current sourcestampid's are migrated to sourcestampsetid - # Insert all sourcestampid's as setid's into sourcestampsets table - sourcestampsetids = sa.select([sourcestamps_table.c.id]) - # this doesn't seem to work without str() -- verified in sqla 0.6.0 - 0.7.1 - migrate_engine.execute(str(sautils.InsertFromSelect(sourcestampsets_table, sourcestampsetids))) - - # rename the buildsets table column - buildsets_table.c.sourcestampid.alter(name='sourcestampsetid') - - metadata.remove(buildsets_table) - buildsets_table = sa.Table('buildsets', metadata, autoload=True) - - cons = constraint.ForeignKeyConstraint([buildsets_table.c.sourcestampsetid], [sourcestampsets_table.c.id]) - cons.create() - - # Add sourcestampsetid including index to sourcestamps table - ss_sourcestampsetid = sa.Column('sourcestampsetid', sa.Integer) - ss_sourcestampsetid.create(sourcestamps_table) - - # Update the setid to the same value as sourcestampid - migrate_engine.execute(str(sourcestamps_table.update().values(sourcestampsetid=sourcestamps_table.c.id))) - ss_sourcestampsetid.alter(nullable=False) - - # Data is up to date, now force integrity - cons = constraint.ForeignKeyConstraint([sourcestamps_table.c.sourcestampsetid], [sourcestampsets_table.c.id]) - cons.create() - - # Add index for performance reasons to find all sourcestamps in a set quickly - idx = sa.Index('sourcestamps_sourcestampsetid', sourcestamps_table.c.sourcestampsetid, unique=False) - idx.create() diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/019_merge_schedulers_to_objects.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/019_merge_schedulers_to_objects.py deleted file mode 100644 index bd2cc5c7..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/019_merge_schedulers_to_objects.py +++ /dev/null @@ -1,75 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - # autoload the tables that are only referenced here - sa.Table('changes', metadata, autoload=True) - sa.Table('buildsets', metadata, autoload=True) - sa.Table("objects", metadata, autoload=True) - - # drop all tables. Schedulers will re-populate on startup - - scheduler_changes_tbl = sa.Table('scheduler_changes', metadata, - sa.Column('schedulerid', sa.Integer), - # ... - ) - scheduler_changes_tbl.drop() - metadata.remove(scheduler_changes_tbl) - - scheduler_upstream_buildsets_tbl = sa.Table('scheduler_upstream_buildsets', - metadata, - sa.Column('buildsetid', sa.Integer), - # ... - ) - scheduler_upstream_buildsets_tbl.drop() - metadata.remove(scheduler_upstream_buildsets_tbl) - - schedulers_tbl = sa.Table("schedulers", metadata, - sa.Column('schedulerid', sa.Integer), - # ... - ) - schedulers_tbl.drop() - metadata.remove(schedulers_tbl) - - # schedulers and scheduler_upstream_buildsets aren't coming back, but - # scheduler_changes is -- along with its indexes - - scheduler_changes_tbl = sa.Table('scheduler_changes', metadata, - sa.Column('objectid', sa.Integer, - sa.ForeignKey('objects.id')), - sa.Column('changeid', sa.Integer, - sa.ForeignKey('changes.changeid')), - sa.Column('important', sa.Integer), - ) - scheduler_changes_tbl.create() - - idx = sa.Index('scheduler_changes_objectid', - scheduler_changes_tbl.c.objectid) - idx.create() - - idx = sa.Index('scheduler_changes_changeid', - scheduler_changes_tbl.c.changeid) - idx.create() - - idx = sa.Index('scheduler_changes_unique', - scheduler_changes_tbl.c.objectid, - scheduler_changes_tbl.c.changeid, unique=True) - idx.create() - diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/020_remove_change_links.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/020_remove_change_links.py deleted file mode 100644 index a955b4c5..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/020_remove_change_links.py +++ /dev/null @@ -1,23 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - metadata = sa.MetaData() - metadata.bind = migrate_engine - - tbl = sa.Table('change_links', metadata, autoload=True) - tbl.drop() diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/021_fix_postgres_sequences.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/021_fix_postgres_sequences.py deleted file mode 100644 index f412073d..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/021_fix_postgres_sequences.py +++ /dev/null @@ -1,52 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - # see bug #2119 - - # this only applies to postgres - if migrate_engine.dialect.name != 'postgresql': - return - - metadata = sa.MetaData() - metadata.bind = migrate_engine - - to_fix = [ - 'buildrequests.id', - 'builds.id', - 'buildsets.id', - 'changes.changeid', - 'patches.id', - 'sourcestampsets.id', - 'sourcestamps.id', - 'objects.id', - 'users.uid', - ] - - for col in to_fix: - tbl_name, col_name = col.split('.') - tbl = sa.Table(tbl_name, metadata, autoload=True) - col = tbl.c[col_name] - - res = migrate_engine.execute(sa.select([ sa.func.max(col) ])) - max = res.fetchall()[0][0] - - if max: - seq_name = "%s_%s_seq" % (tbl_name, col_name) - r = migrate_engine.execute("SELECT setval('%s', %d)" - % (seq_name, max)) - r.close() diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/022_add_codebase.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/022_add_codebase.py deleted file mode 100644 index 7f03efc0..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/022_add_codebase.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 - -import sqlalchemy as sa - -def upgrade(migrate_engine): - - metadata = sa.MetaData() - metadata.bind = migrate_engine - - sourcestamps_table = sa.Table('sourcestamps', metadata, autoload=True) - changes_table = sa.Table('changes', metadata, autoload=True) - - - # Add codebase to tables - ss_codebase = sa.Column('codebase', sa.String(length=256), nullable=False, - server_default=sa.DefaultClause("")) - ss_codebase.create(sourcestamps_table) - - c_codebase = sa.Column('codebase', sa.String(length=256), nullable=False, - server_default=sa.DefaultClause("")) - c_codebase.create(changes_table) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/__init__.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/db/migrate/versions/__init__.py +++ /dev/null |