Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate case assignees to participants who aren't individuals #2951

Merged
merged 3 commits into from Feb 7, 2023

Conversation

wssheldon
Copy link
Contributor

Resolves an issue where Assignee's that have never participated in an incident fail to be migrated to the Participant model.

Tested using, where 12460 is not an individual:

dispatch=# INSERT INTO dispatch_organization_default.case (id, name, assignee_id, title, description, resolution, status, visibility, case_priority_id, case_severity_id, case_type_id, project_id)
VALUES (37, 'TICKET-37', 12460, 'test', 'test', 'done', 'Triage', 'Open', 3, 4, 2, 1);
INSERT 0 1

Output:

(dispatch) wshel@Wills-MacBook-Pro dispatch % dispatch database upgrade                                            
DEBUG:Configuring extensions...:/Users/wshel/Projects/dispatch/src/dispatch/extensions.py:configure_extensions:25
INFO:Migrating dispatch core schema...:/Users/wshel/Projects/dispatch/src/dispatch/database/revisions/core/env.py:run_migrations_online:51
INFO:Context impl PostgresqlImpl.:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:__init__:204
INFO:Will assume transactional DDL.:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:__init__:207
INFO:Migrating dispatch_organization_default...:/Users/wshel/Projects/dispatch/src/dispatch/database/revisions/tenant/env.py:run_migrations_online:60
INFO:Context impl PostgresqlImpl.:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:__init__:204
INFO:Will assume transactional DDL.:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:__init__:207
INFO:Running upgrade 6e53722fa1f2 -> e23c468440c9, Sets a default search filter creator:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:run_migrations:618
DEBUG:update 6e53722fa1f2 to e23c468440c9:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:update_to_step:853
INFO:Running upgrade e23c468440c9 -> 956eb8f8987e, empty message:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:run_migrations:618
DEBUG:update e23c468440c9 to 956eb8f8987e:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:update_to_step:853
INFO:Running upgrade 956eb8f8987e -> e4b4991dddcd, empty message:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:run_migrations:618
Migrating case assignees to Participant from DispatchUser..
Processing Case 36...
Processing Case 24...
Processing Case 21...
Processing Case 22...
Processing Case 35...
Processing Case 37...
DEBUG:update 956eb8f8987e to e4b4991dddcd:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:update_to_step:853
INFO:Migrating dispatch_organization_training...:/Users/wshel/Projects/dispatch/src/dispatch/database/revisions/tenant/env.py:run_migrations_online:60
INFO:Context impl PostgresqlImpl.:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:__init__:204
INFO:Will assume transactional DDL.:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:__init__:207
INFO:Running upgrade 6e53722fa1f2 -> e23c468440c9, Sets a default search filter creator:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:run_migrations:618
DEBUG:update 6e53722fa1f2 to e23c468440c9:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:update_to_step:853
INFO:Running upgrade e23c468440c9 -> 956eb8f8987e, empty message:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:run_migrations:618
DEBUG:update e23c468440c9 to 956eb8f8987e:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:update_to_step:853
INFO:Running upgrade 956eb8f8987e -> e4b4991dddcd, empty message:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:run_migrations:618
Migrating case assignees to Participant from DispatchUser..
DEBUG:update 956eb8f8987e to e4b4991dddcd:/Users/wshel/.pyenv/versions/3.9.7/envs/dispatch/lib/python3.9/site-packages/alembic/runtime/migration.py:update_to_step:853
Success.

Migrated user:

Screenshot 2023-02-07 at 8 55 31 AM

@wssheldon wssheldon added the bug Something isn't working label Feb 7, 2023
@mvilanova
Copy link
Contributor

LGTM

@wssheldon wssheldon merged commit 00cba5f into master Feb 7, 2023
@wssheldon wssheldon deleted the bugfix/pariticpant-migration branch February 7, 2023 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants