From the course: Ruby on Rails 6 Essential Training
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Run migrations to change the database schema - Ruby on Rails Tutorial
From the course: Ruby on Rails 6 Essential Training
Run migrations to change the database schema
- [Instructor] Now that we've created migrations, we're going to learn how to run them. The way that we run migrations is by going to the command line to the root of our Rails project and typing rails db:migrate. Rails will then run any migrations that have not been run before. In the last movie, we created two migrations, do_nothing_yet and create_users, but we haven't run those migrations, we have not put the database in this state. Right now this exists only as code, what we want to do is tell the migrations that they should run this code, thereby creating this users table on the database. So make sure that you've saved both of those files, let's go to the root of our Rails application, we'll type rails db:migrate. Go hit Return, it'll take a moment while it goes and grabs that code, it'll then execute it and update the database. You can see that it tells you what it did, it gives you the timestamp for each of the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.