Project

Profile

Help

Task #5609

closed

Convert CharField to TextField where it makes sense to do so

Added by dalley about 5 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

Originally we had many TextFields that were converted to CharField because MySQL cannot index on TextField. However, it's no longer necessary after we decided to use PostgreSQL only.

Since "text" and "varchar" are identical in PostgreSQL, the only real benefit is removing the arbitrary 255 character limitation which is the maximum Django allows. Efficiency wise they are both essentially identical (technically speaking varchar is a little slower for the length checks).

For some fields like digests, it might make sense to keep the CharField with max length because it provides a little bit of schema information. But unless the field length actually needs to be bounded, TextField would make more sense.

Also available in: Atom PDF