-
I'm using Drizzle and from reading your docs I was assuming a workflow like this to do schema migrations:
My problem is that for step 2, doing a push requires an empty DB (elsewhere it will fail because my tables already exist), so I've been dropping my tables or doing manual alter statements before creating my Deploy Requests. Is there anyway to create a blank branch? or I'm I looking at this the wrong way? When automating this I was thinking on using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hello @pablasso, For the Step 2 issue you mentioned, that seems a bit odd based on what I'm reading about the Based on this section:
To me, the above makes it sound like Drizzle would be capable of comparing the initial state of your development branch and then coming up with the needed queries to then get the branch's schema to match what you may have defined locally in your Drizzle code. Is there a specific error the push currently fails with when the database is not empty? Generally, there's no harm in clearing out the existing tables/schema within a development branch, but we do not provide a method for generating a blank branch currently, since the expectation is for the schema for development branches to match their parent branch initially, and then be modified afterward. Most ORMs seem to have a The |
Beta Was this translation helpful? Give feedback.
-
Yeah it complains that tables already exists, for example:
I was assuming the same, but maybe I'm just doing something wrong. I'll look up what am I doing wrong with Drizzle then.
This is great! if I cannot get it working I'll just script out cleaning up the branch with |
Beta Was this translation helpful? Give feedback.
Hello @pablasso,
For the Step 2 issue you mentioned, that seems a bit odd based on what I'm reading about the
push
command here in the Drizzle documentation:https://orm.drizzle.team/kit-docs/overview#prototyping-with-db-push
Based on this section: