1- import uuid
21from dataclasses import dataclass
32from datetime import datetime
43from uuid import UUID as UUID_Type
4+ from uuid_extensions import uuid7
55
66from sqlalchemy import DateTime , ForeignKey , func
77from sqlalchemy .ext .asyncio import AsyncAttrs
@@ -18,7 +18,7 @@ class Base(AsyncAttrs, DeclarativeBase):
1818class Author (Base ):
1919 __tablename__ = "authors"
2020
21- id : Mapped [UUID_Type ] = mapped_column (primary_key = True , insert_default = uuid . uuid7 )
21+ id : Mapped [UUID_Type ] = mapped_column (primary_key = True , insert_default = uuid7 )
2222 name : Mapped [str ] = mapped_column (unique = True , nullable = False )
2323 account_href : Mapped [str ] = mapped_column (unique = True , nullable = False )
2424 created_at : Mapped [datetime ] = mapped_column (
@@ -36,7 +36,7 @@ class Author(Base):
3636class Post (Base ):
3737 __tablename__ = "posts"
3838
39- id : Mapped [UUID_Type ] = mapped_column (primary_key = True , insert_default = uuid . uuid7 )
39+ id : Mapped [UUID_Type ] = mapped_column (primary_key = True , insert_default = uuid7 )
4040 url : Mapped [str ] = mapped_column (unique = True , nullable = False )
4141 published_at : Mapped [datetime ] = mapped_column (
4242 DateTime (timezone = True ), nullable = False
@@ -63,7 +63,7 @@ class Post(Base):
6363class Comment (Base ):
6464 __tablename__ = "comments"
6565
66- id : Mapped [UUID_Type ] = mapped_column (primary_key = True , insert_default = uuid . uuid7 )
66+ id : Mapped [UUID_Type ] = mapped_column (primary_key = True , insert_default = uuid7 )
6767 text_content : Mapped [str ] = mapped_column (nullable = False )
6868 published_at : Mapped [datetime ] = mapped_column (
6969 DateTime (timezone = True ), nullable = False
0 commit comments