diff --git a/CHANGELOG.md b/CHANGELOG.md index ce6d0c7..eb7c09a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -* Document `UpdatedAtMixin`’s incompatibility with Postgres (#1) +* Document `UpdatedAtMixin`’s compatibility with Postgres (#1) ## 0.1.0 (2023/03/30) diff --git a/README.md b/README.md index 04c8b1c..1627e11 100644 --- a/README.md +++ b/README.md @@ -34,5 +34,5 @@ class MyModel(Base, CreatedAtMixin): * `CreatedAtMixin`: add a `created_at` datetime field that’s automatically filled with the record’s creation date * `UpdatedAtMixin`: add an `updated_at` datetime field that’s automatically filled with the record’s last update date. - Note this doesn't work on Postgres; you have to [create a trigger](https://stackoverflow.com/a/71072370/735926). + Note that on Postgres this is done in Python; for a database-level update you have to [create a trigger](https://stackoverflow.com/a/71072370/735926). * `CreatedUpdatedAtMixin`: combined version of the previous two mixins diff --git a/bixomix/dates.py b/bixomix/dates.py index c74f87f..26f54f6 100644 --- a/bixomix/dates.py +++ b/bixomix/dates.py @@ -12,7 +12,8 @@ class CreatedAtMixin: class UpdatedAtMixin: """ SQLAlchemy mixin to add an `updated_at` datetime field to a table that’s set to `NOW()` every time the row is updated. - Note that on Postgres this creates the column but doesn't update it. + Note that on Postgres this creates the column but update it only from Python. If you need database-level update, use + a trigger. See https://stackoverflow.com/a/71072370/735926 for a possible solution. """ # NOTE: