diff --git a/apiserver/back_migration.py b/apiserver/back_migration.py index 93f07134f..ff5fc74e4 100644 --- a/apiserver/back_migration.py +++ b/apiserver/back_migration.py @@ -3,7 +3,7 @@ import uuid import random from django.contrib.auth.hashers import make_password from plane.db.models import ProjectIdentifier -from plane.db.models import Issue, IssueComment, User, Project +from plane.db.models import Issue, IssueComment, User, Project, Label # Update description and description html values for old descriptions @@ -134,3 +134,18 @@ def update_project_cover_images(): except Exception as e: print(e) print("Failed") + + +def update_label_color(): + try: + labels = Label.objects.filter(color="") + updated_labels = [] + for label in labels: + label.color = "#" + "%06x" % random.randint(0, 0xFFFFFF) + updated_labels.append(label) + + Label.objects.bulk_update(updated_labels, ["color"], batch_size=100) + print("Success") + except Exception as e: + print(e) + print("Failed")