feat(pets): adds pets kind insertion at app start
This commit is contained in:
@@ -11,6 +11,11 @@ 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():
|
||||||
|
|||||||
Reference in New Issue
Block a user