新增databases.py把所有建表基类统一成一个,才可以链接外键。
This commit is contained in:
@@ -6,7 +6,11 @@ use student_manage_system;
|
||||
|
||||
show tables;
|
||||
|
||||
drop database student_manage_system;
|
||||
|
||||
drop table students;
|
||||
|
||||
select * from students limit 50;
|
||||
|
||||
desc students;
|
||||
|
||||
|
||||
+1
-7
@@ -5,13 +5,7 @@ from students.model import students_model
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
# 合并接口
|
||||
@asynccontextmanager
|
||||
async def S_Router(Students_API: APIRouter):
|
||||
Base.metadata.create_all(engine1)
|
||||
yield
|
||||
engine1.dispose()
|
||||
|
||||
Students_API = APIRouter(lifespan=S_Router)
|
||||
Students_API = APIRouter()
|
||||
Students_API.include_router(s_api)
|
||||
|
||||
# 自测接口
|
||||
|
||||
Reference in New Issue
Block a user