Jacob Duval
08/15/2022, 11:07 PMActiveRecord::Base.connection.execute(
<<-SQL
SET "hasura.user" = '#someuser'
SQL
)
How can I inject this sort of behaviour into prisma? Or is it just not possible?Hussam Khatib
08/16/2022, 6:02 AMconst email = '<mailto:emelie@prisma.io|emelie@prisma.io>'
const result = await prisma.$queryRaw`SELECT * FROM User WHERE email = ${email}`
This would not work as email
is enclosed in qoutes. It would work if const email = 2
for example
DB : mySqlChristoffer
08/16/2022, 7:53 AM@@unique([user_id, auth_type])
Christoffer
08/16/2022, 7:53 AMDerock
08/16/2022, 1:23 PMprisma.$connect()
or any primsa query)
Commands like prisma db push
work perfectly fine in the same environment.Derock
08/16/2022, 1:23 PMDerock
08/16/2022, 1:24 PMDEBUG=*
env is setDerock
08/16/2022, 1:24 PMDerock
08/16/2022, 1:24 PMItalo Gama
08/16/2022, 2:52 PMRobert Lee
08/16/2022, 6:10 PMDATABASE_URL
will all have migration errors.
Anyone have a solid creative solution to this besides force pushing to staging branches w/ specific `DATABASE_URL`s defined to them?Taylor Cantwell
08/17/2022, 2:24 AMdata: {
roleId: 'UEET',
user: {
update: {
...rest,
},
},
},
Enzot
08/17/2022, 11:17 AMBastien Etienne
08/17/2022, 1:48 PMBenjamin FROLICHER
08/17/2022, 2:06 PM"start:dev": "dotenv -e ./.env.local -- nest start --watch",
When lauching
npm start run:dev
I have the following error
Error: error: Environment variable not found: DATABASE_URL.
--> schema.prisma:10
|
9 | provider = "postgresql"
10 | url = env("DATABASE_URL")
|
Working solution :
dotenv -e .env.local -- npm start run:dev
Do you have an idea ?Arpit Satyal
08/17/2022, 2:17 PMSlackbot
08/17/2022, 3:47 PMTed Joe
08/17/2022, 5:04 PMcreatedAt
, updatedAt
, deletedAt
, etc.
Do I have to manually create them on every field or is there a place in prisma I can add it once, and have it add on every model?Vivek Poddar
08/17/2022, 5:57 PM{
"errorType": "Error",
"errorMessage": "@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>",
"stack": [
"Error: @prisma/client did not initialize yet. Please run \"prisma generate\" and try to import it again.",
"In case this error is unexpected for you, please report it in <https://github.com/prisma/prisma/issues>",
" at new PrismaClient (/var/task/node_modules/.prisma/client/index.js:3:11)",
" at Object.<anonymous> (/var/task/index.js:90:10)",
" at Module._compile (internal/modules/cjs/loader.js:1085:14)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
" at Module.load (internal/modules/cjs/loader.js:950:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
" at Module.require (internal/modules/cjs/loader.js:974:19)",
" at require (internal/modules/cjs/helpers.js:101:18)",
" at _tryRequireFile (/var/runtime/UserFunction.js:71:32)",
" at _tryRequire (/var/runtime/UserFunction.js:159:20)"
]
}
Vivek Poddar
08/17/2022, 5:58 PMAlban Kaperi
08/17/2022, 6:11 PMconst customers = await prisma.employee.findMany({
include: {
workingHours: true,
},
})
output:
[
{
"id": 1,
"name": "beth",
"surname": "halvorson",
"gender": "Female",
"email": "<mailto:bethhalvorson@gmail.com|bethhalvorson@gmail.com>",
"phone": "501-945-084",
"code": "kn7v6",
"points": 12941,
"workingHours": [
{
"id": 1,
"normalTime": 7,
"overTime": 1,
"doubleTime": 1,
"vacationTime": 0,
"sickTime": 0,
"employeeId": 1,
},
{
"id": 2,
"normalTime": 4,
"overTime": 3,
"doubleTime": 1,
"vacationTime": 0,
"sickTime": 0,
"employeeId": 1,
},
]
},
]
I want to change the query to receive smth like this:
[
{
"id": 1,
"name": "beth",
"surname": "halvorson",
"gender": "Female",
"email": "<mailto:bethhalvorson@gmail.com|bethhalvorson@gmail.com>",
"phone": "501-945-084",
"code": "kn7v6",
"points": 12941,
"_sum": {
"totalHours": 18,
},
},
]
where _sum: is the total of all columns(normalTime, overTime, vacationTime, sickTime)
I didn't want to use javascript methods to achieve thatOmar
08/17/2022, 8:11 PMoutputObjectTypes
and not under inputObjectTypes
like all other operations?Okan Yıldırım
08/17/2022, 8:41 PM_model_ User {
personalData _PersonalData_?
}
model PersonalData {
user _User_ @relation(_fields_: [userId], _references_: [id], _onDelete_: Cascade, _onUpdate_: Cascade)
userId _Int_ @unique
}
Alejandro Diaz
08/17/2022, 8:47 PMRichard Kaufman-López
08/17/2022, 9:33 PMprisma.user.findMany({ select: { posts: true } })
from returning a soft-delete post?will
08/17/2022, 9:43 PMSanti Buenahora
08/17/2022, 10:00 PMPrisma.ProductWhereInput
into a raw WHERE statement?
Or to get the SQL for a call like prisma.product.find_many({ where })
?Guillermo David
08/17/2022, 10:05 PMwhere: {
firstName: { search: 'word' },
lastName: { search: 'word' },
} // this is an error
but when I try to use differents string in the firstName and lastname is correct the functionAlmog Baku
08/18/2022, 6:19 AMAlmog Baku
08/18/2022, 6:21 AMSELECT <fields> FROM <db.table> WHERE regexp_replace(mobile_phone, '[^\w]', 'g') = <value>