初始版本
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
"""
|
||||
用户模型
|
||||
"""
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from sqlmodel import SQLModel, Field
|
||||
|
||||
|
||||
class User(SQLModel, table=True):
|
||||
"""用户表"""
|
||||
__tablename__ = "users"
|
||||
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
username: str = Field(max_length=50, unique=True, index=True)
|
||||
email: Optional[str] = Field(default=None, max_length=100, unique=True, index=True)
|
||||
hashed_password: str
|
||||
created_at: datetime = Field(default_factory=datetime.now)
|
||||
|
||||
Reference in New Issue
Block a user