valou1525
Explore posts from serversDTDrizzle Team
•Created by valou1525 on 7/26/2024 in #help
drizzle-kit generate with dynamic Schema
Hello,
I work in a context where each dev has its own schema in the DB. When generating migrations with drizzle-kit generate, the migration files contain the hardcoded schema value
ex: CREATE TABLE "mySchema1"."myTable"
It makes it impossible to have a single set of migration files, independant of schemas, that all developers can run.
Do you see a way I could make this work ? Ideally, migration files could be generated with a placeholder schema that would be dynamically set when calling migrate().
Thanks 🙏
1 replies
DTDrizzle Team
•Created by valou1525 on 7/24/2024 in #help
Using drizzle-kit:generate with path aliases
Hey guys 👋
I'm currently trying to migrate my codebase to use drizzle, however I'm facing an issue related to how drizzle-kit handles TS paths.
I am using a NX monorepo, with path aliases.
I have domain libs, let's say @project/domain1 and @project/domain2, exporting enums I would like to use in my drizzle schema.
I have created a new lib that will host the schema, @project/drizzle-schema.
In @project/drizzle-schema, when defining the schema I use :
import { myEnum } from @project/domain1
However, when running drizzle-kit generate, module @project/domain1 cannot be found.
Is there a way to pass a tsconfig to drizzle.config.ts ? Or another way to fix my problem?
I came accross this issue which seems similar https://github.com/drizzle-team/drizzle-orm/issues/1228
Thanks 🙏1 replies