feat(pets): adds pets kind insertion at app start

This commit is contained in:
2024-12-03 23:59:08 -03:00
parent da565ea275
commit e8c79ed04d

View File

@@ -11,7 +11,12 @@ class DBUtils():
Exception("this function needs app context to be ran, please provide app") Exception("this function needs app context to be ran, please provide app")
with app.app_context(): with app.app_context():
db.create_all() 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): def drop_db(app):
with app.app_context(): with app.app_context():
db.drop_all() db.drop_all()