Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
fritz-trawa opened this issue Jan 21, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@fritz-trawa
Copy link

Feature hasn't been suggested before.

  • 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.

@fritz-trawa fritz-trawa added the enhancement New feature or request label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant