Skip to content

Add post migration to remove shimo zentao records

Depends on MR: !114835 (merged)

What does this MR do and why?

Related issue: #377824

As part of removing the shimo and zentao integrations, this MR created a post migration to delete the corresponding records.

Involved tables:

  • integrations
  • zentao_tracker_data
Plan of removing the shimo and zentao integrations
Step Upstream JiHu Milestone
Disable new integration settings for shimo and zentao Add shimo and zentao to disabled integrations list !114835 (merged) Override disabled_integrations method 16.0
Delete shimo zentao db records in table integrations and zentao_tracker_data Run migration to delete records !114721 (merged) Run the same migration and skip deleting 16.0
Remove shimo code !114566 (closed) Move code to jh dir 16.1
Remove zentao code !114671 (closed) Move code to jh dir 16.1

Migration

bundle exec rails db:migrate

main: == [advisory_lock_connection] object_id: 275100, pg_backend_pid: 47098
main: == 20230428085332 RemoveShimoZentaoIntegrationRecords: migrating ==============
main: == 20230428085332 RemoveShimoZentaoIntegrationRecords: migrated (0.0507s) =====

main: == [advisory_lock_connection] object_id: 275100, pg_backend_pid: 47098
ci: == [advisory_lock_connection] object_id: 275360, pg_backend_pid: 47100
ci: == [advisory_lock_connection] object_id: 275360, pg_backend_pid: 47100
bundle exec rails db:migrate:down:main VERSION=20230428085332
main: == [advisory_lock_connection] object_id: 274860, pg_backend_pid: 46676
main: == 20230428085332 RemoveShimoZentaoIntegrationRecords: reverting ==============
main: == 20230428085332 RemoveShimoZentaoIntegrationRecords: reverted (0.0073s) =====

main: == [advisory_lock_connection] object_id: 274860, pg_backend_pid: 46676

Query

DELETE FROM "integrations" WHERE "integrations"."type_new" IN ('Integrations::Shimo', 'Integrations::Zentao') AND "integrations"."id" >= 4

I don't have permission to get the exact data, but it is certain that the amount of records affected is very small:

#377824 (comment 1319932314)

We only have 12 Shimo integrations in our database

There are 74 enabled ZenTao integrations

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Baodong

Merge request reports