From the course: Ruby on Rails 6 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Migrations for the CMS

Solution: Migrations for the CMS - Ruby on Rails Tutorial

From the course: Ruby on Rails 6 Essential Training

Start my 1-month free trial

Solution: Migrations for the CMS

(upbeat music) - [Instructor] In this movie, I'll show you the solution that I came up with to the Migration challenge. The first thing I did was I came to the command line, and I made sure I was inside the root of my rails project. Then I ran rails generate, and I had to choose, do I want to generate a migration or a model. Since I'm creating a new model, a brand new table with a model attached to it, I wanted to choose model, and that model's going to be the subject model, and I went ahead and provided the names of the columns and the types of columns here as a list. Again, this is an optional step. You don't have to do it, but it's a nice shorthand. So I'm going to create a name column, position, and visible. If we jump over to the code, you can see that it created that file, create subjects, and it has create table, subjects, lower case and plural, and you can see that it has name, position and visible as a string…

Contents