mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 06:58:07 -05:00
improvement(db): added missing indexes for common access patterns (#2473)
This commit is contained in:
4
packages/db/migrations/0125_eager_lily_hollister.sql
Normal file
4
packages/db/migrations/0125_eager_lily_hollister.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
CREATE INDEX "api_key_workspace_type_idx" ON "api_key" USING btree ("workspace_id","type");--> statement-breakpoint
|
||||
CREATE INDEX "api_key_user_type_idx" ON "api_key" USING btree ("user_id","type");--> statement-breakpoint
|
||||
CREATE INDEX "verification_expires_at_idx" ON "verification" USING btree ("expires_at");--> statement-breakpoint
|
||||
CREATE INDEX "workflow_blocks_type_idx" ON "workflow_blocks" USING btree ("type");
|
||||
7801
packages/db/migrations/meta/0125_snapshot.json
Normal file
7801
packages/db/migrations/meta/0125_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -869,6 +869,13 @@
|
||||
"when": 1766108872186,
|
||||
"tag": "0124_blushing_colonel_america",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 125,
|
||||
"version": "7",
|
||||
"when": 1766133598113,
|
||||
"tag": "0125_eager_lily_hollister",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ export const verification = pgTable(
|
||||
},
|
||||
(table) => ({
|
||||
identifierIdx: index('verification_identifier_idx').on(table.identifier),
|
||||
expiresAtIdx: index('verification_expires_at_idx').on(table.expiresAt),
|
||||
})
|
||||
)
|
||||
|
||||
@@ -197,6 +198,7 @@ export const workflowBlocks = pgTable(
|
||||
},
|
||||
(table) => ({
|
||||
workflowIdIdx: index('workflow_blocks_workflow_id_idx').on(table.workflowId),
|
||||
typeIdx: index('workflow_blocks_type_idx').on(table.type),
|
||||
})
|
||||
)
|
||||
|
||||
@@ -618,6 +620,8 @@ export const apiKey = pgTable(
|
||||
'workspace_type_check',
|
||||
sql`(type = 'workspace' AND workspace_id IS NOT NULL) OR (type = 'personal' AND workspace_id IS NULL)`
|
||||
),
|
||||
workspaceTypeIdx: index('api_key_workspace_type_idx').on(table.workspaceId, table.type),
|
||||
userTypeIdx: index('api_key_user_type_idx').on(table.userId, table.type),
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user