Efren Palacios
08/20/2021, 11:14 PMShubh _
08/21/2021, 2:25 AMNote: There is another table to store the metadata like Age is a number, First Name is a String. And all these things are enforced by triggers etc. In other words, for every column in UserProfile (say first_name) I have another table (say UserProfileFields) where I store the meta information on "first_name". Whenever a new row is added/edited to UserProfileFields corresponding changes are reflected in UserProfile column using row level triggers.Should I still use Prisma, considering the variable nature of the schema of UserProfile relation? I am new to system design etc, and I apologise for any silly design flaws. I would be very grateful if I could get any inputs. Thank you.
Nathaniel Babalola
08/21/2021, 10:48 AMprisma.user
I was impressed, I have gone on to create 9 more models after this and the only thing it suggests is the other model names await prisma.modelname
, after this there's no types again once you start using create
, findMany
..e.t.c
When I hover my mouse over , it just shows type any
Can someone please help me out on how to fix this, it prevents me from making some errors as I know what method and properties are safe to useRobin
08/21/2021, 11:10 AMKhammassi HoussemEddine
08/21/2021, 4:32 PMKhammassi HoussemEddine
08/21/2021, 4:33 PMYashua Pervez
08/21/2021, 5:36 PMShubh _
08/22/2021, 11:28 AMSlackbot
08/22/2021, 1:00 PMglekner
08/22/2021, 3:05 PM_await_ ctx.prisma?.[resourceType].delete()โฆ
glekner
08/22/2021, 3:05 PMJaye
08/23/2021, 9:20 AM/cypress/plugins/index.js
i have:
const seedDb = require("../../prisma/seed.js")
module.exports = on => {
on("task", {
resetDb: async () => {
await seedDb()
return true
},
})
}
which works fine, but my prisma seed file can't find the database url: ๐
const { PrismaClient } = require("@prisma/client")
const prisma = new PrismaClient()
const main = async () => {
// make stuff here
}
main()
.catch(e => {
console.error(e)
process.exit(1)
})
.finally(async () => {
await prisma.$disconnect()
})
module.exports = main
i'm invoking it using a command like this in my npm scripts, like the docs suggest
"cypress": "dotenv -e .env.test next dev & cypress open",
and i have a .env.test
file defined with a working DATABASE_URL
string.
what am i doing wrong?user
08/23/2021, 10:04 AMTobias Lins
08/23/2021, 10:41 AMexport const prisma = new PrismaClient();
and all performance issues were resolved.
Should I create a ticket for that?Tarik Brat
08/23/2021, 10:47 AMbenjick
08/23/2021, 12:35 PMJson
but when I try to write data to it I get the following error:
Type 'OrderOutput[]' is not assignable to type 'InputJsonValue'.I thought Json should be able to take any valid json. Pasting the interface in the thread ๐
user
08/23/2021, 1:19 PMbenjick
08/23/2021, 1:20 PMForeign key constraint failed on the field:I tried googling but I couldn't find any good explanation. Is it because some tables have Int as id while others have String?Print_userId_fkey (index)
user
08/23/2021, 7:48 PMRobin
08/24/2021, 6:53 AMmodel Solve {
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId Int
challenge Challenge @relation(fields: [challengeId], references: [id], onDelete: Cascade)
challengeId Int
createdAt DateTime @default(now()) @map(name: "created_at")
@@id([userId, challengeId])
}
Robin
08/24/2021, 6:53 AMprisma.user.delete({where:...})
, I get the following error: `The change you are trying to make would violate the required relation 'SolveToUser' between the Solve
and User
models.`Robin
08/24/2021, 6:53 AMDev__
08/24/2021, 7:39 AMreferenceId Int
========
model A
model B
model C
how can I say that referenceId
can be either A
, B
or C
Robin
08/24/2021, 9:24 AMmodel Account {
id Int @default(autoincrement()) @id
compoundId String @unique @map(name: "compound_id")
userId Int @map(name: "user_id")
providerType String @map(name: "provider_type")
providerId String @map(name: "provider_id")
providerAccountId String @map(name: "provider_account_id")
refreshToken String? @map(name: "refresh_token")
accessToken String? @map(name: "access_token")
accessTokenExpires DateTime? @map(name: "access_token_expires")
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @map(name: "updated_at")
@@index([providerAccountId], name: "providerAccountId")
@@index([providerId], name: "providerId")
@@index([userId], name: "userId")
@@map(name: "accounts")
}
How do I delete an entry by specifing a userId now? I tried this
await prisma.account.delete({
where: {
userId: userId,
},
});
which results in Type '{ userId: number; }' is not assignable to type 'AccountWhereUniqueInput'.
See Jee
08/24/2021, 11:39 AMinlightmedia
08/24/2021, 1:34 PMnpx prisma1 introspect
and npx prisma1 init
both do nothing. Iโm using all the correct database connection data (these same connection data work perfectly when using psql to connect). Iโm running these both from the same folder where I use npx prisma1 deploy
successfully daily. When the interactive cli data entry tool reaches the last question (the ssl question) it just seems to quit, return to the cli and leaves no errors, no output and no introspected datamodel file.
Any ideas?inlightmedia
08/24/2021, 1:59 PMะขะพัะต
08/24/2021, 2:20 PMError: @prisma/client did not initialize yet. Please run \"prisma generate\" and try to import it again.\nIn case this error is unexpected for you, please report it in <https://github.com/prisma/prisma/issues>\n at new PrismaClient (/usr/app/node_modules/.prisma/client/index.js:3:11)\n at /usr/app/main.js:28701:20\n at Plugin.exec (/usr/app/node_modules/avvio/plugin.js:132:19)\n at Boot.loadPlugin (/usr/app/node_modules/avvio/plugin.js:267:10)\n at Task.release (/usr/app/node_modules/fastq/queue.js:149:16)\n at worked (/usr/app/node_modules/fastq/queue.js:201:10)\n at /usr/app/node_modules/avvio/plugin.js:270:7\n at done (/usr/app/node_modules/avvio/plugin.js:202:5)\n at check (/usr/app/node_modules/avvio/plugin.js:226:9)\n at node:internal/process/task_queues:141:7","type":"Error","msg":"@prisma/client did not initialize yet. Please run \"prisma generate\" and try to import it again.\nIn case this error is unexpected for you, please report it in <https://github.com/prisma/prisma/issues>"}
prisma/cli is required to run prisma generateIrakli Safareli
08/24/2021, 4:37 PMCOMMENT ON Table foo is "bla bla"
in PG database. Will prisma pull then use that comment in prisma file like this?:
/// bla bla
model foo {
...
}
Giorgio Delgado
08/24/2021, 4:56 PM