A Capsule table definition.
Table definitions are declared in capsule({ schema }); Sporades adds managed id, createdAt, and updatedAt fields to every stored row.
capsule({ schema })
id
createdAt
updatedAt
const notes = table({ body: String(), ownerId: String(),}).acl({ read: ({ row, ctx }) => row?.ownerId === ctx.auth.userId, write: ({ next, previous, ctx }) => (next?.ownerId ?? previous?.ownerId) === ctx.auth.userId,}); Copy
const notes = table({ body: String(), ownerId: String(),}).acl({ read: ({ row, ctx }) => row?.ownerId === ctx.auth.userId, write: ({ next, previous, ctx }) => (next?.ownerId ?? previous?.ownerId) === ctx.auth.userId,});
Optional
A Capsule table definition.
Table definitions are declared in
capsule({ schema }); Sporades adds managedid,createdAt, andupdatedAtfields to every stored row.Example