Skip to content

add script to move old projects to project_old category#518

Open
eperedo wants to merge 6 commits intodevelopment-project-configuratorfrom
feature/migrate-oldprojects
Open

add script to move old projects to project_old category#518
eperedo wants to merge 6 commits intodevelopment-project-configuratorfrom
feature/migrate-oldprojects

Conversation

@eperedo
Copy link
Copy Markdown
Contributor

@eperedo eperedo commented Feb 18, 2026

📌 References

📝 Implementation

Migrate Projects to Old Projects:

Step 1 (typescript script):

  • Import sqlviews metadata: metadata_old_projects_in_cc_deprecated_sqlview.json
  • Script to move old projects from category Project (MRwzyV0kXv9) to Old_Project (WIWj6TauYO8)
npm run remove-old-projects -- --dhis2-url="http://localhost:8080" --username="admin" --password="district" --persist

Step 2 (typescript script):

  • Add categories Old_Project, CC_Deprecated and TargetActual to categoryCombo Project-CC-Target/Actual_Old
  • Update categoryCombo for affected categoryOptionCombos from Project-CC-Target/Actual -> Project-CC-Target/Actual_Old. Datavalues are not modified.
npm run move-deprecated-cocs -- --dhis2-url="http://localhost:8080" --username="admin" --password="district" --persist

After this we must clear cache from DHIS2:

image

🔥 Notes to the tester

📹 Screenshots/Screen capture

Before Migration

You can see a lot of projects in the selector

image image

After migration

Only projects with no dataValues in deprecated core competencies

image

Creating a new dataSet pointing to the old category combo Project-CC-Target/Actual_Old and you can see the same dataValues previoulsy assigned to the combo Project-CC-Target/Actual

image

If we got an error in the Data Entry app we'll need to check and delete possible duplicated cocs in the Project-CC-Target/Actual_Old categoryCombo. This can be done with the sql script attached in the issue fix_duplicate_category_option_combos_v1.sql

@eperedo eperedo requested a review from MiquelAdell February 18, 2026 02:31
@bundlemon
Copy link
Copy Markdown

bundlemon Bot commented Feb 18, 2026

BundleMon

No change in files bundle size

Unchanged groups (1)
Status Path Size Limits
Build Folder
./**/*
996.25KB +20%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@MiquelAdell MiquelAdell requested a review from tokland February 24, 2026 12:35
Copy link
Copy Markdown
Collaborator

@tokland tokland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[code-only review, as requested by PM]

The workflow looks good to me. About code details:

Comment thread src/scripts/sql/metadata_old_projects_in_cc_deprecated_sqlview.json
Comment thread src/scripts/sql/metadata_old_projects_in_cc_deprecated_sqlview.json
Comment thread package.json Outdated
Comment thread src/scripts/move-old-projects.ts Outdated
Comment thread src/scripts/move-old-projects.ts Outdated
Comment thread src/scripts/move-old-projects.ts Outdated
Comment thread src/scripts/move-old-projects.ts
Comment thread src/scripts/sql/sqlview_projects_with_dv_in_cc_deprecated.sql
Comment thread src/scripts/sql/sqlview_projects_with_dv_in_cc_deprecated.sql
Comment thread src/scripts/sql/project_cc_target_actual_migration.sql Outdated
@eperedo eperedo requested a review from tokland February 25, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants