Sha256: ac5e1ba25a8335ff8e73bc6aa8010844b73554106467768b3923a370d0c6526c

Contents?: true

Size: 544 Bytes

Versions: 2

Compression:

Stored size: 544 Bytes

Contents

class <%= @migration_class_name %> < ActiveRecord::Migration<%= ActiveRecord::VERSION::MAJOR < 5 ? '' : '[5.0]' %>
  def up
    <% if nullable? %>
    add_column :<%= plural_table_name %>, :logux_fields_updated_at, :jsonb, null: false, default: {}
    <% else %>
    add_column :<%= plural_table_name %>, :logux_fields_updated_at, :jsonb, null: true
    change_column_default :<%= plural_table_name %>, :logux_fields_updated_at, {}
    <% end %>
  end

  def down
    remove_column :<%= plural_table_name %>, :logux_fields_updated_at
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logux_rails-0.2.0 lib/generators/logux/model/templates/migration.rb.erb
logux_rails-0.1.0 lib/generators/logux/model/templates/migration.rb.erb