Skip to content

Migrate to UUID from PostgreSQL's serial auto incrementing ID #3

Description

@myndaaa

Currently, the SQLAlchemy models use Integer as the primary key (id) for most tables, including sensitive user-facing ones like User, Playlist, Song, etc. This exposes internal sequence and can lead to security/privacy concerns when surfaced in public APIs (e.g., GET /users/17).

Replacing id: Integer with UUID:

  • Changing primary keys to UUID(as_uuid=True) using default=uuid.uuid4.
  • Updating Alembic migrations, Pydantic schemas, and CRUD logic accordingly.
  • Benefits: no ID guessing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is neededquestionFurther information is requested

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions