Drizzle ORM migrations on rename fields?
Hi, guys, in my company we want to use Drizzle ORM with Payload CMS, but we're searching for how Drizzle handle migrations.
I know that Drizzle will generate automatic migrations using
pnpm drizzle-kit generate
, but i've never tested with rename fields? How Drizzle will behave on those situations?
We're looking for automatic detecting of rename fields, similar how Django does. Will Drizzle be capable to detect rename fields?
Currently we're using MongoDB and any dev could rename fields and break the UI (not the DB), we're searching for a way to avoid that by using SQL or any alternative.
Any recomendations on the subject?1 Reply
I know this answer might not be satisfying, but just go ahead an try it yourself. If I were you, I would just create a basic schema, generate initial migration, change table name(s) and see if next generated migration uses
ALTER TABLE
queries.
How the query will look like might differ between the database you use. Example for postgresql from the docs:
Also, see how it behaves if you change just one table name, and how it behaves when changing multiple table names.