|
|
|
|
|
by nickjj
2039 days ago
|
|
I don't know about Django's ORM but normally I would use a TEXT field and then set a separate char_length CONSTRAINT on the field. I think it's important to have the length constraint at the database level for data consistency's sake. Then you can choose to add in app level validations to make more friendly user error messages. Changing a constraint's length is also a much easier database operation vs. changing a varchar's length. |
|
With a check constraint, we can use `NOT VALID` with a separate `VALIDATE` call, while a change to the varchar length requires an `ACCESS EXCLUSIVE` lock.