mirror of
https://github.com/hanzozt/zt.git
synced 2026-10-30 15:04:55 +00:00
Global rebrand of all OpenZiti references to Hanzo ZT: - Go module paths: github.com/openziti/* → github.com/hanzozt/* - Docker images: openziti/* → hanzozt/* - Java packages: org.openziti.* → org.hanzozt.* - Brand: OpenZiti → Hanzo ZT - URLs: openziti.io → hanzozt.dev
33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
package db
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hanzozt/storage/ast"
|
|
"github.com/hanzozt/storage/boltz"
|
|
)
|
|
|
|
// Removes all ApiSession and Session from the edge. Necessary from 0.18 -> 0.19
|
|
// as the id format changed and API Session sync'ing depends on monotonic ids.
|
|
func (m *Migrations) removeAllSessions(step *boltz.MigrationStep) {
|
|
for cursor := m.stores.Session.IterateIds(step.Ctx.Tx(), ast.BoolNodeTrue); cursor.IsValid(); cursor.Next() {
|
|
current := cursor.Current()
|
|
currentSessionId := string(current)
|
|
|
|
if err := m.stores.Session.DeleteById(step.Ctx, currentSessionId); err != nil {
|
|
step.SetError(fmt.Errorf("error cleaning up sessions for migration: %v", err))
|
|
return
|
|
}
|
|
}
|
|
|
|
for cursor := m.stores.ApiSession.IterateIds(step.Ctx.Tx(), ast.BoolNodeTrue); cursor.IsValid(); cursor.Next() {
|
|
current := cursor.Current()
|
|
currentApiSessionId := string(current)
|
|
|
|
if err := m.stores.ApiSession.DeleteById(step.Ctx, currentApiSessionId); err != nil {
|
|
step.SetError(fmt.Errorf("error cleaning up api sessions for migration: %v", err))
|
|
return
|
|
}
|
|
}
|
|
}
|