summaryrefslogtreecommitdiffstats
path: root/openstack/common/db
diff options
context:
space:
mode:
authorZhongyue Luo <zhongyue.nah@intel.com>2013-04-10 10:31:03 +0800
committerZhongyue Luo <zhongyue.nah@intel.com>2013-04-11 09:03:02 +0800
commitfa84da27458847d90075c9f8d77333b532d7882a (patch)
tree436a9091d6726bb540fd23b36f58002522f0d2be /openstack/common/db
parent9dcf688ea80f52cdb5413514198b2aa81d5a4e09 (diff)
downloadoslo-fa84da27458847d90075c9f8d77333b532d7882a.tar.gz
oslo-fa84da27458847d90075c9f8d77333b532d7882a.tar.xz
oslo-fa84da27458847d90075c9f8d77333b532d7882a.zip
Removes created_at, updated_at from ModelBase
Created a 'TimestampMixin' class. Next step is to update Nova which is the only project using oslo.db Fixes bug #1119702 Change-Id: I1ffcc09a2971e6e6102da7ecb855a2837a159baf
Diffstat (limited to 'openstack/common/db')
-rw-r--r--openstack/common/db/sqlalchemy/models.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/openstack/common/db/sqlalchemy/models.py b/openstack/common/db/sqlalchemy/models.py
index f674da2..e019eed 100644
--- a/openstack/common/db/sqlalchemy/models.py
+++ b/openstack/common/db/sqlalchemy/models.py
@@ -33,8 +33,6 @@ from openstack.common import timeutils
class ModelBase(object):
"""Base class for models."""
__table_initialized__ = False
- created_at = Column(DateTime, default=timeutils.utcnow)
- updated_at = Column(DateTime, onupdate=timeutils.utcnow)
metadata = None
def save(self, session=None):
@@ -92,6 +90,11 @@ class ModelBase(object):
return local.iteritems()
+class TimestampMixin(object):
+ created_at = Column(DateTime, default=timeutils.utcnow)
+ updated_at = Column(DateTime, onupdate=timeutils.utcnow)
+
+
class SoftDeleteMixin(object):
deleted_at = Column(DateTime)
deleted = Column(Integer, default=0)