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

Identifier fields should always be case sensitive #16

Closed
ormsbee opened this issue Aug 2, 2022 · 2 comments
Closed

Identifier fields should always be case sensitive #16

ormsbee opened this issue Aug 2, 2022 · 2 comments

Comments

@ormsbee
Copy link
Contributor

ormsbee commented Aug 2, 2022

Identifier fields (strings that are local to some context, like usage keys) should be case-sensitive. Right now, it will or won't be depending on the default collation and the database in question. This will lead to conflicting behavior between SQLite (case-sensitive) and MySQL (case-insensitive). Using the db_collation attribute is tempting, but these values are not standardized across databases, which would complicate things when using SQLite vs. MySQL even in day to day dev and testing (never mind the possibility of Postgres).

Investigate what it would take to make a field type that know how to run migrations to set the collation of a field based on the database and database collation settings (so utf8mb4 would map to utf8mb4_bin, but utf8 maps to utf8_bin).

@ormsbee
Copy link
Contributor Author

ormsbee commented Aug 2, 2022

Actually, it might be better for the collation to be case-and-accent-sensitive text collation rather than straight binary, since we might want to group upper and lower case letters next to each other in listings where the identifiers are semi-human-readable.

@ormsbee
Copy link
Contributor Author

ormsbee commented Jan 3, 2024

This was addressed by creating the collation-aware MultiCollationCharField and MultiCollationTextField along with their underlying collations,py module.

@ormsbee ormsbee closed this as completed Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant