Simplifying app delete per review comments

This commit is contained in:
Denis Makogon
2017-09-11 23:15:01 +03:00
parent 78f2d51bfa
commit 6b7accd3c6
6 changed files with 3 additions and 62 deletions

View File

@@ -221,6 +221,8 @@ func (ds *sqlStore) UpdateApp(ctx context.Context, newapp *models.App) (*models.
}
func (ds *sqlStore) RemoveApp(ctx context.Context, appName string) error {
ds.db.ExecContext(ctx, ds.db.Rebind(
`DELETE FROM routes, calls, logs WHERE app_name=?`), appName)
query := ds.db.Rebind(`DELETE FROM apps WHERE name = ?`)
_, err := ds.db.ExecContext(ctx, query, appName)
return err