2024-01-08 00:38:17 +00:00
|
|
|
import aiosqlite
|
|
|
|
|
|
2025-07-28 23:23:09 +00:00
|
|
|
async def connect(path = './data/doof.sqlite') -> aiosqlite.Connection:
|
2024-04-25 04:57:39 +00:00
|
|
|
return await aiosqlite.connect(path)
|
2024-01-08 00:38:17 +00:00
|
|
|
|
2024-04-25 04:57:39 +00:00
|
|
|
async def create(conn: aiosqlite.Connection):
|
2024-01-13 07:44:48 +00:00
|
|
|
import products.db as product_db
|
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
|
2024-05-17 09:09:03 +00:00
|
|
|
await meals_db.create(conn)
|
|
|
|
|
|
|
|
|
|
import shopping.db as shopping_db
|
2024-05-18 07:05:01 +00:00
|
|
|
await shopping_db.create(conn)
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
import asyncio
|
|
|
|
|
from tests.test_data import create_test_data
|
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
|
conn = await connect()
|
|
|
|
|
await create(conn)
|
|
|
|
|
await conn.commit()
|
|
|
|
|
await create_test_data(conn)
|
|
|
|
|
await conn.commit()
|
|
|
|
|
await conn.close()
|
|
|
|
|
|
|
|
|
|
asyncio.run(main())
|