Dashboards / Folders: delete related data (permissions, stars, tags, versions, annotations) when deleting a dashboard or a folder (#28826)

* Dashboard: delete related data when deleting a dashboard or a folder

* fix migrations order

* apply PR feedback
This commit is contained in:
Agnès Toulet
2020-11-06 09:02:31 +01:00
committed by GitHub
parent 0cbf034483
commit f0421ed08e
4 changed files with 36 additions and 3 deletions

View File

@ -201,6 +201,14 @@ func TestDashboardDataAccess(t *testing.T) {
So(query.Result.Updated.IsZero(), ShouldBeFalse)
})
Convey("Should be able to delete empty folder", func() {
emptyFolder := insertTestDashboard("2 test dash folder", 1, 0, true, "prod", "webapp")
deleteCmd := &models.DeleteDashboardCommand{Id: emptyFolder.Id}
err := DeleteDashboard(deleteCmd)
So(err, ShouldBeNil)
})
Convey("Should be able to delete a dashboard folder and its children", func() {
deleteCmd := &models.DeleteDashboardCommand{Id: savedFolder.Id}
err := DeleteDashboard(deleteCmd)