drizzle-team / drizzle-team/drizzle-orm

Config out / schemas / migrations are confusing. Also, no way to prevent migrations being generating

Open
#3,978 4 comments 13 reactions 0 assignees View on GitHub
drizzle/kit enhancement
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Feature hasn't been suggested before.

- [x] I have verified this feature I'm about to request hasn't been suggested before.

### Describe the enhancement you want to request

When I run

```
pnpm exec drizzle-kit pull
```

wtih

```
export default defineConfig({
dialect: "postgresql",
out: "./src/db/a_db/",
schema: "schema.ts"
});
```

The output is

```
...
[โœ“] Your SQL migration file โžœ src/db/a_db/0000_shiny_argent.sql ๐Ÿš€
[โœ“] Your schema file is ready โžœ src/db/a_db/schema.ts ๐Ÿš€
[โœ“] Your relations file is ready โžœ src/db/a_db/relations.ts ๐Ÿš€
...
```

But I don't want migration, all I need is the schemas. How can I tell drizzle to stop generating migrations?

And with

```
export default defineConfig({
dialect: "postgresql",
schema: "./src/db/a_db/schema.ts"
});
```
I get

```
[โœ“] Your SQL migration file โžœ drizzle/0000_large_freak.sql ๐Ÿš€
[โœ“] Your schema file is ready โžœ drizzle/schema.ts ๐Ÿš€
[โœ“] Your relations file is ready โžœ drizzle/relations.ts ๐Ÿš€
```
So it completely ignores the path I give to schema if there is no out. And still, it generates migrations I don't need (I am _pulling_ from the db).

```
export default defineConfig({
dialect: "postgresql",
schema: "./src/db/a_db/schema.ts"
migration: "/tmp/go_away"
});
```
I get

```
[โœ“] Your SQL migration file โžœ drizzle/0000_striped_mongu.sql ๐Ÿš€
[โœ“] Your schema file is ready โžœ drizzle/schema.ts ๐Ÿš€
[โœ“] Your relations file is ready โžœ drizzle/relations.ts ๐Ÿš€
```

So it's clear that

1. `out` is actually a dir (would be clear if named `outDir`)
2. `out` is required, otherwise files will be created into ./drizzle/, regardless of what you put in schema / migration
3. `schema` and `migration` cannot go in different folders
4. you cannot prevent migrations even if you don't need them

I guess if drizzle could honour the paths and schema and migration then we could sent migrations to /tmp/something and forget about it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.