0
0
Expressframework~5 mins

Migrations for schema changes in Express - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a migration in the context of database schema changes?
A migration is a set of instructions that change the database structure, like adding or removing tables or columns, to keep the database in sync with the application code.
Click to reveal answer
beginner
Why are migrations important in Express applications?
Migrations help manage database changes safely and consistently, allowing developers to update the schema without losing data or causing errors.
Click to reveal answer
intermediate
Name a popular tool used with Express for managing migrations.
Sequelize CLI is a popular tool that helps create, run, and undo migrations in Express apps using Sequelize ORM.
Click to reveal answer
intermediate
What does the 'up' function do in a migration file?
The 'up' function defines the changes to apply to the database schema, like creating tables or adding columns.
Click to reveal answer
intermediate
How does the 'down' function in a migration file help during development?
The 'down' function reverses the changes made by the 'up' function, allowing you to undo migrations if needed.
Click to reveal answer
What is the main purpose of a migration in Express apps?
ATo style the application
BTo write frontend code
CTo update the database schema safely
DTo handle user authentication
Which tool is commonly used with Express for migrations?
ASequelize CLI
BReact Router
CWebpack
DExpress Generator
What does the 'up' function in a migration file do?
AHandles user input
BReverts schema changes
CRuns server code
DApplies schema changes
What is the role of the 'down' function in migrations?
ATo apply new schema changes
BTo undo schema changes
CTo start the Express server
DTo connect to the database
Why should migrations be used instead of manual database changes?
AThey keep schema changes consistent and reversible
BThey are faster to write
CThey improve frontend performance
DThey replace the need for a database
Explain what a migration is and why it is useful in Express applications.
Think about how you change your database structure without breaking your app.
You got /4 concepts.
    Describe the roles of the 'up' and 'down' functions in a migration file.
    One function moves forward, the other moves backward.
    You got /3 concepts.