[Improvement-17928][API] Add worker group id to environment relation
Was this PR generated or assisted by AI?
YES. This pull request was assisted by Hermes Agent / OpenAI Codex for code changes, focused tests, and local verification. The scope and final submission were directed by the contributor.
Purpose of the pull request
Closes #17928.
This pull request adds a stable worker group id to EnvironmentWorkerGroupRelation while keeping the existing worker group name field for compatibility.
Brief change log
- Add
workerGroupId/worker_group_idtoEnvironmentWorkerGroupRelation, MyBatis mapping, base schema SQL, and upgrade SQL. - Backfill existing
worker_group_idvalues in MySQL/PostgreSQL upgrade SQL by joining the legacy worker group name tot_ds_worker_group. - Persist
workerGroupIdwhen creating or updating environment-worker-group relations. - Use
worker_group_idwhen checking environment dependencies before deleting worker groups, with legacy-name fallback only for rows whoseworker_group_idisNULL. - Add focused DAO/API tests for persistence, create/update flows, and worker group delete dependency checks.
Verify this pull request
This change added tests and can be verified as follows:
git diff --check./mvnw -pl dolphinscheduler-dao,dolphinscheduler-api spotless:check -DskipTests -DskipITs -Djacoco.skip=true./mvnw -pl dolphinscheduler-dao,dolphinscheduler-api test -Dtest=EnvironmentWorkerGroupRelationMapperTest,EnvironmentServiceTest,WorkerGroupServiceTest -DskipITs -Dspotless.check.skip=true -Dcheckstyle.skip=true -Djacoco.skip=true
The focused Maven test run passed with 24 tests, 0 failures, 0 errors, and 0 skipped.
Pull Request Notice
Thanks for the review. I have addressed this in the latest commit: the upgrade DDL now only adds the worker_group_id column, and the existing data backfill has been moved into the matching DML upgrade scripts for both MySQL and PostgreSQL.