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
Kuba
Kuba3mo ago
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:
ALTER TABLE distributors RENAME TO suppliers;
ALTER TABLE distributors RENAME TO suppliers;
Also, see how it behaves if you change just one table name, and how it behaves when changing multiple table names.
Want results from more Discord servers?
Add your server