Skip to content

Commit

Permalink
Ignore newlines in expressions for Computed
Browse files Browse the repository at this point in the history
Fixes #1391
  • Loading branch information
Georg Wicke-Arndt committed Jan 9, 2024
1 parent abc8002 commit 6995924
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion alembic/autogenerate/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ def _normalize_computed_default(sqltext: str) -> str:
"""

return re.sub(r"[ \(\)'\"`\[\]]", "", sqltext).lower()
return re.sub(r"[ \(\)'\"`\[\]\t\r\n]", "", sqltext).lower()


def _compare_computed_default(
Expand Down
1 change: 1 addition & 0 deletions alembic/testing/suite/test_autogen_computed.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def test_cant_change_computed_warning(self, test_case):
lambda: (None, None),
lambda: (sa.Computed("5"), sa.Computed("5")),
lambda: (sa.Computed("bar*5"), sa.Computed("bar*5")),
lambda: (sa.Computed("bar*5"), sa.Computed("bar * \r\n\t5")),
(
lambda: (sa.Computed("bar*5"), None),
config.requirements.computed_doesnt_reflect_as_server_default,
Expand Down

0 comments on commit 6995924

Please sign in to comment.