tortoise / tortoise/tortoise-orm

Change restrictions on Charfield, Textfield

Open
#384 5 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.