-
Notifications
You must be signed in to change notification settings - Fork 44.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature(backend): Add ability to execute store agents without agent ownership #9179
Changes from 1 commit
4465994
6b9580b
6df94aa
a7e0af0
c6daeef
4f861e3
797f9ed
bb8e562
f051266
37e8b51
cf453cf
4cdfb4e
874e2b3
30504e1
3be552c
714913a
8adf7bf
9e008ad
3052656
99bc218
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
Warnings: | ||
|
||
- A unique constraint covering the columns `[agentId]` on the table `StoreListing` will be added. If there are existing duplicate values, this will fail. | ||
|
||
*/ | ||
-- DropIndex | ||
DROP INDEX "StoreListing_agentId_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "StoreListing_isApproved_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "StoreListingVersion_agentId_agentVersion_isApproved_idx"; | ||
|
||
-- CreateIndex | ||
CREATE INDEX "StoreListing_agentId_owningUserId_idx" ON "StoreListing"("agentId", "owningUserId"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "StoreListing_isDeleted_isApproved_idx" ON "StoreListing"("isDeleted", "isApproved"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "StoreListing_isDeleted_idx" ON "StoreListing"("isDeleted"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "StoreListing_agentId_key" ON "StoreListing"("agentId"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "StoreListingVersion_agentId_agentVersion_isDeleted_idx" ON "StoreListingVersion"("agentId", "agentVersion", "isDeleted"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -443,6 +443,8 @@ view Creator { | |
agent_rating Float | ||
agent_runs Int | ||
is_featured Boolean | ||
|
||
// Index or unique are not applied to views | ||
} | ||
|
||
view StoreAgent { | ||
|
@@ -465,11 +467,7 @@ view StoreAgent { | |
rating Float | ||
versions String[] | ||
|
||
@@unique([creator_username, slug]) | ||
@@index([creator_username]) | ||
@@index([featured]) | ||
@@index([categories]) | ||
@@index([storeListingVersionId]) | ||
// Index or unique are not applied to views | ||
} | ||
|
||
view StoreSubmission { | ||
|
@@ -487,7 +485,7 @@ view StoreSubmission { | |
agent_id String | ||
agent_version Int | ||
|
||
@@index([user_id]) | ||
// Index or unique are not applied to views | ||
} | ||
|
||
model StoreListing { | ||
|
@@ -510,9 +508,13 @@ model StoreListing { | |
StoreListingVersions StoreListingVersion[] | ||
StoreListingSubmission StoreListingSubmission[] | ||
|
||
@@index([isApproved]) | ||
@@index([agentId]) | ||
// Unique index on agentId to ensure only one listing per agent, regardless of number of versions the agent has. | ||
@@unique([agentId]) | ||
@@index([agentId, owningUserId]) | ||
@@index([owningUserId]) | ||
// Used in the view query | ||
@@index([isDeleted, isApproved]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two indices with Boolean values will only be used on a query like this
If you have another column in the filter, it will never be used. So I don't think this will be useful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
@@index([isDeleted]) | ||
} | ||
|
||
model StoreListingVersion { | ||
|
@@ -553,7 +555,7 @@ model StoreListingVersion { | |
StoreListingReview StoreListingReview[] | ||
|
||
@@unique([agentId, agentVersion]) | ||
@@index([agentId, agentVersion, isApproved]) | ||
@@index([agentId, agentVersion, isDeleted]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AgentId and agent version is already unique Adding another index on this will be useless and slowing down the write |
||
} | ||
|
||
model StoreListingReview { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as below,