-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Service.desc nullable and optional
Signed-off-by: Aurélien Bompard <[email protected]>
- Loading branch information
Showing
4 changed files
with
46 additions
and
9 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
37 changes: 37 additions & 0 deletions
37
webhook_to_fedora_messaging/migrations/versions/4f1f49d72fa8_service_desc_can_be_null.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,37 @@ | ||
# SPDX-FileCopyrightText: Contributors to the Fedora Project | ||
# | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
"""Service.desc can be null | ||
Revision ID: 4f1f49d72fa8 | ||
Revises: 6c01198723a8 | ||
Create Date: 2024-08-22 11:29:19.880261 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy_helpers.manager import is_sqlite | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "4f1f49d72fa8" | ||
down_revision = "6c01198723a8" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
connection = op.get_bind() | ||
if is_sqlite(connection): | ||
connection.execute(sa.text("PRAGMA foreign_keys=OFF")) | ||
with op.batch_alter_table("services") as batch_op: | ||
batch_op.alter_column("desc", existing_type=sa.TEXT(), nullable=True) | ||
|
||
|
||
def downgrade(): | ||
connection = op.get_bind() | ||
if is_sqlite(connection): | ||
connection.execute(sa.text("PRAGMA foreign_keys=OFF")) | ||
with op.batch_alter_table("services") as batch_op: | ||
batch_op.alter_column("desc", existing_type=sa.TEXT(), nullable=False) |
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