Skip to content

Commit ff30f9f

Browse files
committed
feat: adds poetry based script to init database REFS #24
1 parent 4af09c4 commit ff30f9f

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/labs/db.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ async def init_models():
3535
References:
3636
https://stribny.name/blog/fastapi-asyncalchemy/
3737
"""
38+
import logging
39+
logging.info("Initialising models")
3840
async with engine.begin() as conn:
3941
await conn.run_sync(Base.metadata.drop_all)
4042
await conn.run_sync(Base.metadata.create_all)

src/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ bcrypt = "^3.2.2"
3232
pytest = "^5.2"
3333
watchdog = "^2.1.8"
3434

35+
[tool.poetry.scripts]
36+
init-db = "labs.db.init_db"
37+
3538
[build-system]
3639
requires = ["poetry-core>=1.0.0"]
3740
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)