From 6a771c589b2a1b317753120cc42428aca9d5a143 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Sun, 12 Jun 2022 12:57:38 +0300 Subject: [PATCH] sql_app: init_db: do not recreate sensor_data and access_log Signed-off-by: HeshamTB --- sql_app/init_db.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql_app/init_db.py b/sql_app/init_db.py index f915798..1abba88 100644 --- a/sql_app/init_db.py +++ b/sql_app/init_db.py @@ -66,6 +66,7 @@ def init_allowance(): def init_sensor_data(): monitor = crud.get_monitor(db, 1) + if monitor.sensor_history: return for i in range(50): room_data = \ schemas.\ @@ -79,6 +80,7 @@ def init_sensor_data(): def init_open_close_requests(): user = crud.get_user_by_email(db, "hisham@banafa.com.sa") + if user.access_log: return crud.set_open_door_request(db, 1, 10) log_entry = schemas.DoorAccessLog(user_id=user.id, iot_id=1,