How do migrations work in SQL databases?
Each migration has up (apply) and down (revert) scripts, run in order. Tools like Knex.js and Sequelize migrations handle this for Node.js. The tool tracks which migrations have been applied so each environment is in sync.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Database Migrations and Versioning in Node.js Apps
Scripts that modify the database schema (add tables, columns, indexes) in a controlled, reversible way. They let you evolve the schema without manual database changes, and are version-controlled alongside code.
NoSQL is more flexible, but data transformations need migrations. Use tools like migrate-mongo or write custom scripts that transform existing documents when the schema changes, ensuring existing data works with new code.
Migrations that do not cause production downtime. Add columns first (nullable), deploy code that uses them, populate, then enforce. This backward-compatible approach avoids breaking the running app during migration.
Still have questions?
Browse all our FAQs or reach out to our support team
