Skip to content

feat(server): add PCDN data models and auto-migrate registration#3

Merged
hequan2017 merged 1 commit into
mainfrom
codex/add-pcdn-entity-models-and-migrations
Feb 10, 2026
Merged

feat(server): add PCDN data models and auto-migrate registration#3
hequan2017 merged 1 commit into
mainfrom
codex/add-pcdn-entity-models-and-migrations

Conversation

@hequan2017

Copy link
Copy Markdown
Owner

Motivation

  • Introduce PCDN domain entities to model nodes, resources, scheduling policies, dispatch tasks and realtime metrics for upcoming CDN scheduling features.
  • Ensure these new tables are created during the existing GORM biz migration flow and provide request/response DTOs for API integrations.

Description

  • Added new model definitions in server/model/pcdn/pcdn.go for PcdnNode, PcdnResource, PcdnPolicy, PcdnDispatchTask, and PcdnMetricSnapshot with table names, field tags and constraints.
  • Created search/request DTOs in server/model/request/pcdn.go and list response DTOs in server/model/response/pcdn.go for paging/filtering of each entity.
  • Registered the five PCDN models in the business AutoMigrate flow inside bizModel() in server/initialize/gorm_biz.go so they are included in GORM migrations.
  • Added useful indexes and uniqueness keys: idx_pcdn_node_region_isp (region+isp), idx_pcdn_metric_node_time (node_id+snapshot_at), idx_pcdn_dispatch_status_created (status+created_at_unix), plus unique/index keys for node/task/policy identity fields.
  • Formatted new files with gofmt.

Testing

  • Ran gofmt on modified files to ensure formatting (succeeded).
  • Attempted to run go test for the affected packages under server/ but go test in this environment timed out; no package-level unit tests were added for these new models in this change. The migration registration change was validated by compiling/formatting and by inspecting bizModel() to confirm the new types are included.

Codex Task

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@hequan2017
hequan2017 merged commit 3303e4c into main Feb 10, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant