-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* update branch bane * update pr number * fix: remove duplicate BCeID user account #1636 --------- Co-authored-by: Kuan Fan <kuan.fan@gov.bc.ca>
- Loading branch information
1 parent
1ba14a7
commit 7cff141
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
backend/api/migrations/0023_delete_duplicate_bceid_account_1636.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,33 @@ | ||
from django.db import migrations | ||
|
||
def delete_user_role(apps, schema_editor): | ||
"""Deletes UserRole objects filtered by user_id=1636.""" | ||
db_alias = schema_editor.connection.alias | ||
model = apps.get_model("api", "UserRole") | ||
model.objects.using(db_alias).filter(user_id=1636).delete() | ||
|
||
def delete_user_creation_request(apps, schema_editor): | ||
"""Deletes UserCreationRequest objects filtered by user_id=1636.""" | ||
db_alias = schema_editor.connection.alias | ||
model = apps.get_model("api", "UserCreationRequest") | ||
model.objects.using(db_alias).filter(user_id=1636).delete() | ||
|
||
def delete_user(apps, schema_editor): | ||
"""Deletes User objects filtered by user_id=1636.""" | ||
db_alias = schema_editor.connection.alias | ||
model = apps.get_model("api", "User") | ||
model.objects.using(db_alias).filter(id=1636).delete() | ||
|
||
class Migration(migrations.Migration): | ||
""" | ||
Defines migration dependencies and operations for deleting user data. | ||
""" | ||
dependencies = [ | ||
('api', '0022_update_trade_effective_dates'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(delete_user_role), | ||
migrations.RunPython(delete_user_creation_request), | ||
migrations.RunPython(delete_user), | ||
] |