-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Remove general purpose dedupe toggle #33963
Merged
Merged
Changes from 11 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f50b500
gate dedupe updates behind existing toggle
mjriley 14db22e
Remove general dedupe toggle
mjriley fe4d281
update dedupe list description
mjriley addc6ec
Merge branch 'mjr/create_dedupe_privilege' into mjr/remove-dedupe-toggle
mjriley d386ead
Merge branch 'mjr/create_dedupe_privilege' into mjr/remove-dedupe-toggle
mjriley e986e6c
require pro plan or above to access dedupe features
mjriley faef877
add a frozen toggle to support the previous CASE_DEDUPE toggle
mjriley 35206f3
Merge branch 'mjr/dedupe_backfill' into mjr/remove-dedupe-toggle
mjriley 1d531e2
Correctly gate dedupe actions behind the proper toggle
mjriley d7d4cbc
Merge branch 'mjr/dedupe_backfill' into mjr/remove-dedupe-toggle
mjriley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from django.core.management import call_command | ||
from django.db import migrations | ||
|
||
from corehq.privileges import CASE_DEDUPE | ||
from corehq.util.django_migrations import skip_on_fresh_install | ||
|
||
|
||
|
||
@skip_on_fresh_install | ||
def _add_dedupe_to_pro_and_above(apps, schema_editor): | ||
call_command('cchq_prbac_bootstrap') | ||
call_command( | ||
'cchq_prbac_grandfather_privs', | ||
CASE_DEDUPE, | ||
skip_edition='Paused,Community,Standard', | ||
noinput=True, | ||
) | ||
|
||
|
||
def _reverse(apps, schema_editor): | ||
call_command( | ||
'cchq_prbac_revoke_privs', | ||
CASE_DEDUPE, | ||
skip_edition='Paused,Community,Standard', | ||
delete_privs=False, | ||
check_privs_exist=True, | ||
noinput=True, | ||
) | ||
|
||
from corehq.apps.hqadmin.management.commands.cchq_prbac_bootstrap import Command | ||
Command.OLD_PRIVILEGES.append(CASE_DEDUPE) | ||
call_command('cchq_prbac_bootstrap') | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounting', '0088_add_new_softwareplan_visibility'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
_add_dedupe_to_pro_and_above, | ||
reverse_code=_reverse, | ||
), | ||
] |
27 changes: 27 additions & 0 deletions
27
corehq/apps/data_interfaces/migrations/0037_add_dedupe_update_toggle.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from django.db import migrations | ||
from corehq.util.django_migrations import skip_on_fresh_install | ||
|
||
from corehq.toggles import CASE_DEDUPE, CASE_DEDUPE_UPDATES, NAMESPACE_DOMAIN | ||
from corehq.toggles.models import Toggle | ||
|
||
|
||
@skip_on_fresh_install | ||
def add_dedupe_update_toggle(apps, schema_editor): | ||
for domain in CASE_DEDUPE.get_enabled_domains(): | ||
CASE_DEDUPE_UPDATES.set(domain, enabled=True, namespace=NAMESPACE_DOMAIN) | ||
|
||
|
||
def reverse(apps, schema_editor): | ||
toggle = Toggle.cached_get(CASE_DEDUPE_UPDATES.slug) | ||
toggle.delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('data_interfaces', '0036_backfill_dedupe_match_values'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(add_dedupe_update_toggle, reverse_code=reverse), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this operation be done in
corehq/apps/accounting/migrations/0089_dedupe_priv.py
to avoid two separate DB migrations?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be, but I think I'd be looking to unwind this in the future. It feels awkward that the code to get the data_interfaces app in a workable state lives in the accounting app. Ideally, I think both of these migrations ultimately belong in data_interfaces (or even better, a dedicated dedupe app)