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 fb36525bb0..6d388ea96e 100644 --- a/apiserver/plane/db/models/user.py +++ b/apiserver/plane/db/models/user.py @@ -113,6 +113,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)) diff --git a/yarn.lock b/yarn.lock index 22144dfb84..66e823cff3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13425,12 +13425,7 @@ undefsafe@^2.0.5: resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c" integrity sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA== -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== - -undici-types@~6.19.2: +undici-types@~6.19.8: version "6.19.8" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==