Search⌘ K
AI Features

Advanced Migrations

Learn advanced Rails database migration techniques by integrating native SQL commands, managing custom data types like enumerated types in Postgres, and using methods such as say_with_time to benchmark migrations. This lesson helps you maintain and optimize complex database schemas in Rails applications.

Most Rails developers use the basic facilities of migrations to create and maintain their database schemas. However, every now and then it’s useful to push migrations just a bit further.

Using native SQL

Migrations give us a database-independent way of maintaining your application’s schema. However, if migrations don’t contain the methods we need, we’ll need to drop down to database-specific code. ...