tomri
tomri
DTDrizzle Team
Created by monki boi on 11/9/2023 in #help
Unable to delete from many to many relationship due to FK constraint
there is a way. see the below code
userId: text('user_id')
.notNull()
.references(() => users.clerkId),
userId: text('user_id')
.notNull()
.references(() => users.clerkId),
userId: text('user_id')
.notNull()
userId: text('user_id')
.notNull()
both does the same job on high level when you introduce relations (refer here: https://orm.drizzle.team/docs/rqb#foreign-keys) so if you just remove references(() => table.column) you can delete them in a single query apparently. but id not recommend it tho
6 replies
DTDrizzle Team
Created by monki boi on 11/9/2023 in #help
Unable to delete from many to many relationship due to FK constraint
first the delete values from the referenced tables
6 replies
DTDrizzle Team
Created by tomri on 11/7/2023 in #help
is placeholder in prepare statements deprecated!??
4 replies
DTDrizzle Team
Created by Julio Barros on 11/3/2023 in #help
migrate with node-postgres
can you share the error message?
10 replies
DTDrizzle Team
Created by Mr Volcano on 11/3/2023 in #help
Appending SQL chunks to a query
db
.select()
.from(table)
.where(or(eq(user.status,status1),eq(user.status, staus2)));
db
.select()
.from(table)
.where(or(eq(user.status,status1),eq(user.status, staus2)));
13 replies
DTDrizzle Team
Created by Mr Volcano on 11/3/2023 in #help
Appending SQL chunks to a query
its unclear, but this what i could get: you are trying to read queries in nextjs search queries can be accessed via 'request' object from route. you can acces them like this:
import { NextRequest } from 'next/server'

export function GET(request: NextRequest) {
const { campaignId, status } = request.nextUrl.searchParams
console.log(compaignId);
// further logic
}
import { NextRequest } from 'next/server'

export function GET(request: NextRequest) {
const { campaignId, status } = request.nextUrl.searchParams
console.log(compaignId);
// further logic
}
13 replies
DTDrizzle Team
Created by tomri on 11/3/2023 in #help
error: column "id" cannot be cast automatically to type uuid
yeah, that was the issue, anyway thanks
9 replies
DTDrizzle Team
Created by tomri on 11/3/2023 in #help
error: column "id" cannot be cast automatically to type uuid
9 replies
DTDrizzle Team
Created by Julio Barros on 11/3/2023 in #help
migrate with node-postgres
I’d recommend using the CLI instead, because it doesn’t rely on any PostgreSQL client, apparently. Add your database URI to the config file under the dbCredentials field as a connection string:
// drizzle.config.ts

import { Config } from "drizzle-kit";

export default {
schema: "src/lib/db/schema.ts",
out: "src/lib/db/migrations",
driver: "pg",
dbCredentials: {
connectionString: process.env.DB_URI!,
},
} as Config;
// drizzle.config.ts

import { Config } from "drizzle-kit";

export default {
schema: "src/lib/db/schema.ts",
out: "src/lib/db/migrations",
driver: "pg",
dbCredentials: {
connectionString: process.env.DB_URI!,
},
} as Config;
And nowj you can ust run:
$ bun drizzle-kit push:pg
$ bun drizzle-kit push:pg
Now, you can do migrations without any concern about the actual client. P.S.: I’m a newbie in Drizzle too and I’m just “trying to help” you. I would welcome it if you correct me if I’m wrong.
10 replies
DTDrizzle Team
Created by tomri on 11/3/2023 in #help
error: column "id" cannot be cast automatically to type uuid
not woeking
9 replies