mirror of
https://github.com/fastapi/sqlmodel.git
synced 2025-08-14 17:41:37 +08:00
Add sa_type to Field
This commit is contained in:
@ -372,6 +372,8 @@ class SQLModelMetaclass(ModelMetaclass, DeclarativeMeta):
|
||||
|
||||
|
||||
def get_sqlachemy_type(field: ModelField) -> Any:
|
||||
if "sa_type" in field.field_info.extra:
|
||||
return field.field_info.extra["sa_type"]
|
||||
if issubclass(field.type_, str):
|
||||
if field.field_info.max_length:
|
||||
return AutoString(length=field.field_info.max_length)
|
||||
|
Reference in New Issue
Block a user