Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make builds.package_id non-nullable.
While writing tests for the validators, I came across some untested code that was checking to make sure that Builds had Pacages associated with them. Since it would be an error for a Build to be unassociated with a Package, I opted to delete that check and instead make the foreign key non-nullable in the database. Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
- Loading branch information
1 parent
3b655f2
commit e87201f
Showing
6 changed files
with
62 additions
and
12 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
bodhi/server/migrations/versions/865d9432fa7d_build_package_id_is_now_required.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,40 @@ | ||
# Copyright (c) 2017 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. | ||
""" | ||
build.package_id is now required. | ||
Revision ID: 865d9432fa7d | ||
Revises: 74cfbc6116ad | ||
Create Date: 2017-12-07 22:17:59.312908 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
revision = '865d9432fa7d' | ||
down_revision = '74cfbc6116ad' | ||
|
||
|
||
def upgrade(): | ||
"""Mark builds.package_id as non-nullable.""" | ||
op.alter_column('builds', 'package_id', existing_type=sa.INTEGER(), nullable=False) | ||
|
||
|
||
def downgrade(): | ||
"""Mark builds.package_id as nullable.""" | ||
op.alter_column('builds', 'package_id', existing_type=sa.INTEGER(), nullable=True) |
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