forked from github/plane
dev: back migration for integrations (#933)
This commit is contained in:
parent
d041d8be6b
commit
0be6738715
@ -3,7 +3,15 @@ import uuid
|
|||||||
import random
|
import random
|
||||||
from django.contrib.auth.hashers import make_password
|
from django.contrib.auth.hashers import make_password
|
||||||
from plane.db.models import ProjectIdentifier
|
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
|
# Update description and description html values for old descriptions
|
||||||
@ -174,3 +182,29 @@ def update_label_color():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
print("Failed")
|
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")
|
||||||
|
Loading…
Reference in New Issue
Block a user