{{{#!python
class MyModel(models.Model):
name = models.CharField()
}}}
The developer who knows that SQLite can store unlimited characters would
be surprised in such cases.
I suggest allowing unlimited characters for SQLite, like we do for
PostgreSQL.
Relevant PostgreSQL ticket: https://code.djangoproject.com/ticket/14094
--
Ticket URL: <https://code.djangoproject.com/ticket/34887>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Kar Petrosyan
--
Ticket URL: <https://code.djangoproject.com/ticket/34887#comment:1>
* status: assigned => closed
* resolution: => wontfix
* component: Uncategorized => Database layer (models, ORM)
Comment:
SQLite has limited number of datatypes, and there is no difference between
`TEXT` and `VARCHAR` (no declared max length), both would be stored in the
`TEXT` datatype. You can use `TextField` for unlimited `CharField`.
--
Ticket URL: <https://code.djangoproject.com/ticket/34887#comment:2>
Comment (by karosis88):
Replying to [comment:2 Mariusz Felisiak]:
> SQLite has limited number of datatypes, and there is no difference
between `TEXT` and `VARCHAR` (no declared max length), both would be
stored in the `TEXT` datatype. You can use `TextField` for unlimited
`CharField`.
Does it really solve the problem? I want to use CharField and not
TextField (when using sqlite3 for the startup but planning to migrate to
another DBMS).
In such cases, I can use CharField (max_length = 1), but it wouldn't make
any sense for the reviewer.
--
Ticket URL: <https://code.djangoproject.com/ticket/34887#comment:3>
Comment (by Mariusz Felisiak):
Replying to [comment:3 karosis88]:
> Does it really solve the problem?
Yes.
> I want to use CharField and not TextField (when using sqlite3 for the
startup but planning to migrate to another DBMS).
> In such cases, I can use CharField (max_length = 1), but it wouldn't
make any sense for the reviewer.
There is no way to switch between databases without changing anything.
It's recommended to use the same database in development and production
environments, unless you're aware of all migration caveats. We accepted
#14094, because `CharField` and `TextField` use different datatypes on
PostgreSQL.
--
Ticket URL: <https://code.djangoproject.com/ticket/34887#comment:4>