diff options
Diffstat (limited to 'system/db/init.go')
-rw-r--r-- | system/db/init.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/system/db/init.go b/system/db/init.go index 2d73b35..1a5ed25 100644 --- a/system/db/init.go +++ b/system/db/init.go @@ -22,12 +22,17 @@ func Init() { } err = store.Update(func(tx *bolt.Tx) error { - // initialize db with all content type buckets + // initialize db with all content type buckets & sorted bucket for type for t := range content.Types { _, err := tx.CreateBucketIfNotExists([]byte(t)) if err != nil { return err } + + _, err = tx.CreateBucketIfNotExists([]byte(t + "_sorted")) + if err != nil { + return err + } } // init db with other buckets as needed @@ -65,6 +70,13 @@ func Init() { log.Fatal("Coudn't initialize db with buckets.", err) } + // sort all content into type_sorted buckets + go func() { + for t := range content.Types { + SortContent(t) + } + }() + } // SystemInitComplete checks if there is at least 1 admin user in the db which |