chore: intake migration (#5950)
* chore: intake migration * chore: removed the enum * chore: removed the source type enum * chore: changed the migration file
This commit is contained in:
parent
438d1bcfbd
commit
56755b0e9c
5 changed files with 104 additions and 7 deletions
|
|
@ -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",
|
||||
),
|
||||
),
|
||||
]
|
||||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue