migration

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupData

type BackupData struct {
	Version   string                   `json:"version"`
	CreatedAt time.Time                `json:"created_at"`
	Global    models.SettingsGlobal    `json:"global"`
	Qbit      models.QbitSettings      `json:"qbit"`
	Sites     []models.SiteSetting     `json:"sites"`
	RSS       []models.RSSSubscription `json:"rss"`
}

BackupData 备份数据结构

type MigrationResult

type MigrationResult struct {
	Success             bool      `json:"success"`
	Message             string    `json:"message"`
	BackupPath          string    `json:"backup_path,omitempty"`
	MigratedAt          time.Time `json:"migrated_at"`
	DownloadersMigrated int       `json:"downloaders_migrated"`
	SitesMigrated       int       `json:"sites_migrated"`
	Errors              []string  `json:"errors,omitempty"`
}

MigrationResult 迁移结果

type MigrationService

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

MigrationService 配置迁移服务

func NewMigrationService

func NewMigrationService(db *gorm.DB) *MigrationService

NewMigrationService 创建迁移服务

func NewMigrationServiceWithBackupDir

func NewMigrationServiceWithBackupDir(db *gorm.DB, backupDir string) *MigrationService

NewMigrationServiceWithBackupDir 创建迁移服务(指定备份目录)

func (*MigrationService) CreateBackup

func (m *MigrationService) CreateBackup() (string, error)

CreateBackup 创建配置备份

func (*MigrationService) GetMigrationStatus

func (m *MigrationService) GetMigrationStatus() *MigrationStatus

func (*MigrationService) IsMigrationNeeded

func (m *MigrationService) IsMigrationNeeded() bool

IsMigrationNeeded 检查是否需要迁移

func (*MigrationService) MigrateV1ToV2

func (m *MigrationService) MigrateV1ToV2() *MigrationResult

MigrateV1ToV2 执行v1到v2的迁移

func (*MigrationService) RestoreBackup

func (m *MigrationService) RestoreBackup(backupPath string) error

RestoreBackup 从备份恢复

type MigrationStatus

type MigrationStatus struct {
	NeedsMigration       bool `json:"needs_migration"`
	HasOldQbitConfig     bool `json:"has_old_qbit_config"`
	HasNewDownloaders    bool `json:"has_new_downloaders"`
	OldSitesCount        int  `json:"old_sites_count"`
	NewDynamicSitesCount int  `json:"new_dynamic_sites_count"`
}

GetMigrationStatus 获取迁移状态

Jump to

Keyboard shortcuts

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