File tree 3 files changed +11
-2
lines changed
3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1
1
# Bixomix Changelog
2
2
3
+ ## Unreleased
4
+
5
+ * Document ` UpdatedAtMixin ` ’s incompatibility with Postgres (#1 )
6
+
3
7
## 0.1.0 (2023/03/30)
4
8
5
9
Initial public version.
Original file line number Diff line number Diff line change @@ -33,5 +33,6 @@ class MyModel(Base, CreatedAtMixin):
33
33
## Mixins
34
34
35
35
* ` CreatedAtMixin ` : add a ` created_at ` datetime field that’s automatically filled with the record’s creation date
36
- * ` UpdatedAtMixin ` : add an ` updated_at ` datetime field that’s automatically filled with the record’s last update date
36
+ * ` UpdatedAtMixin ` : add an ` updated_at ` datetime field that’s automatically filled with the record’s last update date.
37
+ Note this doesn't work on Postgres; you have to [ create a trigger] ( https://stackoverflow.com/a/71072370/735926 ) .
37
38
* ` CreatedUpdatedAtMixin ` : combined version of the previous two mixins
Original file line number Diff line number Diff line change @@ -10,7 +10,11 @@ class CreatedAtMixin:
10
10
11
11
12
12
class UpdatedAtMixin :
13
- """SQLAlchemy mixin to add an `updated_at` datetime field to a table."""
13
+ """
14
+ SQLAlchemy mixin to add an `updated_at` datetime field to a table that’s set to `NOW()` every time the row is updated.
15
+ Note that on Postgres this creates the column but doesn't update it.
16
+ See https://stackoverflow.com/a/71072370/735926 for a possible solution.
17
+ """
14
18
# NOTE:
15
19
# server_default= tells the DB the default column value while default= sets the default value at the ORM level.
16
20
# onupdate= sets the value on record update at the ORM level.
You can’t perform that action at this time.
0 commit comments