Skip to content

Commit

Permalink
Add an index on builds.update_id.
Browse files Browse the repository at this point in the history
Signed-off-by: Randy Barlow <[email protected]>
  • Loading branch information
bowlofeggs committed Feb 20, 2019
1 parent 16136e0 commit 0f3dac3
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2019 Red Hat, Inc.
#
# This file is part of Bodhi.
#
# This program 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; either version 2
# of the License, or (at your option) any later version.
#
# 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.
"""
Index the builds.update_id column.
Revision ID: eec610d7ab3a
Revises: aae0d29d49b7
Create Date: 2019-02-20 20:18:02.474734
"""
from alembic import op


# revision identifiers, used by Alembic.
revision = 'eec610d7ab3a'
down_revision = 'aae0d29d49b7'


def upgrade():
"""Add an index on builds.update_id."""
op.create_index(op.f('ix_builds_update_id'), 'builds', ['update_id'], unique=False)


def downgrade():
"""Drop the index on builds.update_id."""
op.drop_index(op.f('ix_builds_update_id'), table_name='builds')
2 changes: 1 addition & 1 deletion bodhi/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ class Build(Base):
package_id = Column(Integer, ForeignKey('packages.id'), nullable=False)
release_id = Column(Integer, ForeignKey('releases.id'))
signed = Column(Boolean, default=False, nullable=False)
update_id = Column(Integer, ForeignKey('updates.id'))
update_id = Column(Integer, ForeignKey('updates.id'), index=True)

release = relationship('Release', backref='builds', lazy=False)

Expand Down

0 comments on commit 0f3dac3

Please sign in to comment.