Spaces:
Sleeping
Sleeping
| from sqlalchemy.orm import Session | |
| from app.db import base # noqa | |
| from app.db.session import engine | |
| from app.models.dictionary_entry import DictionaryEntry | |
| def init_db() -> None: | |
| base.Base.metadata.create_all(bind=engine) | |
| # Optional: seed some initial entries | |
| with Session(bind=engine) as db: | |
| if db.query(DictionaryEntry).count() == 0: | |
| sample = DictionaryEntry( | |
| headword_zomi="Tlang", | |
| headword_english="mountain", | |
| part_of_speech="noun", | |
| definition="A large natural elevation of the earth's surface", | |
| translations="mountain,hill", | |
| ) | |
| db.add(sample) | |
| db.commit() | |