Sha256: 094874ac44e4258dbb4a46a1f84a1151feb0c9eb030599d713eabf46520436b9

Contents?: true

Size: 490 Bytes

Versions: 3

Compression:

Stored size: 490 Bytes

Contents

class AddPrimaryColumnTo<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %>
  def change
    add_column :<%= table_name %>, :<%= flag_name %>, :boolean, default: false, null: false
    <%- if support_partial_index -%>
    # NOTE: Please uncomment following line if you want only one 'true' (constraint) in the table.
    # add_index :<%= table_name %>, <%= index_on %>, unique: true, where: "(<%= table_name %>.<%= flag_name %> IS TRUE)"
    <%- end -%>
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
set_as_primary-0.1.4 lib/generators/set_as_primary/templates/migration.rb
set_as_primary-0.1.3 lib/generators/set_as_primary/templates/migration.rb
set_as_primary-0.1.2 lib/generators/set_as_primary/templates/migration.rb