-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(model): move scope and claim config to EligibilityVerifier
- Loading branch information
Showing
5 changed files
with
110 additions
and
32 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
benefits/core/migrations/0020_refactor_idg_config_eligibilityverifier.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,60 @@ | ||
# Generated by Django 5.0.6 on 2024-08-07 19:24 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def migrate_data(apps, schema_editor): | ||
EligibilityVerifier = apps.get_model("core", "EligibilityVerifier") | ||
|
||
for verifier in EligibilityVerifier.objects.all(): | ||
# check if verifier has a claims_provider, only migrate data if it does | ||
if verifier.claims_provider is not None: | ||
verifier.claims_scope = verifier.claims_provider.scope | ||
verifier.claims_claim = verifier.claims_provider.claim | ||
verifier.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("core", "0019_refactor_transitagency"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="eligibilityverifier", | ||
name="claims_claim", | ||
field=models.TextField( | ||
blank=True, help_text="The name of the claim (name/value pair) that is used to verify eligibility", null=True | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="eligibilityverifier", | ||
name="claims_scope", | ||
field=models.TextField( | ||
blank=True, | ||
help_text="A space-separated list of identifiers used to specify what access privileges are being requested", | ||
null=True, | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="eligibilityverifier", | ||
name="_claims_scheme", | ||
field=models.TextField( | ||
blank=True, | ||
default=None, | ||
help_text="The authentication scheme to use (explain override behavior)", | ||
null=True, | ||
verbose_name="Claims scheme", | ||
), | ||
), | ||
migrations.RunPython(migrate_data), | ||
migrations.RemoveField( | ||
model_name="claimsprovider", | ||
name="claim", | ||
), | ||
migrations.RemoveField( | ||
model_name="claimsprovider", | ||
name="scope", | ||
), | ||
] |
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