update setup; update db_model
This commit is contained in:
parent
5b2c5e6c77
commit
eb1644736c
|
@ -3,10 +3,13 @@ from sqlalchemy.ext.declarative import declarative_base
|
|||
from datetime import datetime
|
||||
|
||||
BaseModel = declarative_base()
|
||||
metadata = BaseModel.metadata
|
||||
|
||||
|
||||
class BaseCrud(BaseModel):
|
||||
|
||||
__abstract__ = True
|
||||
|
||||
# 硬删除
|
||||
def delete(self, session, commit=False):
|
||||
session.delete(self)
|
||||
|
@ -47,6 +50,8 @@ class BaseCrud(BaseModel):
|
|||
|
||||
class InfoCrud(BaseModel):
|
||||
|
||||
__abstract__ = True
|
||||
|
||||
create_time = Column(DateTime(), default=func.now())
|
||||
update_time = Column(DateTime(), default=func.now(), onupdate=func.now())
|
||||
delete_time = Column(DateTime())
|
||||
|
|
Loading…
Reference in New Issue