Skip to content

Commit

Permalink
Revert "Revert f86fe02602ff86ffc35126173e9887891694601d (#29670)" (#2…
Browse files Browse the repository at this point in the history
…9719)

This reverts commit 74d60d9af286d8f8fb62cf0312b745ae81109ee8.

GitOrigin-RevId: 5c53f35b1d188d38bc951fd3dd0340dbaa4fc037
  • Loading branch information
nipunn1313 authored and Convex, Inc. committed Sep 11, 2024
1 parent c2b120b commit 2a912ad
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion npm-packages/system-udfs/convex/_system/cli/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { queryPrivateSystem } from "../secretSystemTables";
export const getLatest = queryPrivateSystem({
args: {},
handler: async ({ db }): Promise<Export | null> => {
return await db.query("_exports").order("desc").first();
return await db
.query("_exports")
.withIndex("by_requestor", (q) => q.eq("requestor", "snapshotExport"))
.order("desc")
.first();
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { queryGeneric, queryPrivateSystem } from "../secretSystemTables";
export default queryPrivateSystem({
args: {},
handler: async function ({ db }): Promise<Export | null> {
return await db.query("_exports").order("desc").first();
return await db
.query("_exports")
.withIndex("by_requestor", (q) => q.eq("requestor", "snapshotExport"))
.order("desc")
.first();
},
});

Expand Down
6 changes: 5 additions & 1 deletion npm-packages/system-udfs/convex/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const completedExport = v.object({
include_storage: v.boolean(),
}),
),
requestor: v.literal("snapshotExport"),
});

const cronJobStatus = v.union(
Expand Down Expand Up @@ -280,16 +281,19 @@ export default defineSchema({
state: v.literal("failed"),
start_ts: v.int64(),
failed_ts: v.int64(),
requestor: v.literal("snapshotExport"),
}),
v.object({
state: v.literal("in_progress"),
start_ts: v.int64(),
requestor: v.literal("snapshotExport"),
}),
v.object({
state: v.literal("requested"),
requestor: v.literal("snapshotExport"),
}),
),
),
).index("by_requestor", ["requestor"]),
_deployment_audit_log: deploymentAuditLogTable,
_scheduled_jobs: defineTable({
nextTs: v.union(v.int64(), v.null()),
Expand Down

0 comments on commit 2a912ad

Please sign in to comment.