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.

Write migrations to define database changes

Write migrations to define database changes - Ruby on Rails Tutorial

From the course: Ruby on Rails 6 Essential Training

Start my 1-month free trial

Write migrations to define database changes

- [Instructor] We've created a database and configured our Rails project to connect to it. Now, we need to add tables to the database. There are a few ways that we can manage the database tables. You could be using legacy database tables. That is, you might already have an existing database with data in it, and you're just now trying to build a Rails front end that going to connect to those tables. That's certainly possible. Or you could manually manage those database tables. You could login to MySQL and issue MySQL commands to create tables, to add columns, to remove columns, and manage it manually from the command line. Or the third option is to use Ruby on Rails migrations. And that's what I want to show you how to do here. A migration is a set of database instructions. And those instructions are written in Ruby, and they migrate the database from one state to another. Essentially, they describe database changes. In…

Contents