Skip to content

Support storing Uuids as SQLite TEXT columns #2717

@raffomania

Description

@raffomania

Motivation

Storing Uuids as TEXT columns in SQLite has two advantages:

  • Easier to debug the DB using the sqlite3 command directly
  • Allows for queries like WHERE id IN (<uuid>, <uuid>, ...) which are hard (maybe impossible?) to write with BLOB values

Proposed Solutions

I have multiple ideas for solving this:

  • sqlx will store fmt Uuid types such as Hyphenated as TEXT. SeaORM already supports using these types for column definitions, but still stores them as BLOB (tested with version 1.1.15). SeaORM could store them as text instead.
  • Allow overriding the column type of any Uuid column:
    #[sea_orm(column_type = "Text")]
    pub id: Uuid
    On 1.1.15 this compiles, but still tries to store the Uuid as BLOB at runtime.

Are there thoughts on this? If anybody can give me a hint on which solution would be preferred, I could try to open a PR :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions