Kawthar
Kawthar
Explore posts from servers
DTDrizzle Team
Created by Kawthar on 9/30/2024 in #help
Types error with where filter
No description
2 replies
DTDrizzle Team
Created by Kawthar on 9/10/2024 in #help
Type mismatch between tables from schema and drizzle-orm functions
I am getting an error for type mismatch while trying a simple db.delete(table) query:
Argument of type 'PgTableWithColumns<{...columns}, {}, {}>; title: PgColumn<...>; desiredWeeklyFrequency...' is not assignable to parameter of type 'PgTable<TableConfig>'
Argument of type 'PgTableWithColumns<{...columns}, {}, {}>; title: PgColumn<...>; desiredWeeklyFrequency...' is not assignable to parameter of type 'PgTable<TableConfig>'
.How can I fix this? These are the related files:
// schema.ts
import { createId } from '@paralleldrive/cuid2';
import { integer, pgTable, text, timestamp } from 'drizzle-orm/pg-core';

export const goals = pgTable('goals', {
id: text('id')
.primaryKey()
.$defaultFn(() => createId()),
title: text('title').notNull(),
desiredWeeklyFrequency: integer('desired_weekly_frequency').notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
});

export const completedGoals = pgTable('completed_goals', {
id: text('id')
.primaryKey()
.$defaultFn(() => createId()),
goalId: text('goal_id')
.references(() => goals.id, { onDelete: 'cascade' })
.notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
});
// schema.ts
import { createId } from '@paralleldrive/cuid2';
import { integer, pgTable, text, timestamp } from 'drizzle-orm/pg-core';

export const goals = pgTable('goals', {
id: text('id')
.primaryKey()
.$defaultFn(() => createId()),
title: text('title').notNull(),
desiredWeeklyFrequency: integer('desired_weekly_frequency').notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
});

export const completedGoals = pgTable('completed_goals', {
id: text('id')
.primaryKey()
.$defaultFn(() => createId()),
goalId: text('goal_id')
.references(() => goals.id, { onDelete: 'cascade' })
.notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
});
// seed.ts
import dayjs from 'dayjs';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import env from '../env';
import * as schema from './schema';

export const client = postgres(env.DATABASE_URL);
export const db = drizzle(client, { schema, logger: true });

async function seed() {
await db.delete(schema.goals);
}

seed().finally(() => {
client.end();
process.exit();
});
// seed.ts
import dayjs from 'dayjs';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import env from '../env';
import * as schema from './schema';

export const client = postgres(env.DATABASE_URL);
export const db = drizzle(client, { schema, logger: true });

async function seed() {
await db.delete(schema.goals);
}

seed().finally(() => {
client.end();
process.exit();
});
1 replies
PPrisma
Created by Kawthar on 9/6/2024 in #help-and-questions
Deploy to vercel with supabase as database
I am trying to deploy a Sveltekit app to Vercel using Supabase as my database and I am getting an error saying that I need to use an adapter for edge runtime:
Error: PrismaClient is not configured to run in Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware). In order to run Prisma Client on edge runtime, either:
- Use Prisma Accelerate: https://pris.ly/d/accelerate
- Use Driver Adapters: https://pris.ly/d/driver-adapters
Error: PrismaClient is not configured to run in Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware). In order to run Prisma Client on edge runtime, either:
- Use Prisma Accelerate: https://pris.ly/d/accelerate
- Use Driver Adapters: https://pris.ly/d/driver-adapters
But reading the docs I can't understand which adapter I should use for Supabase. Does anyone know how do I configure Prisma for supabase on Vercel?
2 replies
PPrisma
Created by Kawthar on 5/30/2024 in #help-and-questions
Prisma client doesn't get updated with new columns after db pull
No description
4 replies