regex
regex
Explore posts from servers
DTDrizzle Team
Created by regex on 9/27/2024 in #help
Type error in 0.33.0
export const cities = pgTable("cities", {
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
});
export const cities = pgTable("cities", {
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
});
Argument type {name: PgVarcharBuilder<{name: "name", dataType: "string", columnType: "PgVarchar", data: [string, ...string[]][number], driverParam: string, enumValues: [string, ...string[]], generated: undefined}>, id: PgSerialBuilder & {: {notNull: true}} & {: {isPrimaryKey: true}}} is not assignable to parameter type Record<string, PgColumnBuilderBase> Setting the id with .primaryKey throws a type error.
1 replies
DTDrizzle Team
Created by regex on 6/22/2024 in #help
Is this a bad pattern to do? I wanna call my local postgre while developing and use neon in prod.
import { drizzle as drizzleNeon } from "drizzle-orm/neon-http";
import { drizzle as drizzlePostgres } from "drizzle-orm/postgres-js";

import { neon } from "@neondatabase/serverless";
import { config } from "dotenv";
import postgres from "postgres";
import { isProd } from "@/lib/utils";
config({ path: ".env" });

// Dev
const queryClient = postgres(process.env.DEV_DATABASE_URL!);
// Prod
const sql = neon(process.env.PROD_DATABASE_URL!);

export const db = isProd() ? drizzleNeon(sql) : drizzlePostgres(queryClient);
import { drizzle as drizzleNeon } from "drizzle-orm/neon-http";
import { drizzle as drizzlePostgres } from "drizzle-orm/postgres-js";

import { neon } from "@neondatabase/serverless";
import { config } from "dotenv";
import postgres from "postgres";
import { isProd } from "@/lib/utils";
config({ path: ".env" });

// Dev
const queryClient = postgres(process.env.DEV_DATABASE_URL!);
// Prod
const sql = neon(process.env.PROD_DATABASE_URL!);

export const db = isProd() ? drizzleNeon(sql) : drizzlePostgres(queryClient);
Has anyone tried something like this?
5 replies