-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" Fill empty widget titles | ||
Revision ID: db737a0db061 | ||
Revises: df73727dc6d9b7_add_sub_tbl | ||
Create Date: 2023-08-04 14:11:01.993136 | ||
""" | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'db737a0db061' | ||
down_revision = 'df73727dc6d9b7_add_sub_tbl' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
|
||
# Execute an UPDATE statement to set 'title' based on 'widget_type_id' | ||
op.execute(""" | ||
UPDATE widget | ||
SET title = | ||
CASE | ||
WHEN widget_type_id = 1 THEN 'Who is Listening' | ||
WHEN widget_type_id = 2 THEN 'Documents' | ||
WHEN widget_type_id = 3 THEN 'Environmental Assessment Process' | ||
WHEN widget_type_id = 4 THEN 'Sign Up for Updates' | ||
WHEN widget_type_id = 5 THEN 'Events' | ||
WHEN widget_type_id = 6 THEN 'Map' | ||
WHEN widget_type_id = 7 THEN 'Video' | ||
ELSE 'Default Title' -- This is for any widget_type_id not covered above | ||
END | ||
WHERE title IS NULL; | ||
""") | ||
|
||
# ### end Alembic commands ### | ||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
|
||
# Execute an UPDATE statement to set 'title' to NULL for all rows | ||
op.execute("UPDATE widget SET title = NULL;") | ||
|
||
# ### end Alembic commands ### |