#astro db onDelete
3 messages · Page 1 of 1 (latest)
Hi @lament walrus. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
I apologize, but the knowledge sources provided do not contain specific information about setting onDelete: 'cascade' when creating a table with a foreign key reference in Astro DB.
However, the documentation does mention how to create foreign key references in Astro DB tables. According to the Astro DB guide (https://docs.astro.build/en/guides/astro-db/#define-your-database), you can establish relationships between tables using reference columns. Here's an example of how to create a basic foreign key reference:
const Author = defineTable({
columns: {
id: column.number({ primaryKey: true }),
name: column.text(),
}
});
const Comment = defineTable({
columns: {
authorId: column.number({ references: () => Author.columns.id }),
body: column.text(),
}
});