tortoise / tortoise/tortoise-orm
Change restrictions on Charfield, Textfield
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
CharField requires a max_length but not all databases mandate this. In Postgresql, the max_length can be optional. It would be nice to have support for the same functionality. Discussing it with @grigi brought up the idea of allowing max_length to be 0, in which case it will be unbounded if the database supports it.
TextField doesn't support any indexes currently. I think it should allow b-tree indexing. There are many use cases where b-tree index is useful, such as needing to perform prefix matches (textfield__startswith="..."). This is a separate use case from full-text search.
Wherever there are DB-specific implementation differences for Fields, the documentation should make it clear what restriction(s) apply across databases.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests. Start by tracing CharField max_length validation and TextField index handling across the database backends; done means supporting the requested PostgreSQL behavior where possible and documenting restrictions that differ between databases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100