Skip to content

Commit

Permalink
upgrade db to add index to steps
Browse files Browse the repository at this point in the history
  • Loading branch information
bertranddemiddelaer committed Jun 20, 2019
1 parent c6c0949 commit 16800f1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions master/buildbot/db/migrate/versions/054_add_index_to_steps.py
@@ -0,0 +1,30 @@
# 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 buildbot.util import sautils


def upgrade(migrate_engine):
metadata = sa.MetaData()
metadata.bind = migrate_engine

steps = sautils.Table('steps', metadata, autoload=True)

idx = sa.Index('steps_started_at',
steps.c.started_at)
idx.create()

0 comments on commit 16800f1

Please sign in to comment.