DodoApp: Clean up commits on branch/app delete
Fix redirect URL after app deletion.
Change-Id: Id26b114d9dc47a8de547368e55531816d21dd26c
diff --git a/core/installer/welcome/store.go b/core/installer/welcome/store.go
index 7efdeaf..328c7fd 100644
--- a/core/installer/welcome/store.go
+++ b/core/installer/welcome/store.go
@@ -50,6 +50,8 @@
GetCommit(hash string) (Commit, error)
GetLastCommitInfo(name, branch string) (LastCommitInfo, error)
GetBranches(name string) ([]string, error)
+ DeleteBranch(name, branch string) error
+ DeleteApp(name string) error
}
func NewStore(cf soft.RepoIO, db *sql.DB) (Store, error) {
@@ -313,3 +315,15 @@
}
return ret, nil
}
+
+func (s *storeImpl) DeleteBranch(name, branch string) error {
+ query := `DELETE FROM commits WHERE app_name = ? AND branch = ?`
+ _, err := s.db.Exec(query, name, branch)
+ return err
+}
+
+func (s *storeImpl) DeleteApp(name string) error {
+ query := `DELETE FROM apps WHERE name = ?`
+ _, err := s.db.Exec(query, name)
+ return err
+}