Closed flapili closed 4 years ago
Hi, I have some difficulty with datetime default values and update's trigger
from what I understand I can handle default value with server_default=now but how handle update?
server_default=now
as example in this schema
class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True) created_at = db.Column(db.DateTime, nullable=False, server_default="now") updated_at = db.Column(db.DateTime, nullable=False, server_default="now", onupdate=datetime.datetime.now)
but the problem is the onupdate is manager by python and not by postgress, so is it possible with Gino to define the onupdate trigger ?
I would recommend the use of database trigger. You may create triggers using Alembic.
Closing due to inactivity. Feel free to reopen.
Hi, I have some difficulty with datetime default values and update's trigger
from what I understand I can handle default value with
server_default=now
but how handle update?as example in this schema
but the problem is the onupdate is manager by python and not by postgress, so is it possible with Gino to define the onupdate trigger ?