From 0be673871586ca0aef509a0377c05e9ce1989f4d Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Sat, 22 Apr 2023 18:17:53 +0530 Subject: [PATCH] dev: back migration for integrations (#933) --- apiserver/back_migration.py | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/apiserver/back_migration.py b/apiserver/back_migration.py index c1ccc28b5..0f272755f 100644 --- a/apiserver/back_migration.py +++ b/apiserver/back_migration.py @@ -3,7 +3,15 @@ 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, ProjectMember, Label +from plane.db.models import ( + Issue, + IssueComment, + User, + Project, + ProjectMember, + Label, + Integration, +) # Update description and description html values for old descriptions @@ -174,3 +182,29 @@ def update_label_color(): except Exception as e: print(e) print("Failed") + + +def create_slack_integration(): + try: + _ = Integration.objects.create(provider="slack", network=2, title="Slack") + print("Success") + except Exception as e: + print(e) + print("Failed") + + +def update_integration_verified(): + try: + integrations = Integration.objects.all() + updated_integrations = [] + for integration in integrations: + integration.verified = True + updated_integrations.append(integration) + + Integration.objects.bulk_update( + updated_integrations, ["verified"], batch_size=10 + ) + print("Sucess") + except Exception as e: + print(e) + print("Failed")