Running and Rolling Back Migrations in Rails
📖 Scenario: You are building a simple Rails app to manage a list of books. You need to create a database table for books and then learn how to run and rollback migrations to manage your database schema.
🎯 Goal: Create a migration to add a books table with title and author columns, run the migration to update the database, then rollback the migration to undo the changes.
📋 What You'll Learn
Create a migration file named
create_books with title and author columns as stringsRun the migration using the correct Rails command
Rollback the last migration using the correct Rails command
💡 Why This Matters
🌍 Real World
Managing database schema changes safely is essential in real-world Rails applications to keep data consistent and allow easy updates.
💼 Career
Rails developers frequently create, run, and rollback migrations to evolve the database schema during development and deployment.
Progress0 / 4 steps