munch-ease-backend/db.py

28 lines
648 B
Python
Raw Normal View History

2024-01-08 00:38:17 +00:00
import aiosqlite
2024-01-13 01:54:04 +00:00
async def connect() -> aiosqlite.Connection:
2024-01-13 23:44:53 +00:00
return await aiosqlite.connect('./data/your_database.db')
2024-01-08 00:38:17 +00:00
async def create():
2024-01-13 07:44:48 +00:00
import products.db as product_db
2024-01-08 00:38:17 +00:00
conn = await connect()
2024-01-13 01:54:04 +00:00
await product_db.create(conn)
2024-01-13 03:21:38 +00:00
2024-01-17 07:21:16 +00:00
import ingredients.db as ingredient_db
await ingredient_db.create(conn)
2024-01-13 07:44:48 +00:00
import recipes.db as recipe_db
2024-01-13 03:21:38 +00:00
await recipe_db.create(conn)
2024-01-13 07:44:48 +00:00
import persons.db as person_db
2024-01-13 07:18:25 +00:00
await person_db.create(conn)
import meals.db as meals_db
await meals_db.create(conn)
2024-01-08 00:38:17 +00:00
await conn.commit()
await conn.close()
if __name__ == '__main__':
import asyncio
asyncio.run(create())