migration

package
v1.1.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package migration serves the authenticated database migration guide used by both legacy monitoring imports and Metric Store structure upgrades.

Index

Constants

View Source
const (
	PagePath = "/admin/database-migration"
	APIPath  = "/api/admin/database-migration"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewLegacyController

func NewLegacyController(db *gorm.DB, summary migrations.LegacyMonitoringSummary) *Controller

func NewStructureController

func NewStructureController() *Controller

func (*Controller) Activate

func (c *Controller) Activate()

func (*Controller) Deactivate

func (c *Controller) Deactivate()

func (*Controller) Done

func (c *Controller) Done() <-chan struct{}

func (*Controller) Register

func (c *Controller) Register(r *gin.Engine)

type Mode

type Mode string
const (
	ModeLegacyMonitoring Mode = "legacy_monitoring"
	ModeMetricStructure  Mode = "metric_store_restructure"
)

type Status

type Status struct {
	Mode     Mode    `json:"mode"`
	State    string  `json:"state"`
	Phase    string  `json:"phase"`
	Progress float64 `json:"progress"`
	Error    string  `json:"error,omitempty"`

	Summary         *migrations.LegacyMonitoringSummary `json:"summary,omitempty"`
	Table           string                              `json:"table,omitempty"`
	SourceRowsDone  int64                               `json:"source_rows_done,omitempty"`
	SourceRowsTotal int64                               `json:"source_rows_total,omitempty"`
	WrittenPoints   int64                               `json:"written_points,omitempty"`
	TargetDriver    string                              `json:"target_driver,omitempty"`

	CurrentMetric string  `json:"current_metric,omitempty"`
	RowsDone      int64   `json:"rows_done,omitempty"`
	RowsTotal     int64   `json:"rows_total,omitempty"`
	MetricsDone   int     `json:"metrics_done,omitempty"`
	MetricsTotal  int     `json:"metrics_total,omitempty"`
	BeforeBytes   int64   `json:"before_bytes,omitempty"`
	AfterBytes    int64   `json:"after_bytes,omitempty"`
	SavedBytes    int64   `json:"saved_bytes,omitempty"`
	SavedPercent  float64 `json:"saved_percent,omitempty"`
}

Status is the shared polling payload for both migration modes. Mode-specific fields are omitted when they do not apply.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL