CREATETABLE"Category" ( idSERIALPRIMARY KEY);CREATETABLE"Post" ( idSERIALPRIMARY KEY);-- Relation table + indexes ---CREATETABLE"CategoryToPost" ( "categoryId"integerNOTNULL, "postId"integerNOTNULL, "assignedBy"textNOTNULL"assignedAt"timestampNOTNULLDEFAULTCURRENT_TIMESTAMP,FOREIGN KEY("category...
无论您是否计划使用这些字段,名称都必须是唯一的。(在您的例子中,您 * 必须 * 在每个模型上定义两...
CREATETABLE"Category" ( id SERIALPRIMARYKEY );CREATETABLE"Post" ( id SERIALPRIMARYKEY );-- Relation table + indexes ---CREATETABLE"CategoryToPost" ( "categoryId"integerNOTNULL, "postId"integerNOTNULL, "assignedBy" textNOTNULL"assignedAt"timestampNOTNULLDEFAULTCURRENT_TIMESTAMP,FOREIGNKEY ("cate...
多对一:(街道→区县) * TBLJd.java 类* public class TblJd implements java.io.Serializable { ...
await prisma.user.create({ data: { name: 'Alice', email: 'alice@prisma.io', posts: { create: { title: 'Hello World' }, }, profile: { create: { bio: 'I like turtles' }, }, }, }) const allUsers = await prisma.user.findMany({ ...
Bug description When trying to create a new record (with many other actions nested within), schema works fine, everything looks good with TypeScript, but it fails when run. Debug output How to reproduce (With the files below, prisma info...
在关系的拥有者中(在一对一、一对多关系中,通常认为只存在一方拥有者,而在多对多关系中,通常认为互为拥有者)我们只需要定义字段以及字段代表的实体,而在关系的另一方中,我们需要使用prisma的@relation语法来标注这一字段表征的关系,如 user User? @relation(fields: [userId], references: [id]) ...
Create a new User and a new Post record in the same query// Run inside `async` function const user = await prisma.user.create({ data: { name: 'Alice', email: 'alice@prisma.io', posts: { create: { title: 'Join us for Prisma Day 2021' }, }, }, }) ...
CREATE TABLE "Post" ( id SERIAL PRIMARY KEY ); -- Relation table + indexes --- CREATE TABLE "CategoryToPost" ( "categoryId" integer NOT NULL, "postId" integer NOT NULL, "assignedBy" text NOT NULL "assignedAt" timestamp NOT NULL DEFAULT CURRENT_TIME...
Are available for relation fields when using the model's create or update query. The following section shows the nested write options that are available per query.Create a related recordYou can create a record and one or more related records at the same time. The following query creates ...