Skip to content

Commit

Permalink
fix(be): boltdb migration
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Jan 28, 2022
1 parent 84471a4 commit 62b7d9a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Binary file added database2.boltdb
Binary file not shown.
8 changes: 7 additions & 1 deletion db/bolt/migrations/v2.8.26.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ func (d Migration_2_8_28) getProjectRepositories(projectID string) (map[string]m
repos := make(map[string]map[string]interface{})
err := d.DB.View(func(tx *bbolt.Tx) error {
b := tx.Bucket([]byte("project__repository_" + projectID))
if b == nil {
return nil
}
return b.ForEach(func(id, body []byte) error {
r := make(map[string]interface{})
repos[string(id)] = r
Expand All @@ -25,7 +28,10 @@ func (d Migration_2_8_28) getProjectRepositories(projectID string) (map[string]m

func (d Migration_2_8_28) setProjectRepository(projectID string, repoID string, repo map[string]interface{}) error {
return d.DB.Update(func(tx *bbolt.Tx) error {
b := tx.Bucket([]byte("project__repository_" + projectID))
b, err := tx.CreateBucketIfNotExists([]byte("project__repository_" + projectID))
if err != nil {
return err
}
j, err := json.Marshal(repo)
if err != nil {
return err
Expand Down

0 comments on commit 62b7d9a

Please sign in to comment.