-
Notifications
You must be signed in to change notification settings - Fork 231
Switch from UUID v4 to v7 #186
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
Conversation
|
Added uuid6 to pyproject.toml; Module not found error resolved. |
|
|
Thanks, @Saiyashwanth7, I'll review it as soon as possible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the dev comments left in the code it seems to work well, just take them out, please
src/app/api/v1/users.py
Outdated
| return cast(UserRead, db_user) | ||
|
|
||
|
|
||
| # In src/app/api/v1/users.py, replace the patch_user function with this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take out the developer comments on the lines: 75, 89, 100, 105 and 110
src/app/api/dependencies.py
Outdated
|
|
||
| if user: | ||
| return cast(dict[str, Any], user) | ||
| # Ensure consistent return type - always return dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take out the developer comments on lines 37, 38 and 40
src/app/core/db/models.py
Outdated
| @@ -1,4 +1,5 @@ | |||
| import uuid as uuid_pkg | |||
| from uuid6 import uuid7 #126 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take out the developer comments
src/app/core/schemas.py
Outdated
| @@ -1,4 +1,5 @@ | |||
| import uuid as uuid_pkg | |||
| from uuid6 import uuid7 #126 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take out the developer comments
src/app/core/utils/cache.py
Outdated
| cursor, keys = await client.scan(cursor, match=pattern, count=100) | ||
| if keys: | ||
| await client.delete(*keys) | ||
| if cursor == 0: # cursor returns to 0 when scan is complete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take out the developer comments
src/app/models/post.py
Outdated
| @@ -1,7 +1,8 @@ | |||
| import uuid as uuid_pkg | |||
| from datetime import UTC, datetime | |||
| from uuid6 import uuid7 #126 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take out the developer comments
src/app/models/user.py
Outdated
|
|
||
| id: Mapped[int] = mapped_column("id", autoincrement=True, nullable=False, unique=True, primary_key=True, init=False) | ||
|
|
||
| # Option 1: Use integer ID as primary key (recommended for compatibility) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take out the developer comments
tests/test_user.py
Outdated
| sample_user_read.username = username # Make sure usernames match | ||
| user_update = UserUpdate(name="New Name") | ||
|
|
||
| # Convert the UserRead model to a dictionary for the mock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take out the developer comments on lines: 120, 122, 128 and 141

Switch from UUID v4 to v7
Resolves #126
Changes Made:
uuid_pkg.uuid4withuuid7fromuuid6package across 6 filesfrom uuid6 import uuid7