Septatrix
Septatrix
DTDrizzle Team
Created by Septatrix on 3/18/2024 in #help
Should "_meta" directory be checked into git?
I am not sure whether it should be added to the repo or if it not necessary for deployment. Also, if it is necessary, does Drizzle need to write to it when applying the migrations or is read-access to those files sufficient?
1 replies
DTDrizzle Team
Created by Septatrix on 1/15/2024 in #help
Delete row and return value including data from relation
Hey everyone, I am currently rewriting a Prisma project where we are using prisma.foobar.delete({include: { RelatedData: true }}). The related data is deleted due to cascading but also returned by prisma so we can perform some finalizing based on it. Is this also possible with Drizzle (in only a single query). I found .returning() but I cannot find a way to also return data from relations any way.
5 replies
DTDrizzle Team
Created by Septatrix on 10/31/2023 in #help
`SqliteError: near "(": syntax error` when using `notExists`
It seems like queries with notExists clauses add a pair of parentheses too many:
db
.select({ foobar: sql<number>`1` })
.from(content)
.where(notExists(db.select({ foobar: sql<number>`1` }).from(content)))
.toSQL()
// Output:
{
sql: 'select 1 from "Content" where not exists ((select 1 from "Content"))',
params: []
}
db
.select({ foobar: sql<number>`1` })
.from(content)
.where(notExists(db.select({ foobar: sql<number>`1` }).from(content)))
.toSQL()
// Output:
{
sql: 'select 1 from "Content" where not exists ((select 1 from "Content"))',
params: []
}
Am I doing something wrong or does someone know a workaround?
6 replies
DTDrizzle Team
Created by Septatrix on 9/22/2023 in #help
What is the purpose of the _meta directory?
I am currently looking into using drizzle-kit for migrations and was wondering what the _meta directory does. Currently this part of the migration workflow is undocumented leaving several questions unanswered. Initially I tried to inspect the code myself and find out what it is used alas the source code of drizzle-kit is still not available (https://github.com/drizzle-team/drizzle-orm/issues/580). Currently I wonder if it has to be checked in to git, and under what circumstances it is required to read from as well as write to this directory. This would influence how drizzle migrations can/will be deployed on production: Does it have to be part of the deployed code, can it be non-existent, is it only needed for ephemeral data or does it have to persist data (i.e. in docker this would have to be a mounted volume), is it sufficient to only read from there (i.e. in docker this would allow increased security by marking the filesystem as readonly) etc... https://github.com/drizzle-team/drizzle-kit-mirror/issues/196
3 replies