packages.wenpai.net/internal/packages/sync.go
elementary 6434bcc8f3
Some checks failed
ci / Go Modules Tidy (push) Waiting to run
ci / Go Test (push) Waiting to run
ci / Integration Test (push) Waiting to run
govulncheck / govulncheck (push) Waiting to run
ci / GolangCI-Lint (push) Has been cancelled
refactor(db+cli): drop versions_json and pipeline tables; disable legacy commands
Migration:
- Add 027_migrate_mirror_mode.sql
- Drop packages.versions_json (versions now fetched from upstream p2)
- Drop sync_runs, builds, metadata_changes, monthly_installs, status_checks, status_check_changes

Packages layer:
- Remove versions_json references from UpsertPackage, UpsertShellPackage, BatchUpsertPackages, BatchUpsertShellPackages, GetPackagesNeedingUpdate
- Make AllocateSyncRunID/FinishSyncRun no-ops (mirror mode has no sync_runs table)

CLI:
- Disable discover, update, build, deploy, pipeline, check-status commands
- All return "not available in mirror mode" to keep scripts from breaking
2026-04-12 01:31:36 +08:00

24 lines
725 B
Go

package packages
import (
"context"
"database/sql"
)
// SyncRun holds both the logical sync run ID (for package tracking) and the
// database row ID (for updating sync_runs status).
type SyncRun struct {
RowID int64 // sync_runs.id (auto-increment)
RunID int64 // logical ID assigned to packages.last_sync_run_id
}
// AllocateSyncRunID is a no-op in mirror mode.
// It returns a dummy SyncRun so that legacy callers don't break.
func AllocateSyncRunID(ctx context.Context, db *sql.DB) (*SyncRun, error) {
return &SyncRun{RowID: 1, RunID: 1}, nil
}
// FinishSyncRun is a no-op in mirror mode.
func FinishSyncRun(ctx context.Context, db *sql.DB, rowID int64, status string, stats map[string]any) error {
return nil
}