Posts

Showing posts with the label Active Record

Active Record Migrations

Active Record Migrations Migrations can manage the evolution of a schema used by several physical databases. It’s a solution to the common problem of adding a field to make a new feature work in your local database, but being unsure of how to push that change to other developers and to the production server. With migrations, you can describe the transformations in self-contained classes that can be checked into version control systems and executed against another database that might be one, two, or five versions behind. Example of a simple migration: class AddSsl < ActiveRecord::Migration def up add_column : accounts , : ssl_enabled , : boolean , : default => 1 end def down remove_column : accounts , : ssl_enabled end end This migration will add a boolean flag to the accounts table and remove it ...