sequelize / sequelize/sequelize

Suggestion: Please support DataTypes.UUID.BINARY

Open
#9,271 23 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dialect: mysql status: understood type: feature
Dominant language
TypeScript
Stars
30.4k
Forks
4.3k
Avg merge
1d 6h
Merged PRs (30d)
68

Description

From the documentation

The CHAR and STRING types expose the BINARY property

I think this is also needed for UUID data type so we can store it as BINARy(16) is MySQL.

for example:

sequelize.define('model',` {
  uuid: {
    type: DataTypes.UUID.BINARY,
    defaultValue: DataTypes.UUIDV4,
    primaryKey: true
  }
})

I could not find any way to map a UUID field to BINARY(16) on MySQL. DataTypes.UUID and DataType.STRING.BINARY give ER_DATA_TOO_LONG error code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the UUID data type implementation and the MySQL dialect handling for binary types. Reproduce the reported ER_DATA_TOO_LONG error with the example model, then trace how UUID and BINARY types are rendered. Done means UUID.BINARY is supported for MySQL as BINARY(16), with coverage for the resulting definition.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, typescript
Domain
database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.