Skip to content

Commit 812a668

Browse files
gcoternjouanin
authored andcommitted
Fix uuid7 import
1 parent 179baa8 commit 812a668

File tree

1 file changed

+4
-4
lines changed
  • backend/balanceteshaters/model

1 file changed

+4
-4
lines changed

backend/balanceteshaters/model/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import uuid
21
from dataclasses import dataclass
32
from datetime import datetime
43
from uuid import UUID as UUID_Type
4+
from uuid_extensions import uuid7
55

66
from sqlalchemy import DateTime, ForeignKey, func
77
from sqlalchemy.ext.asyncio import AsyncAttrs
@@ -18,7 +18,7 @@ class Base(AsyncAttrs, DeclarativeBase):
1818
class 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):
3636
class 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):
6363
class 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

Comments
 (0)