Skip to content

fix table name and column #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions fastapi_users_db_sqlalchemy/access_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
class SQLAlchemyBaseAccessTokenTable(Generic[ID]):
"""Base SQLAlchemy access token table definition."""

__tablename__ = "accesstoken"
__tablename__ = "at"

if TYPE_CHECKING: # pragma: no cover
token: str
created_at: datetime
user_id: ID
else:
token: Mapped[str] = mapped_column(String(length=43), primary_key=True)
created_at: Mapped[datetime] = mapped_column(
token: Mapped[str] = mapped_column("t", String(length=43), primary_key=True)
created_at: Mapped[datetime] = mapped_column("ca",
TIMESTAMPAware(timezone=True), index=True, nullable=False, default=now_utc
)

Expand All @@ -34,7 +34,7 @@ class SQLAlchemyBaseAccessTokenTableUUID(SQLAlchemyBaseAccessTokenTable[uuid.UUI

@declared_attr
def user_id(cls) -> Mapped[GUID]:
return mapped_column(
return mapped_column("ui",
GUID, ForeignKey("user.id", ondelete="cascade"), nullable=False
)

Expand Down