Sha256: cf3b55cd51aa83194b2555344fbb67903c37f4a990c1b0bde7e4185657fb1902

Contents?: true

Size: 698 Bytes

Versions: 3

Compression:

Stored size: 698 Bytes

Contents

migration <%= Time.now.utc.strftime("%Y%m%d%H%M%S") %>, :<%= migration_name.underscore %> do
  up do
    create_table :<%= table_name %> do
      column :id, Integer, :serial => true
<% Array(attributes).each do |attribute| -%>
      column :<%= attribute.name if attribute %>, <%= attribute.type == :boolean ? "::DataMapper::Types::Boolean" : attribute.type.to_s.capitalize %>, :nullable => false<% if attribute.type == :string %>, :length => 255<% end %>
<% end -%>
<% unless options[:skip_timestamps] -%>
      column :created_at, DateTime, :nullable => false
      column :updated_at, DateTime, :nullable => false
<% end -%>
    end
  end

  down do
    drop_table :<%= table_name %>
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datamapper4rails-0.5.2 generators/datamapper_model/templates/migration.rb
datamapper4rails-0.5.1 generators/datamapper_model/templates/migration.rb
datamapper4rails-0.5.0 generators/datamapper_model/templates/migration.rb