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

[BUG]: drizzle-kit push unexpected behaviour #2322

Open
jsbrain opened this issue May 15, 2024 · 1 comment
Open

[BUG]: drizzle-kit push unexpected behaviour #2322

jsbrain opened this issue May 15, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jsbrain
Copy link

jsbrain commented May 15, 2024

What version of drizzle-orm are you using?

0.30.10

What version of drizzle-kit are you using?

0.21.2

Describe the Bug

I introspected a schema that has some features that are currently not supported by drizzle, e.g. sequences, extensions.

Drizzle does introspect the schema to the most extend and generates a uncomplete 0000-xxxx.sql file.

To mitigate the issue I replace the contents of the initial file with the data from the .sql schema file generated via pg_dump --schema-only.

This now successfully initializes the db with the proper schema and all required features so I can use drizzle migrations for our project with the drizzle-kit migrate command.

The drizzle-kit push command on the other hand virtually recreates the initially incomplete .sql file generated by the introspection command and executes this, completely ignoring the .sql file I manually edited.

Is this expected behaviour?

I also noticed that in some cases, it seems as if drizzle-kit push even tries to execute old migration data, I ran into this after I made changes on the db and introspected again (bascially completely deleted the drizzle directory and started over) and it would still give me the sql commands generated for the previous introspected schema.

Expected behavior

drizzle-kit push forcefully executes all migrations in sequence, ignoring the drizzle migrations history, respecting the .sql migration files and executing the commands of said files

Environment & setup

No response

@jsbrain jsbrain added the bug Something isn't working label May 15, 2024
@jsbrain
Copy link
Author

jsbrain commented May 15, 2024

I might be wrong in my assumptions about how this command works but it seems very odd that it tries to regenerate the commands or tries to execute stale data...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant