alka_99
alka_99
Explore posts from servers
DTDrizzle Team
Created by alka_99 on 6/22/2024 in #help
Cannot find package 'drizzle-orm' in sveltekit docker
No description
4 replies
DTDrizzle Team
Created by alka_99 on 5/11/2024 in #help
how to make date in timestamp
No description
2 replies
DTDrizzle Team
Created by alka_99 on 3/18/2024 in #help
Auto Increment custom id with prefix GRO
Hi guys. New here, anyone know how to create custom id where i want to have GRO0001 GRO0002 and so on with prefix GRO and the numbers will be auto increment.
11 replies
DTDrizzle Team
Created by alka_99 on 2/26/2024 in #help
Multiple orderby in single relation
Hi Guys I want to know how to do multiple sort like for example there is 2 column called priority and created_at. If priority is filled or not null or not = 0 it will use the priority If priority is not filled or null or = 0 it will use created_at here is my code
const result = await db.query.property.findFirst({
with: {
content: {
with: {
photos: {
orderBy: (photos, { desc }) => [desc(photos.priority)]},
facilities: true
}
},
room_type: {
with: {
rate_plans: true
}
},
},
where: (property, { eq }) => eq(property.slug, slug),
});
const result = await db.query.property.findFirst({
with: {
content: {
with: {
photos: {
orderBy: (photos, { desc }) => [desc(photos.priority)]},
facilities: true
}
},
room_type: {
with: {
rate_plans: true
}
},
},
where: (property, { eq }) => eq(property.slug, slug),
});
i only able to do one
1 replies
DTDrizzle Team
Created by alka_99 on 2/18/2024 in #help
Allow null in integer
No description
2 replies
DTDrizzle Team
Created by alka_99 on 2/10/2024 in #help
Cant query with relation using query method
No description
6 replies
DTDrizzle Team
Created by alka_99 on 2/8/2024 in #help
TypeError: db.update(...).values is not a function
Hi Guys New here in drizzle. I'm using sveltekit, and i try to create somekind of update/edit form but i get this error TypeError: db.update(...).values is not a function
import type { Actions } from './$types.ts';
import * as schema from '$lib/schema.js';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import { PUBLIC_DRIZZLE_DATABASE_URL } from '$env/static/public';
import { fail } from '@sveltejs/kit';

const sql = postgres(PUBLIC_DRIZZLE_DATABASE_URL!);
const db = drizzle(sql, { schema: schema });

export const actions: Actions = {
update: async ({ request }) => {
const body = Object.fromEntries(await request.formData());
console.log(body, 'testttt');
if (!body) {
return fail(400, {
error: 'Something went wrong'
})
}
await db.update(schema.property).values(body).where(eq(schema.property.id, body.id))
},
};
import type { Actions } from './$types.ts';
import * as schema from '$lib/schema.js';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import { PUBLIC_DRIZZLE_DATABASE_URL } from '$env/static/public';
import { fail } from '@sveltejs/kit';

const sql = postgres(PUBLIC_DRIZZLE_DATABASE_URL!);
const db = drizzle(sql, { schema: schema });

export const actions: Actions = {
update: async ({ request }) => {
const body = Object.fromEntries(await request.formData());
console.log(body, 'testttt');
if (!body) {
return fail(400, {
error: 'Something went wrong'
})
}
await db.update(schema.property).values(body).where(eq(schema.property.id, body.id))
},
};
2 replies
DTDrizzle Team
Created by alka_99 on 2/6/2024 in #help
TypeError: client.unsafe is not a function
Hi Guys I got a challenge where it said TypeError: client.unsafe is not a function. so basically i was switching from neondb to supabase, in the drizzle documentations i need to use postgres.js as the packages and remove @Neondatabase/serverless. but i relized because im using cloudflare pages, that postgres.js is not edge compatible although there is workaround using
compatibility_flags = ["nodejs_compat"]
compatibility_flags = ["nodejs_compat"]
but i just do some experimentation to use @Neondatabase/serverless with supabase db, has anyone tried it?? I try it but i get error: TypeError: client.unsafe is not a function. although using nodejs_compat is fine, i just want to remove too much complexity because im still begineer and it's more neat not to use nodejs_compat
2 replies
DTDrizzle Team
Created by alka_99 on 2/4/2024 in #help
migration:pg is not adding my new table
HI guys, I encountered an issues where the console says: No schema changes, nothing to migrate 😴 when in fact i add new 2 tables: userTable and sessionTable
3 replies
DTDrizzle Team
Created by alka_99 on 1/27/2024 in #help
How to not loss data everytime i change the schema
No description
4 replies
DTDrizzle Team
Created by alka_99 on 1/26/2024 in #help
How to access multiple relations in query
No description
6 replies