Drizzle Kit squash migrations #3492
AlexBlokh
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
the problem:
tail
(old) migrations into one, that leads to a simpler migrations folder and less disk space usagehead
. They do generate migrations while developing locally and then wanna squash them before releasefor the second one it does seem
drizzle-kit push
should be preferred solution, yet we could still exploretail
squash:drizzle-kit squash --tail
will let you squash old migrations, you should be able to select range.There are multiple ways we can do it and it does seem there's no silver bullet here
first approach would be to combine all sql files into one, while preserving metadata:
this way we will eliminate the problem of partially applied squashed migrations in the database(different stages), yet we will have to have complete SQL history, which will make this file bloated
We can provide a flag for developer to squash migrations into compact SQL file, in the example above we can eliminate index creation at all, which will result in a
init
sql migration file:and the last DX piece would be to let developer provide us database connection and let drizzle kit decide which migrations to squash in a compact way based on the list of applied database migrations automatically
Beta Was this translation helpful? Give feedback.
All reactions