mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-07 22:31:35 -05:00
chore: improve person & attribute query performance (#2161)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[personId,attributeClassId]` on the table `Attribute` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX "Attribute_attributeClassId_personId_key";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "AttributeClass_environmentId_idx";
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Attribute_personId_attributeClassId_key" ON "Attribute"("personId", "attributeClassId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "AttributeClass_environmentId_created_at_idx" ON "AttributeClass"("environmentId", "created_at");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "AttributeClass_environmentId_archived_idx" ON "AttributeClass"("environmentId", "archived");
|
||||
@@ -63,7 +63,7 @@ model Attribute {
|
||||
personId String
|
||||
value String
|
||||
|
||||
@@unique([attributeClassId, personId])
|
||||
@@unique([personId, attributeClassId])
|
||||
}
|
||||
|
||||
enum AttributeType {
|
||||
@@ -86,7 +86,8 @@ model AttributeClass {
|
||||
attributeFilters SurveyAttributeFilter[]
|
||||
|
||||
@@unique([name, environmentId])
|
||||
@@index([environmentId])
|
||||
@@index([environmentId, createdAt])
|
||||
@@index([environmentId, archived])
|
||||
}
|
||||
|
||||
model Person {
|
||||
|
||||
Reference in New Issue
Block a user