Unix Timestamp conditions
`{ onDelete: "cascade" }` when the entity is in one-to-one relationship with multiple entities?
{ onDelete: "cascade" }
when the entity is in one-to-one relationship with multiple entities?
I have a users
, friendRequests
and locations
....+21.000 row reads in query, how can I improve performance?
Window function fails with many-to-one relationship
You cannot use the window function 'sum' in this context.
...self reference error
'users' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)
const users: any
...[solved] database.insert is not a function
Count with Limit
select count(*) as total from (select 1 from post WHERE ... limit 1000);
select count(*) as total from (select 1 from post WHERE ... limit 1000);
How to use cascade with a multi-column foreign key?
references
I can tell a foreign key to cascade on a delete easily. However:
I have a table with a composite primary key:
```ts...define a jsonb column with `{}` as default value does not work
``ts
attrs: pg
.jsonb('attrs')
.$type<Record<string, JSONValue>>()
.default(sql
'{}'::jsonb`).notNull(),...How to do "onConflictDoUpdate" when inserting an array of values?
[solved] Parameterized Column Selection
Two problems about SQLite
What is the best way to join with JSONB arrays with Drizzle?
Query Attached Databases in SQLite
drizzle-kit not detecting tsconfig and getting path alias '~/'
drizzle-kit push:pg --config=drizzle.config.ts
If I just remove the .default(PDF_PARSE_STATUS.PENDING)
in my schema (but keep the import import { PDF_PARSE_STATUS } from '~/types';
), it will succeed
...Infer select that includes a foreign key object collection?
search on all `with` and `columns` fields via text (sqlite)
better-sqlite3
as the driver. I have a bunch of fields selected via columns
& with
(nested fields) & an offset based pagination. I'm using the querybuilder (.query
). How would I go about performing a full text search on the selected columns as well as the selected nested columns? Say,
```ts
const { offset, query, limit} = input;
const result = ctx.db.query.myModel.findMany({
limit: limit ?? 10,...WITH + UPDATE
Does Drizzle-Orm Expose Wrapper Types?
where
filter or order
filter so in case I ever change to a different ORM I can do so. Does drizzle-orm expose the types for each of these methods?
Or is there some example of folks writing a general wrapper around it?
For example, type-orm
exposes a lot of input option types like below:...PG Array and drizzle-zod issues