Add timestamps to workspace
This commit is contained in:
7
atst/models/mixins.py
Normal file
7
atst/models/mixins.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from sqlalchemy import Column, func, TIMESTAMP
|
||||
|
||||
|
||||
class TimestampsMixin(object):
|
||||
time_created = Column(TIMESTAMP(timezone=True), nullable=False, server_default=func.now())
|
||||
time_updated = Column(TIMESTAMP(timezone=True), nullable=False, server_default=func.now(), onupdate=func.current_timestamp())
|
||||
|
@@ -3,9 +3,10 @@ from sqlalchemy.orm import relationship
|
||||
|
||||
from atst.models import Base
|
||||
from atst.models.types import Id
|
||||
from atst.models.mixins import TimestampsMixin
|
||||
|
||||
|
||||
class Workspace(Base):
|
||||
class Workspace(Base, TimestampsMixin):
|
||||
__tablename__ = "workspaces"
|
||||
|
||||
id = Id()
|
||||
|
Reference in New Issue
Block a user