From e8c79ed04d1646530a34e914de08168b8200d653 Mon Sep 17 00:00:00 2001 From: Gabriel De Los Rios Date: Tue, 3 Dec 2024 23:59:08 -0300 Subject: [PATCH] feat(pets): adds pets kind insertion at app start --- app/utils/db_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/utils/db_utils.py b/app/utils/db_utils.py index e39e9b1..9e573d0 100644 --- a/app/utils/db_utils.py +++ b/app/utils/db_utils.py @@ -11,7 +11,12 @@ class DBUtils(): Exception("this function needs app context to be ran, please provide app") with app.app_context(): db.create_all() - + dog = PetKind(name="Dog") + cat = PetKind(name="Cat") + db.session.add_all([dog,cat]) + db.session.commit() + db.session.flush() + def drop_db(app): with app.app_context(): db.drop_all()