Skip to content

Commit

Permalink
services/postgresql: Use functions as defaults instead of mutable types
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Apr 2, 2024
1 parent c47afe2 commit eec1a7f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions docs/services/postgresql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Define tables
- In PostgreSQL, use ``TEXT`` instead of other character types, as there is `no performance difference <https://www.postgresql.org/docs/current/datatype-character.html>`__.
- Use ``NOT NULL`` with character types, `as recommended by Django <https://docs.djangoproject.com/en/4.2/ref/models/fields/#null>`__.
- Use ``NOT NULL`` with JSON types, and set the default to an empty object, array or string.
- In Python, do not set default values to ``{}`` or ``[]``. In Django, use ``default=dict`` and ``default=list``. In Pydantic (including SQLModel), use ``default_factory=dict`` and ``default_factory=list``.

.. seealso::

Expand Down

0 comments on commit eec1a7f

Please sign in to comment.