37 lines
No EOL
940 B
Python
37 lines
No EOL
940 B
Python
import aiosqlite
|
|
|
|
async def connect(path = './data/doof.sqlite') -> aiosqlite.Connection:
|
|
return await aiosqlite.connect(path)
|
|
|
|
async def create(conn: aiosqlite.Connection):
|
|
import products.db as product_db
|
|
await product_db.create(conn)
|
|
|
|
import ingredients.db as ingredient_db
|
|
await ingredient_db.create(conn)
|
|
|
|
import recipes.db as recipe_db
|
|
await recipe_db.create(conn)
|
|
|
|
import persons.db as person_db
|
|
await person_db.create(conn)
|
|
|
|
import meals.db as meals_db
|
|
await meals_db.create(conn)
|
|
|
|
import shopping.db as shopping_db
|
|
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()) |