Active Record Schema Management Refresher
Active Record is used by Rails developers to evolve their database schema design. Each change is represented as a migration. The schema design is dumped (or serialized) into a file that’s committed to version control. The schema file can use a Ruby format or a SQL format. Rideshare uses the SQL format, which means the file is db/structure.sql.
If you’ve used schema management tools like Flyway[30] or Liquibase,[31] you’ll find similarities to Active Record migrations.
Let’s look at migration files. Migrations are versioned Ruby files in the db/migrate directory. They contain Active Record code that generates SQL Data Definition Language (DDL) statements like CREATE TABLE or CREATE INDEX. Migrations ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access