migrate: refine migration to update existing non-service API tokens by excluding bot users from workspace removal

This commit is contained in:
pablohashescobar
2025-12-08 17:50:59 +05:30
parent 2f0ea09f15
commit ab9a6b4466

View File

@@ -32,9 +32,9 @@ def migrate_existing_api_tokens(apps, schema_editor):
APIToken = apps.get_model('db', 'APIToken')
# Update all the existing non-service api tokens to not have a workspace
APIToken.objects.filter(is_service=False).update(
APIToken.objects.filter(is_service=False, user__is_bot=False).update(
workspace_id=None,
user__is_bot=False
)
return