Challenges with Drizzle Kit Workflow Using a Single Database for Development and Production
I'm currently employing a single database for both development and production environments, as my project hasn't gone live yet. My workflow is as follows:
1. Develop locally, modifying the schema and executing
drizzle-kit push
to apply changes directly.
2. Once satisfied with the database structure, run drizzle-kit generate
to create migration files.
3. On the remote environment, execute drizzle-kit migrate
to apply pending migrations.
However, during the drizzle-kit migrate
step, I encounter the following error:
This error arises because the user_role
type was previously created when I executed drizzle-kit push
locally.
I'm seeking advice on how to refine my workflow to prevent such conflicts and ensure a smooth migration process across environments. Any suggestions or best practices would be greatly appreciated.1 Reply
You shouldn't be using the same database for both prod and dev, it's generally bad practice, hence why Drizzle doesn't handle said conflict