Virdrox
Virdrox
DTDrizzle Team
Created by Virdrox on 10/17/2024 in #help
“If does not exist” for migration schemes and add a column to an existing table
Hello, I'm new to Drizzle, and for a project with postgres and NextJS, I'd like, during a migration, to specify that schemas must not be recreated. db/schemas.ts:
import { pgSchema } from "drizzle-orm/pg-core";

export const myschema = pgSchema("schema_name");
import { pgSchema } from "drizzle-orm/pg-core";

export const myschema = pgSchema("schema_name");
db/myschema_schema/users.ts:
import { myschema } from "@/db/schemas/schemas";

export const users = myschema.table("users", {
import { myschema } from "@/db/schemas/schemas";

export const users = myschema.table("users", {
I'd also like to know how to update an existing table (just to add columns, just in case). Thanks in advance for your answers!
4 replies