Change version on UsersBucket to V2 for clean upgrade path

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
pull/10616/head
Jared Scheib 2017-11-01 10:56:19 -07:00
parent 2e0911dbd9
commit 63e88e4853
2 changed files with 1 additions and 23 deletions

View File

@ -89,10 +89,6 @@ func (c *Client) Open(ctx context.Context) error {
if err := c.OrganizationsStore.Migrate(ctx); err != nil {
return err
}
// TODO: this will have to change, and is temporary
if err := c.UsersStore.Migrate(ctx); err != nil {
return err
}
return nil
}

View File

@ -13,31 +13,13 @@ import (
var _ chronograf.UsersStore = &UsersStore{}
// UsersBucket is used to store users local to chronograf
var UsersBucket = []byte("UsersV1")
var UsersBucket = []byte("UsersV2")
// UsersStore uses bolt to store and retrieve users
type UsersStore struct {
client *Client
}
// Migrate changes all existing users to be SuperAdmin
func (s *UsersStore) Migrate(ctx context.Context) error {
users, err := s.All(ctx)
if err != nil {
return err
}
// TODO(desa): REMOVE!!!!!!!!!!!!!!
for _, u := range users {
u.SuperAdmin = true
if err := s.Update(ctx, &u); err != nil {
return err
}
}
return nil
}
// get searches the UsersStore for user with id and returns the bolt representation
func (s *UsersStore) get(ctx context.Context, id uint64) (*chronograf.User, error) {
var u chronograf.User