Skip to content

Commit

Permalink
Fix downgrades (#3667)
Browse files Browse the repository at this point in the history
* fix downgrade

* update test
  • Loading branch information
jowlee authored Aug 11, 2022
1 parent 424ff50 commit cff11a9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def downgrade():
"""
delete from notification
where type in (
'milestone',
'milestone'
);
"""
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,12 @@ def downgrade():
table_name="notification",
info={"if_exists": True},
)
op.drop_constraint(
"fk_notification_group_notification",
"notification_group",
"foreignkey",
info={"if_exists": True},
)
op.drop_constraint(
"uq_notification",
"notification",
info={"if_exists": True},
)
if foreign_key_exists("notification_group", "fk_notification_group_notification"):
op.drop_constraint(
"fk_notification_group_notification", "notification_group", "foreignkey"
)
if unique_constraints_exists("notification", "uq_notification"):
op.drop_constraint("uq_notification", "notification")

op.drop_table("notification", info={"if_exists": True})
op.drop_table("notification_group", info={"if_exists": True})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ def test_reaction_notification(app):
assert notifications[0].specifier == "1"
assert notifications[
0
].group_id == "reaction:reaction_to:react_0:reaction_type:type:reaction_value:1:timestamp:" + str(
now
].group_id == "reaction:reaction_to:react_0:reaction_type:type:reaction_value:1:timestamp:" + now.strftime(
"%Y-%m-%d %H:%M:%S.%f"
)
assert notifications[1].specifier == "2"
assert notifications[
1
].group_id == "reaction:reaction_to:react_1:reaction_type:type:reaction_value:1:timestamp:" + str(
now
].group_id == "reaction:reaction_to:react_1:reaction_type:type:reaction_value:1:timestamp:" + now.strftime(
"%Y-%m-%d %H:%M:%S.%f"
)
assert notifications[2].specifier == "3"
assert notifications[
2
].group_id == "reaction:reaction_to:react_2:reaction_type:type:reaction_value:1:timestamp:" + str(
now
].group_id == "reaction:reaction_to:react_2:reaction_type:type:reaction_value:1:timestamp:" + now.strftime(
"%Y-%m-%d %H:%M:%S.%f"
)
assert notifications[0].notification_group_id == None
assert notifications[0].type == "reaction"
Expand Down

0 comments on commit cff11a9

Please sign in to comment.