forked from fedora-infra/bodhi
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The updates.title field used to be a space separated list of the builds found in the update, with a uniqueness constraint. There were at least two problems with it. One problem was that the list of builds was not consistently updated (fedora-infra#1946) and sometimes the title did not reflect the current set of builds in the update. This was more severe than it may seem, because it turns out that the CLI was using the title to set the list of builds when editing updates, instead of using the list of builds. This means that the CLI could set the list of builds back to a former set, rather than leaving it at the set it was currently at. Note that the CLI does not currently support editing the set of builds on an update (fedora-infra#3037), so it is especially surprising when this happens. The second problem is that large updates with many builds end up generating a very long title and PostgreSQL raises an error because it refuses to index strings beyond a certain length. It was found, for example, that release engineering could not create an update with 300 builds in it. Since we plan to use Bodhi to work with side tags as part of gating Fedora Rawhide, it will be important for users to be able to create updates with large numbers of builds. The title was also not a particularly useful field. It was possible to use it as a key to access an update, but that was a poor use for it since the title changes when the list of builds change, and because the order of the list of builds was important. This led to unpredictable and unstable URLs for updates, and Bodhi already had an update alias field which is stable and is better suited for that purpose. This commit drops the field from the database and removes it from being used to reference updates in the API. It preserves it in API responses, however, but now generates it dynamically so that the title is always an accurate list of the builds included in the update. fixes fedora-infra#186 fixes fedora-infra#1542 fixes fedora-infra#1946 Signed-off-by: Randy Barlow <[email protected]>
- Loading branch information
1 parent
0f3dac3
commit d190155
Showing
36 changed files
with
433 additions
and
705 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
bodhi/server/migrations/versions/58b7919b942c_remove_the_updates_title_column.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# 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. | ||
""" | ||
Remove the updates.title column. | ||
Revision ID: 58b7919b942c | ||
Revises: aae0d29d49b7 | ||
Create Date: 2019-02-20 17:13:01.260748 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '58b7919b942c' | ||
down_revision = 'eec610d7ab3a' | ||
|
||
|
||
def upgrade(): | ||
"""Drop the updates.title column.""" | ||
op.alter_column('updates', 'alias', existing_type=sa.BOOLEAN(), nullable=False) | ||
op.drop_index('ix_updates_title', table_name='updates') | ||
op.drop_column('updates', 'title') | ||
|
||
|
||
def downgrade(): | ||
"""Bring back the updates.title column and try to guess what it should be set to.""" | ||
op.add_column('updates', sa.Column('title', sa.TEXT(), autoincrement=False, nullable=True)) | ||
# Set the title back to something similar to what it might have been. This isn't guaranteed to | ||
# be the title it was before, because we can't know what order the nvrs appeared in, but it will | ||
# set it to the expected format and expected set of NVRs. Single build updates should at least | ||
# get their old title back. | ||
op.execute( | ||
("UPDATE updates SET title=(" | ||
"SELECT string_agg(nvr, ' ') as title FROM (" | ||
"SELECT builds.nvr FROM builds WHERE update_id=updates.id ORDER BY nvr) as nvr)")) | ||
op.create_index('ix_updates_title', 'updates', ['title'], unique=True) | ||
op.alter_column('updates', 'alias', existing_type=sa.BOOLEAN(), nullable=True) |
Oops, something went wrong.