Sha256: fa2363548e5cb1d8b54710946153159f05512bbeeab76f67ab3c301c0d0d77ae

Contents?: true

Size: 375 Bytes

Versions: 3

Compression:

Stored size: 375 Bytes

Contents

class Create<%= goal.cp %> < ActiveRecord::Migration
  def self.up
    create_table :<%= goal.p %> do |t|
<% goal.fields.map do |k, v| %>
  <%= "      t." + v.to_s + " :" + k.to_s  %>
<% end %>
<% goal.foreign_keys.map do |k, v| %>
  <%= "      t.references :" + k[0..-4] %>
<% end %>
      t.timestamps
    end
  end

  def self.down
    drop_table :<%= goal.p %>
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mattknox-goaloc-0.4.0 lib/goaloc/generators/rails/migration.rb.erb
mattknox-goaloc-0.4.1 lib/goaloc/generators/rails/migration.rb.erb
mattknox-goaloc-0.4.2 lib/goaloc/generators/rails/migration.rb.erb