Skip to content

Commit 6b74d66

Browse files
authored
Create init_db.py
1 parent 389f2fb commit 6b74d66

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

app/db/init_db.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from app.db.session import engine
2+
from app.db.base import Base
3+
import asyncio
4+
5+
async def init_models():
6+
async with engine.begin() as conn:
7+
await conn.run_sync(Base.metadata.create_all)
8+
9+
def run():
10+
asyncio.run(init_models())
11+
12+
if __name__ == "__main__":
13+
run()

0 commit comments

Comments
 (0)