ActiveRecord Migrations

Flashcard 4 of 6

Given the following model and migration that creates it, what might we want to add?

# app/modes/user.rb
class User < ActiveRecord::Base
  validates :email, uniqueness: true
end

# db/20150527181920_create_users.rb
class CreateUsers < ActiveRecord::Migration
  create_table :users do |t|
    t.string :email

    t.timestamps null: false
  end
end

Answer:

Reveal Answer