Sha256: 3fa70f86e3db49c8461c7fd49660a6ea506243415d5699ebe51a5002da647bf7

Contents?: true

Size: 467 Bytes

Versions: 10

Compression:

Stored size: 467 Bytes

Contents

class AddClearanceToUsers < ActiveRecord::Migration
  def self.up
    change_table :users  do |t|
<% config[:new_columns].values.each do |column| -%>
      <%= column %>
<% end -%>
    end

<% config[:new_indexes].values.each do |index| -%>
    <%= index %>
<% end -%>
  end

  def self.down
    change_table :users do |t|
<% if config[:new_columns].any? -%>
      t.remove <%= new_columns.keys.map { |column| ":#{column}" }.join(',') %>
<% end -%>
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
clearance-1.2.1 lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
clearance-1.2.0 lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
clearance-1.1.0 lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
clearance-1.0.1 lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
clearance-1.0.0 lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
clearance-1.0.0.rc8 lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
clearance-1.0.0.rc7 lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
clearance-1.0.0.rc6 lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
clearance-1.0.0.rc4 lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
clearance-1.0.0.rc3 lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb