From c05ed95ba9128cadeb53013dcf5aef25d9134f69 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 29 Dec 2022 18:13:07 +0100 Subject: [PATCH] feat(migration): ignore namespace changes --- .../migration/create_from_structure.go | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/pkg/modules/migration/create_from_structure.go b/pkg/modules/migration/create_from_structure.go index 19c831dbd..40d881811 100644 --- a/pkg/modules/migration/create_from_structure.go +++ b/pkg/modules/migration/create_from_structure.go @@ -30,7 +30,7 @@ import ( ) // InsertFromStructure takes a fully nested Vikunja data structure and a user and then creates everything for this user -// (Namespaces, tasks, etc. Even attachments and relations.) +// (Projects, tasks, etc. Even attachments and relations.) func InsertFromStructure(str []*models.ProjectWithTasksAndBuckets, user *user.User) (err error) { s := db.NewSession() defer s.Close() @@ -52,28 +52,16 @@ func insertFromStructure(s *xorm.Session, str []*models.ProjectWithTasksAndBucke labels := make(map[string]*models.Label) archivedProjects := []int64{} - archivedNamespaces := []int64{} // Create all namespaces for _, p := range str { p.ID = 0 - // Saving the archived status to archive the namespace again after creating it - var wasArchived bool - if p.IsArchived { - p.IsArchived = false - wasArchived = true - } - err = p.Create(s, user) if err != nil { return } - if wasArchived { - archivedNamespaces = append(archivedNamespaces, p.ID) - } - log.Debugf("[creating structure] Created project %d", p.ID) log.Debugf("[creating structure] Creating %d projects", len(p.ChildProjects)) @@ -287,16 +275,6 @@ func insertFromStructure(s *xorm.Session, str []*models.ProjectWithTasksAndBucke } } - if len(archivedNamespaces) > 0 { - _, err = s. - Cols("is_archived"). - In("id", archivedNamespaces). - Update(&models.Project{IsArchived: true}) - if err != nil { - return err - } - } - log.Debugf("[creating structure] Done inserting new task structure") return nil