Cannot delete app through CLI
The flask cli app delete
command fails with the following message:
sqlalchemy.exc.IntegrityError: (pymysql.err.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`stackspin`.`app_role`, CONSTRAINT `app_role_ibfk_1` FOREIGN KEY (`app_id`) REFERENCES `app` (`id`))')
[SQL: DELETE FROM app WHERE app.id = %(id)s]
[parameters: {'id': 3}]
(Background on this error at: https://sqlalche.me/e/14/gkpj)
command terminated with exit code 1
When trying to delete an app, we should first delete the app roles that are linked to it.