Help with query writing
Hi, I'm hoping someone will help me with this query. I have the following query in one of my service files:
`const results = await this.db
.select()
.from(team_projects)...

MySql NOW() in Drizzle
Hi! I might be struggling because this is hard to search for, but I'm wondering if it's possible to use mysql's
NOW()
function with Drizzle, rather than creating a new ts Date object and using that? Not that it matters much, but it would be good to keep everything in the db layer if possible. Apologies if I've missed this, I searched here, the reference docs site, and some READMEs on GitHub.Postgres: install plugin during migration
So, I'm using Drizzle with Postgres and am using uuid for the id fields.
For that, i need to run the command:
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
after creating the database.
...Introspect failing no pg_hba.conf entry for host
I'm trying to introspect an existing postgres db. It's hosted on heroku and I'm facing
no pg_hba.conf entry for host
error. I am able to connect with TablePlus to the same db without issues.
As I'm attempting to also use ?ssl={"rejectUnauthorized":false}
to work around this I'm getting Cannot use 'in' operator to search for 'key' in {"rejectUnauthorized":false}
. Any hints on how I might get this one connected?...Is there a way I can use relational types?
I'm currently trying to make a helper function that essentially wraps a database call, but I can't seem to find nor hack myself into getting a type for the
with
parameter in the relational queries.
I've tried things like
```ts
type T = NonNullable<Parameters<typeof db.query.projects.findFirst>[0]>["with"];...Difference in using unique() on the column definition vs the index?
What is the different between using something like
name: varchar('name', { length: 256 }).unique()
vs
`...Relational query problem
My goal is to get object of this shape:
```js
product: {
...
images: [{...}, {...}, {...}]...
Error: relation "offers_details" does not exist
Hey, I'm not really familiar with a lot of backend.
When I'm running this code it just saying the following:
...
Error: relation "offers_details" does not exist
Error: relation "offers_details" does not exist
Postgres + WITH sql
I'm trying to do the following sql:
```sql
WITH v (id) AS (
VALUES('448e2cc0-aa49-4339-babc-db8aec706ea6'),
('b7709b0a-5c38-436a-bad9-a7330890d7db'),...
sqlite http-proxy can't handle undefined values on `.get()` ?
Hi drizzle team! I've been playing with the http-proxy plugin to see how it works, and I hit a funny edge case trying to handle
undefined
values on get()
. The docs show this barebones example to set up an http proxy:
```ts
const db = drizzle(async (sql, params, method) => {
try {...Build fails because of drizzle typescript files
Created a node drizzle backend with typescript. When i run TSC for my build to compile
Any idea whats up? Im on the latest versions
...
Invalid config file when doing any command with drizzle-kit
This is my config file:
This is my terminal output when I try to push to the db (hosted on planetscale):
Any help with this would be greatly appreciated. Please do ask for any additional info if needed....

Is there any tip for unit testing with drizzle?
I'm trying to write unit test code with drizzle, but I have no idea how to write create statement with rollback.
- Using transaction for rollback could be a way, but I think it's too complicated for testing.
- Drizzle instance is too complicated to mock.
- I also have thought about creating repository class, but I don't think repository can handle complicated query (like query with join).
...
How to do this in drizzle schema?
I moved from PrismaORM convert this model schema to drizzleSchema (nested self)
How to do that?
```yml
model Category {...
introspect failing with pscale db
Getting a strange error when running the introspect command. I'm using a connectionString from pscale.
drizzle.config:
```
schema: "./schema.ts",
out: "./drizzle",...
Error
Hi, I'm getting the following build error (see attached file), any help would be appreciated. Using node v18 with Typescript.
Duplicate rows from distinct query
This query returns duplicate rows. Are there any things on the surface of this query that points to what the problem is?
```typescript
export async function getAllDynamicPrompts(limit: number = 10) {
const res = await db
.selectDistinct()...
order by array_position does not order the records in postgres
Using array_positions either throws error or ignores the order
If i try to do it this way i get an function array_position(record, character varying) does not exist error
```
const articleData = await db
.select()...
Placeholder in updates
Hello,
I just started using drizzle by doing a very simple todo app.
I have some trouble understanding how to get dynamic values inside the object taken by the set function on update.
...