forked from onyx-dot-app/onyx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix slackbot channel config nullable (onyx-dot-app#3363)
* fix slackbot * nit
- Loading branch information
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
backend/alembic/versions/f7a894b06d02_non_nullbale_slack_bot_id_in_channel_.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 @@ | ||
"""non-nullbale slack bot id in channel config | ||
Revision ID: f7a894b06d02 | ||
Revises: 9f696734098f | ||
Create Date: 2024-12-06 12:55:42.845723 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "f7a894b06d02" | ||
down_revision = "9f696734098f" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# Delete all rows with null slack_bot_id | ||
op.execute("DELETE FROM slack_channel_config WHERE slack_bot_id IS NULL") | ||
|
||
# Make slack_bot_id non-nullable | ||
op.alter_column( | ||
"slack_channel_config", | ||
"slack_bot_id", | ||
existing_type=sa.Integer(), | ||
nullable=False, | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
# Make slack_bot_id nullable again | ||
op.alter_column( | ||
"slack_channel_config", | ||
"slack_bot_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