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
|
from datetime import datetime
|
||||||
|
|
||||||
BaseModel = declarative_base()
|
BaseModel = declarative_base()
|
||||||
|
metadata = BaseModel.metadata
|
||||||
|
|
||||||
|
|
||||||
class BaseCrud(BaseModel):
|
class BaseCrud(BaseModel):
|
||||||
|
|
||||||
|
__abstract__ = True
|
||||||
|
|
||||||
# 硬删除
|
# 硬删除
|
||||||
def delete(self, session, commit=False):
|
def delete(self, session, commit=False):
|
||||||
session.delete(self)
|
session.delete(self)
|
||||||
|
@ -47,6 +50,8 @@ class BaseCrud(BaseModel):
|
||||||
|
|
||||||
class InfoCrud(BaseModel):
|
class InfoCrud(BaseModel):
|
||||||
|
|
||||||
|
__abstract__ = True
|
||||||
|
|
||||||
create_time = Column(DateTime(), default=func.now())
|
create_time = Column(DateTime(), default=func.now())
|
||||||
update_time = Column(DateTime(), default=func.now(), onupdate=func.now())
|
update_time = Column(DateTime(), default=func.now(), onupdate=func.now())
|
||||||
delete_time = Column(DateTime())
|
delete_time = Column(DateTime())
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -60,6 +60,7 @@ setup(
|
||||||
'rocketry': ['rocketry==2.4.0'],
|
'rocketry': ['rocketry==2.4.0'],
|
||||||
'gutter': ['gutter==0.5.0'],
|
'gutter': ['gutter==0.5.0'],
|
||||||
'mysql': ['pymysql==1.0.3',
|
'mysql': ['pymysql==1.0.3',
|
||||||
'sqlalchemy==2.0.15'],
|
'sqlalchemy==2.0.15',
|
||||||
|
'sqlacodegen==2.3.0'],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue