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

Remove StringLength attributes from Entities #2046

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

Masterjun3
Copy link
Collaborator

This PR removes the string length attributes and makes an empty migration, only changing the model snapshot.

We use postgres columns text (or rather citext) which doesn't have string limits.
And we don't need a limited string type, as per the docs:

While character(n) has performance advantages in some other database systems, there is no such advantage in PostgreSQL; in fact character(n) is usually the slowest of the three because of its additional storage costs. In most situations text or character varying should be used instead.

I haven't found any uses of direct Entity types for form binding (this would cause client and server validation to be removed by this PR). We basically always use a separate model for that.
Those models now technically don't need the StringLength either, but even though we can store any lenghts, we still don't need to allow users to spam us with massive strings.

…postgres text (or rather citext) which doesn't have string limits anyway
@adelikat adelikat self-requested a review November 26, 2024 19:01
@adelikat adelikat merged commit 868de53 into main Nov 26, 2024
1 check passed
@adelikat adelikat deleted the remove-stringlength-from-entities branch November 26, 2024 19:01
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

Successfully merging this pull request may close these issues.

2 participants