Sha256: 1a458705620ab5284182115b07a96d4fd81de5bbb289400c8362b3585113aef3

Contents?: true

Size: 899 Bytes

Versions: 3

Compression:

Stored size: 899 Bytes

Contents

class AddAuthenticationTo<%= model_name.pluralize.camelize %> < ActiveRecord::Migration
  def self.up
    add_column :<%= model_name.tableize %>, :username,         :string  # for user identification
    add_column :<%= model_name.tableize %>, :password_digest,  :string

    add_column :<%= model_name.tableize %>, :email,            :string  # for forgotten-credentials
    add_column :<%= model_name.tableize %>, :token,            :string  # for forgotten-credentials
    add_column :<%= model_name.tableize %>, :token_created_at, :string  # for forgotten-credentials
  end

  def self.down
    remove_column :<%= model_name.tableize %>, :username
    remove_column :<%= model_name.tableize %>, :password_digest
    remove_column :<%= model_name.tableize %>, :email
    remove_column :<%= model_name.tableize %>, :token
    remove_column :<%= model_name.tableize %>, :token_created_at
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
quo_vadis-1.1.2 lib/generators/quo_vadis/templates/migration.rb.erb
quo_vadis-1.1.1 lib/generators/quo_vadis/templates/migration.rb.erb
quo_vadis-1.1.0 lib/generators/quo_vadis/templates/migration.rb.erb