Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

chore: intake migration (#5950)

Bavisetti Narayan56755b0e9c68
diff --git a/apiserver/plane/db/migrations/0084_remove_label_label_unique_name_project_when_deleted_at_null_and_more.py b/apiserver/plane/db/migrations/0084_remove_label_label_unique_name_project_when_deleted_at_null_and_more.py
new file mode 100644
index 0000000000..25bfcb8fb3
--- /dev/null
+++ b/apiserver/plane/db/migrations/0084_remove_label_label_unique_name_project_when_deleted_at_null_and_more.py
@@ -0,0 +1,75 @@
+# Generated by Django 4.2.15 on 2024-11-05 07:02
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("db", "0083_device_workspace_timezone_and_more"),
+ ]
+
+ operations = [
+ migrations.RemoveConstraint(
+ model_name="label",
+ name="label_unique_name_project_when_deleted_at_null",
+ ),
+ migrations.AlterUniqueTogether(
+ name="label",
+ unique_together=set(),
+ ),
+ migrations.AddField(
+ model_name="deployboard",
+ name="is_disabled",
+ field=models.BooleanField(default=False),
+ ),
+ migrations.AddField(
+ model_name="inboxissue",
+ name="extra",
+ field=models.JSONField(default=dict),
+ ),
+ migrations.AddField(
+ model_name="inboxissue",
+ name="source_email",
+ field=models.TextField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name="user",
+ name="bot_type",
+ field=models.CharField(
+ blank=True, max_length=30, null=True, verbose_name="Bot Type"
+ ),
+ ),
+ migrations.AlterField(
+ model_name="deployboard",
+ name="entity_name",
+ field=models.CharField(blank=True, max_length=30, null=True),
+ ),
+ migrations.AlterField(
+ model_name="inboxissue",
+ name="source",
+ field=models.CharField(
+ blank=True, default="IN_APP", max_length=255, null=True
+ ),
+ ),
+ migrations.AddConstraint(
+ model_name="label",
+ constraint=models.UniqueConstraint(
+ condition=models.Q(
+ ("deleted_at__isnull", True), ("project__isnull", True)
+ ),
+ fields=("name",),
+ name="unique_name_when_project_null_and_not_deleted",
+ ),
+ ),
+ migrations.AddConstraint(
+ model_name="label",
+ constraint=models.UniqueConstraint(
+ condition=models.Q(
+ ("deleted_at__isnull", True), ("project__isnull", False)
+ ),
+ fields=("project", "name"),
+ name="unique_project_name_when_not_deleted",
+ ),
+ ),
+ ]
diff --git a/apiserver/plane/db/models/deploy_board.py b/apiserver/plane/db/models/deploy_board.py
index da9476f16c..2bffe57962 100644
--- a/apiserver/plane/db/models/deploy_board.py
+++ b/apiserver/plane/db/models/deploy_board.py
@@ -20,12 +20,14 @@ class DeployBoard(WorkspaceBaseModel):
("cycle", "Task"),
("page", "Page"),
("view", "View"),
+ ("intake", "Intake"),
)
entity_identifier = models.UUIDField(null=True)
entity_name = models.CharField(
max_length=30,
- choices=TYPE_CHOICES,
+ null=True,
+ blank=True,
)
anchor = models.CharField(
max_length=255, default=get_anchor, unique=True, db_index=True
@@ -41,6 +43,7 @@ class DeployBoard(WorkspaceBaseModel):
is_votes_enabled = models.BooleanField(default=False)
view_props = models.JSONField(default=dict)
is_activity_enabled = models.BooleanField(default=True)
+ is_disabled = models.BooleanField(default=False)
def __str__(self):
"""Return name of the deploy board"""
diff --git a/apiserver/plane/db/models/inbox.py b/apiserver/plane/db/models/inbox.py
index be2b1f3dd2..95c84be46f 100644
--- a/apiserver/plane/db/models/inbox.py
+++ b/apiserver/plane/db/models/inbox.py
@@ -57,9 +57,16 @@ class InboxIssue(ProjectBaseModel):
on_delete=models.SET_NULL,
null=True,
)
- source = models.TextField(blank=True, null=True)
+ source = models.CharField(
+ max_length=255,
+ default="IN_APP",
+ null=True,
+ blank=True,
+ )
+ source_email = models.TextField(blank=True, null=True)
external_source = models.CharField(max_length=255, null=True, blank=True)
external_id = models.CharField(max_length=255, blank=True, null=True)
+ extra = models.JSONField(default=dict)
class Meta:
verbose_name = "InboxIssue"
diff --git a/apiserver/plane/db/models/label.py b/apiserver/plane/db/models/label.py
index 7070ef9e03..11e2da8c32 100644
--- a/apiserver/plane/db/models/label.py
+++ b/apiserver/plane/db/models/label.py
@@ -20,13 +20,19 @@ class Label(WorkspaceBaseModel):
external_id = models.CharField(max_length=255, blank=True, null=True)
class Meta:
- unique_together = ["name", "project", "deleted_at"]
constraints = [
+ # Enforce uniqueness of name when project is NULL and deleted_at is NULL
models.UniqueConstraint(
- fields=["name", "project"],
- condition=Q(deleted_at__isnull=True),
- name="label_unique_name_project_when_deleted_at_null",
- )
+ fields=["name"],
+ condition=Q(project__isnull=True, deleted_at__isnull=True),
+ name="unique_name_when_project_null_and_not_deleted",
+ ),
+ # Enforce uniqueness of project and name when project is not NULL and deleted_at is NULL
+ models.UniqueConstraint(
+ fields=["project", "name"],
+ condition=Q(project__isnull=False, deleted_at__isnull=True),
+ name="unique_project_name_when_not_deleted",
+ ),
]
verbose_name = "Label"
verbose_name_plural = "Labels"
diff --git a/apiserver/plane/db/models/user.py b/apiserver/plane/db/models/user.py
index 3b84ec60e2..e97d04e7a4 100644
--- a/apiserver/plane/db/models/user.py
+++ b/apiserver/plane/db/models/user.py
@@ -107,6 +107,12 @@ class User(AbstractBaseUser, PermissionsMixin):
# my_issues_prop = models.JSONField(null=True)
is_bot = models.BooleanField(default=False)
+ bot_type = models.CharField(
+ max_length=30,
+ verbose_name="Bot Type",
+ blank=True,
+ null=True,
+ )
# timezone
USER_TIMEZONE_CHOICES = tuple(zip(pytz.all_timezones, pytz.all_timezones))