Migrations make it easy to manage the database schema. However, problems can occur when we run into a bug in the migration code. It can leave your migrations in a broken state, where you can't migrate up or down. It is important to learn how to resolve these problems when they occur.
- [Narrator] Migrations make managing your…database schema easy,…however problems often occur when we're…running our migrations…and run into a bug in our migration code.…It can leave your migrations in a broken state…where you can't migrate up and you can't…migrate down.…It's important to learn how this happens and…how to resolve these problems when they occur.…To demonstrate I need to create a bug in…my migration code.…So let's start by migrating down.…I'm going to use rails db migrate version zero…and I'm going to basically take all of my…migrations away and then I'm going to introduce a bug…into one of the migrations so that we can…run into that problem.…
Let's go back over here and inside my alter…users migration,…that's what I'm going to change.…I'm going to go right here where I have the word…password and I'm instead going to change the…name of this column to be broken.…Now of course that's a column which doesn't exist…so it's going to give us an error when it tries…to do this migration,…when it tries to rename the column broken…
- Creating and configuring a new Ruby on Rails project
- Generating controllers and views
- Handling server requests
- Using different types of routes
- Rendering and viewing templates
- Generating migrations and models
- Creating, updating, and deleting records
- Finding records with queries
- Understanding relationship types
- Writing controllers for CRUD
- Working with layouts and helpers
- Managing application assets
- Building forms
- Validating data
- Authenticating users
Skill Level Beginner
1. What Is Ruby on Rails?
2. Get Started
3. Controllers, Views, and Dynamic Content
4. Databases and Migrations
5. Models and ActiveRecord
7. CRUD, REST, and Resourceful Routes
8. Controllers and CRUD
9. Layouts, Partials, and View Helpers
12. Data Validation
13. Controller Features
14. User Authentication
15. Improve the Simple CMS
Next steps1m 44s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.