khareta
06/22/2021, 2:59 PMDB
._FavoriteItems
, CONSTRAINT _FavoriteItems_ibfk_1
FOREIGN KEY (A
) REFERENCES Item
(id
) ON DELETE CASCADE ON UPDATE CASCADE)`
this is the mysql table:
'CREATE TABLE `_FavoriteItems` (
`A` char(25) CHARACTER SET utf8 NOT NULL,
`B` char(25) CHARACTER SET utf8 NOT NULL,
UNIQUE KEY `_FavoriteItems_AB_unique` (`A`,`B`),
KEY `_FavoriteItems_B_index` (`B`),
CONSTRAINT `_FavoriteItems_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `_FavoriteItems_ibfk_2` FOREIGN KEY (`B`) REFERENCES `User` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci'
this is the prisma model:
model Item {
favoritedBy User[] @relation("FavoriteItems")
}
model User {
favoriteItems Item[] @relation("FavoriteItems")
}
and this is the insert/connect statement:
INSERT IGNORE INTO
`DB`.`_FavoriteAds` (
`DB`.`_FavoriteItems`.`A`,
`DB`.`_FavoriteItems`.`B`
) VALUES ("itemId","userId")
Note that both itemId and userId exist in the database. A user can have many favorite items.khareta
06/22/2021, 3:00 PMCopium Dealer
06/22/2021, 5:02 PMCopium Dealer
06/22/2021, 5:02 PMArun Kumar
06/22/2021, 5:37 PMArun Kumar
06/22/2021, 5:49 PM--force
command but still the docker says that schema is invalid and I should run with the --force
flag.
Step 8/10 : RUN npx prisma introspect --force
---> Running in ff2f1297b22c
Prisma schema loaded from prisma/schema.prisma
Introspecting based on datasource defined in prisma/schema.prisma …
Error: P1012 Introspection failed as your current Prisma schema file is invalid
Please fix your current schema manually, use prisma validate to confirm it is valid and then run this command again.
Or run this command with the --force flag to ignore your current schema and overwrite it. All local modifications will be lost.
npm notice
npm notice New minor version of npm available! 7.15.1 -> 7.18.1
npm notice Changelog: <<https://github.com/npm/cli/releases/tag/v7.18.1>>
npm notice Run `npm install -g npm@7.18.1` to update!
npm notice
The command '/bin/sh -c npx prisma introspect --force' returned a non-zero code: 1
Error: Process completed with exit code 1.
ali
06/23/2021, 6:04 AMPrismaClientKnownRequestError
as documented here: https://www.prisma.io/docs/reference/api-reference/error-reference
Is my understanding incorrect?
Please let me know. Thanks.Marko
06/23/2021, 8:22 AMtestAt DateTime
testTzAt DateTime @db.Timestamptz
From my understanding timestamp without timezone should store DateTime in the local time, but for what ever reason,
when ever I save this, both of them get converted to UTC:
testAt: '2021-06-24T01:16:14.963+02:00',
testTzAt: '2021-06-24T01:16:14.963+02:00',
When I read the selected row, this is what I get back:
testAt: 2021-06-23T23:16:14.963Z,
testTzAt: 2021-06-23T23:16:14.963Z,
What am I doing wrong here, because currently I don't see any difference here.
Thank you!Orkhan Rustamli
06/23/2021, 8:27 AMSubash Ganesh
06/23/2021, 9:31 AMNichita Z
06/23/2021, 9:54 AMHalvor
06/23/2021, 12:21 PMDan Shapir
06/23/2021, 12:27 PMNikhil Goyal
06/23/2021, 12:30 PMLeandro F.Laurito
06/23/2021, 12:42 PMFelipe Belinassi
06/23/2021, 12:45 PMconst data = await prisma.model.create({
data: {
id: (await prisma.model.count()) + 1,
...params,
},
});
Is there other way for doing this?Halvor
06/23/2021, 1:37 PMHalvor
06/23/2021, 1:37 PMmanuel
06/23/2021, 2:18 PMuser
06/23/2021, 3:16 PMFaiyam Rahman
06/23/2021, 9:22 PMUncheckedInput
types in prisma two? I searched unchecked
and unchecked input
on the prisma docs and couldn't find any.
For context, I'm running into an error on a nested write where I expect to be able to define writes on a connected relation, but for some reason prisma is using the "unchecked" input, which doesn't allow writes on the connected relation.Halvor
06/23/2021, 10:34 PMHalvor
06/23/2021, 10:35 PMHalvor
06/23/2021, 10:46 PMnikunj chaudhari
06/24/2021, 3:02 AMnew ApolloServer({ schema, context: { prisma } });
since i am using ts but i couldn't get autocomplete or suggestion.Copium Dealer
06/24/2021, 3:05 AMCopium Dealer
06/24/2021, 3:05 AMCopium Dealer
06/24/2021, 3:07 AMArun Kumar
06/24/2021, 8:15 AMHenri Kuper
06/24/2021, 9:23 AMurl = env("POSTGRES_URL")
to work with local, dev and prod environments without manually set the url into the schema.
The app says error: Environment variable not found: POSTGRES_URL.
It works fine if I open prisma studio from the terminal.
Is there I way to add e.g 3 urls that I can select, to quickly work with the app on local, dev and prod? Do I miss anything?
Otherwise I would need to add the full url directly to the schema each time, which is not very handy.