Skip to content

Commit

Permalink
use max_length argument as varchar length
Browse files Browse the repository at this point in the history
  • Loading branch information
itsbekas committed Apr 13, 2024
1 parent 27ae20a commit 2dfc84c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sqlmodel/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ def get_field_metadata(field: Any) -> Any:
for meta in field.metadata:
if isinstance(meta, PydanticMetadata):
return meta
return FakeMetadata()
fake = FakeMetadata()
fake.max_length = getattr(meta, "max_length", None)
return fake

def post_init_field_info(field_info: FieldInfo) -> None:
return None
Expand Down

0 comments on commit 2dfc84c

Please sign in to comment.