From 588247f1c1f6e6e23f3cdf56c6f554a1ff62d54a Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Tue, 4 Apr 2023 00:00:03 +0530 Subject: [PATCH] dev: back migration for project member views (#663) --- apiserver/back_migration.py | 27 ++++++++++++++++++++++++++- apiserver/plane/db/models/project.py | 7 +++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/apiserver/back_migration.py b/apiserver/back_migration.py index ff5fc74e4..1ba312934 100644 --- a/apiserver/back_migration.py +++ b/apiserver/back_migration.py @@ -3,7 +3,8 @@ 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, Label +from plane.db.models import Issue, IssueComment, User, Project, ProjectMember + # Update description and description html values for old descriptions @@ -136,6 +137,30 @@ def update_project_cover_images(): print("Failed") +def update_user_view_property(): + try: + project_members = ProjectMember.objects.all() + updated_project_members = [] + for project_member in project_members: + project_member.default_props = { + "filters": {"type": None}, + "orderBy": "-created_at", + "collapsed": True, + "issueView": "list", + "filterIssue": None, + "groupByProperty": True, + "showEmptyGroups": True, + } + updated_project_members.append(project_member) + + ProjectMember.objects.bulk_update( + updated_project_members, ["default_props"], batch_size=100 + ) + print("Success") + except Exception as e: + print(e) + print("Failed") + def update_label_color(): try: labels = Label.objects.filter(color="") diff --git a/apiserver/plane/db/models/project.py b/apiserver/plane/db/models/project.py index 4b1af4bed..b3c8f669a 100644 --- a/apiserver/plane/db/models/project.py +++ b/apiserver/plane/db/models/project.py @@ -21,10 +21,13 @@ ROLE_CHOICES = ( def get_default_props(): return { + "filters": {"type": None}, + "orderBy": "-created_at", + "collapsed": True, "issueView": "list", - "groupByProperty": None, - "orderBy": None, "filterIssue": None, + "groupByProperty": True, + "showEmptyGroups": True, }