forked from makeplane/plane
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WEB-2092] fix: added unique constraints for project, module and stat…
…es (makeplane#5281) * fix: added unique constraints * chore: migration indetaton
- Loading branch information
1 parent
67f2e2f
commit daaa04c
Showing
17 changed files
with
160 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ class Meta: | |
"workspace", | ||
"project", | ||
"owned_by", | ||
"deleted_at", | ||
] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ class Meta: | |
"updated_at", | ||
"created_by", | ||
"updated_by", | ||
"deleted_at", | ||
] | ||
|
||
def validate(self, data): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
apiserver/plane/db/migrations/0074_alter_label_unique_together_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Generated by Django 4.2.11 on 2024-07-31 12:17 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
( | ||
"db", | ||
"0073_analyticview_deleted_at_apiactivitylog_deleted_at_and_more", | ||
), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterUniqueTogether( | ||
name="label", | ||
unique_together={("name", "project", "deleted_at")}, | ||
), | ||
migrations.AlterUniqueTogether( | ||
name="module", | ||
unique_together={("name", "project", "deleted_at")}, | ||
), | ||
migrations.AlterUniqueTogether( | ||
name="project", | ||
unique_together={ | ||
("identifier", "workspace", "deleted_at"), | ||
("name", "workspace", "deleted_at"), | ||
}, | ||
), | ||
migrations.AlterUniqueTogether( | ||
name="projectidentifier", | ||
unique_together={("name", "workspace", "deleted_at")}, | ||
), | ||
migrations.AddConstraint( | ||
model_name="label", | ||
constraint=models.UniqueConstraint( | ||
condition=models.Q(("deleted_at__isnull", True)), | ||
fields=("name", "project"), | ||
name="label_unique_name_project_when_deleted_at_null", | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="module", | ||
constraint=models.UniqueConstraint( | ||
condition=models.Q(("deleted_at__isnull", True)), | ||
fields=("name", "project"), | ||
name="module_unique_name_project_when_deleted_at_null", | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="project", | ||
constraint=models.UniqueConstraint( | ||
condition=models.Q(("deleted_at__isnull", True)), | ||
fields=("identifier", "workspace"), | ||
name="project_unique_identifier_workspace_when_deleted_at_null", | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="project", | ||
constraint=models.UniqueConstraint( | ||
condition=models.Q(("deleted_at__isnull", True)), | ||
fields=("name", "workspace"), | ||
name="project_unique_name_workspace_when_deleted_at_null", | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="projectidentifier", | ||
constraint=models.UniqueConstraint( | ||
condition=models.Q(("deleted_at__isnull", True)), | ||
fields=("name", "workspace"), | ||
name="unique_name_workspace_when_deleted_at_null", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters