Schuyler Ankele
09/14/2021, 9:47 PMprisma db pull
to create the baseline I have a single migration created. Next, I mark the init migration as applied. But then if I run prisma db push
I get an error with drift detected
, with no changes to the schema. If I create a new migration I get the same error and Prisma Migrate insists on resetting the DB. I saw an issue in Github, but it was marked resolved. Has anyone else run into this or resolved it? Am I missing something in the initial setup?prisma chobo
09/14/2021, 10:30 PMPrismaClientKnownRequestError:
Invalid `prisma.queryRaw()` invocation:
Raw query failed. Code: `N/A`. Message: `N/A`
at RequestHandler.request (/Users/kyuhakyuk/github/wallet/api/node_modules/@prisma/client/runtime/index.js:37318:15) {
code: 'P2010',
clientVersion: '3.0.2',
meta: { code: 'N/A', message: 'N/A' }
}
For this line of code:
const result = (await prisma.$queryRaw(
Prisma.sql`SELECT SUM(amount) as balance FROM Balance WHERE account=“${accountId}” and deletedAt is NULL`
)) as any;
it used to work just find but now it does not….
aEthan Joffe
09/14/2021, 11:12 PMon prisma.createOneFramework. Provided List<Json>, expected FrameworkItemCreateWithoutFrameworkInput or FrameworkItemCreateWithoutFrameworkInput or FrameworkItemUncheckedCreateWithoutFrameworkInput or FrameworkItemUncheckedCreateWithoutFrameworkInput:
type FrameworkItemCreateWithoutFrameworkInput {
name: String
....
Ethan Joffe
09/14/2021, 11:13 PMSaurabh Lohiya
09/15/2021, 7:11 AMprisma@3.0.2
version and when I type prisma init
it does not generate the 3 files like datamodel.graphql docker-compose.yml
and prisma.yml
yes I'm using node 12.19.1
and even when I'm manuelly creating files I can't run the command docker-compose up -d
it throws me the error like `ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default``. Help me here!!! When I run that command it shows me the message like
Starting "default"...
Machine "default" is already running.
Jonas
09/15/2021, 8:50 AMJonas
09/15/2021, 8:56 AMuser
09/15/2021, 9:57 AMHenri Kuper
09/15/2021, 10:26 AMMischa
09/15/2021, 10:32 AM'Context: Timed out trying to acquire a postgres advisory lock (SELECT pg_advisory_lock(72707369)). Elapsed: 10000ms. See <https://pris.ly/d/migrate-advisory-locking> for details.',
Mischa
09/15/2021, 10:32 AMMatt Young
09/15/2021, 2:23 PMMatt Young
09/15/2021, 2:23 PMMatt Young
09/15/2021, 2:24 PMMatt Young
09/15/2021, 2:25 PMMatt Young
09/15/2021, 2:25 PMMatt Young
09/15/2021, 2:28 PMEric Kidd
09/15/2021, 3:02 PMmodel Post {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
tags Tag[]
}
model Comment {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
tags Tag[]
}
model Tag {
resourceType String // One of "Post" or "Comment"
resourceId @db.Uuid
value String
}
For example, we could find all the tags associated with post a5c4b960-d5da-4e7b-abb5-0860bd85903d by querying:
SELECT * FROM Tag WHERE resourceType = 'Post' AND resourceId = 'a5c4b960-d5da-4e7b-abb5-0860bd85903d';
Ideally, I would like to able to write:
client.source_tables.findUnique({
where: { id: "a5c4b960-d5da-4e7b-abb5-0860bd85903d" },
include: { tags: true }
});
If I could do this, it would simplify a lot of code. The actual use case is more complicated than this, but that's the general idea. (The fact that resourceId
is globally unique means that we have the option of ignoring resourceType
, if that helps.)
I've read https://www.prisma.io/docs/concepts/components/prisma-schema/relations and Googled "prisma polymorphic relations", but I can't find a "best practice" for handling this situation with the current version of Prisma. Thank you for any insight anyone can provide!Arfath Tade
09/15/2021, 3:53 PMmodel Test {
id string
res Json
}
I want to update multiple rows with different id of the above model
I am getting syntax error while running the below query
prisma.$queryRaw(`UPDATE "TEST" AS T SET
"res" = a.res
FROM (VALUES ${updatedData})
AS a(id, res)
WHERE a.id = C.id;`);
updateData have value ('1', '[{"name": 'abc'}]'), ('2', '[{"name": 'xyz'}]')
I tried adding JSONB after every res values and also after a.res but nothing worked
can you please help me on this?
Error:
(node:23980) UnhandledPromiseRejectionWarning: Error:
Invalid `prisma.queryRaw()` invocation:
Raw query failed. Code: `42601`. Message: `db error: ERROR: syntax error at or near "m"`
at cb (/node_modules/@prisma/dist/runtime/index.js:34800:17)
Keenahn Jung
09/15/2021, 7:02 PMKeenahn Jung
09/15/2021, 7:04 PMfactory-girl
if you're familiar.
First roadblock, how do I get a union type of all Prisma models?
I see Prisma.ModelName
which is cool. But when I try to do
type PrismaModel = Prisma[Prisma.ModelName]
Keenahn Jung
09/15/2021, 7:04 PMKeenahn Jung
09/15/2021, 7:04 PMJonas Rothmann
09/16/2021, 4:34 AMcustomerId: 12
instead of
customer: { connect: { id: 12 } }
Aditya Chadha
09/16/2021, 5:30 AMAditya Chadha
09/16/2021, 5:31 AMYeonHoPark
09/16/2021, 6:54 AMJonas
09/16/2021, 8:22 AMSubho
09/16/2021, 9:34 AMHarsha MV
09/16/2021, 9:39 AM// TODO: Adding Dynamic Filters & Sorting
// Limit - How many records needed
// Sort - Listing Date, Public Date, Pre-Sale Date
// Filter - Mint Price Range, Market Place, Blockchain, Project Type, Categories
// Defaults - Pubic Sale Asc, 5 Days
// Pagination - rows, dates
Right now am trying to build multiple where clause to accommodate the above but it doesnt seem to be efficient.