Skip to content
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

MSSQL uuid column showing as length 16 rather than 36 #22180

Open
dariusj18 opened this issue Apr 11, 2024 · 2 comments
Open

MSSQL uuid column showing as length 16 rather than 36 #22180

dariusj18 opened this issue Apr 11, 2024 · 2 comments

Comments

@dariusj18
Copy link

Describe the Bug

On an MSSQL database, directus is showing a length of 16 (and limiting the input field to 16 characters) for fields set with a type of UUID.

To Reproduce

Add a new uuid field to a table

Directus Version

10.10.5

Hosting Strategy

Self-Hosted (Docker Image)

@dariusj18
Copy link
Author

This appears to be because MSSQL is reporting the max_length as 16 in the sys.columns table. I assume because it is stored internally as a binary(16) rather than a char(36).

Should be as easy to fix as adding

if (rawColumn.data_type === 'uniqueidentifier') {
    return 36;
}

to the mssql.ts dialect's parseMaxLength() function

@dariusj18
Copy link
Author

Another thing to consider is that if a schema export contains the max_length of 16 directus will also need to know that it should ahve been 36 and not try and make changes to preexisting columns when that difference is detected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants