Vishal LoharV
Convex Community16mo ago
39 replies
Vishal Lohar

Convex Ents Cascading Delete not working

import { defineEnt } from "convex-ents";
import { v } from "convex/values";

export const collectionsSchema = defineEnt({
  name: v.string(),
  description: v.optional(v.string()),
  isPublic: v.boolean(),
  updatedBy: v.id("users"),
})
  .edge("workspace", {
    field: "workspaceId",
  })
  .edge("user", {
    field: "createdBy",
  })
  .edges("collectionScreens", {
    ref: true,
  })
  .edges("collectionFlows", {
    ref: true,
  });

export const collectionScreensSchema = defineEnt({
  updatedAt: v.union(v.null(), v.null()),
  updatedBy: v.id("users"),
  platormType: v.string(),
})
  .edge("user", {
    field: "createdBy",
  })
  .edge("collection", {
    field: "collectionId",
  })
  .edge("screen", {
    field: "screenId",
  })
  .edge("savedScreen", {
    field: "savedScreenId",
  });

export const collectionFlowsSchema = defineEnt({
  updatedAt: v.union(v.null(), v.number()),
  updatedBy: v.id("users"),
  platormType: v.string(),
})
  .edge("user", {
    field: "createdBy",
  })
  .edge("collection", {
    field: "collectionId",
  })
  .edge("flow", {
    field: "flowId",
  })
  .edge("savedFlow", {
    field: "savedFlowId",
  });
Was this page helpful?