Sha256: 3fb203909e7dc2175bac570bac1218a483d1c92807bb1b0f951d6d55d220dde2

Contents?: true

Size: 621 Bytes

Versions: 21

Compression:

Stored size: 621 Bytes

Contents

class <%= migration_class_name %> < ActiveRecord::Migration
  def change
<% CMS::Configuration.scoped_types(options).each do |type| -%>
    create_table :<%= type.model_name.collection %> do |t|
<% type.attributes.each do |attribute| -%>
      t.<%= attribute.migration_type %> :<%= attribute.name %><%= attribute.inject_options %>
<% end -%>
<% if type.options[:timestamps] -%>
      t.timestamps
<% end -%>
    end

<% type.attributes_with_index.each do |attribute| -%>
    add_index :<%= type.model_name.collection %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
<% end -%>
<% end -%>

  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
honey-cms-0.3.13 lib/generators/cms/templates/migration.rb
honey-cms-0.3.12 lib/generators/cms/templates/migration.rb
honey-cms-0.3.11 lib/generators/cms/templates/migration.rb
honey-cms-0.3.10 lib/generators/cms/templates/migration.rb
honey-cms-0.3.9 lib/generators/cms/templates/migration.rb
honey-cms-0.3.8 lib/generators/cms/templates/migration.rb
honey-cms-0.3.7 lib/generators/cms/templates/migration.rb
honey-cms-0.3.5 lib/generators/cms/templates/migration.rb
honey-cms-0.3.4 lib/generators/cms/templates/migration.rb
honey-cms-0.3.3 lib/generators/cms/templates/migration.rb
honey-cms-0.3.2 lib/generators/cms/templates/migration.rb
honey-cms-0.3.1 lib/generators/cms/templates/migration.rb
honey-cms-0.3.0 lib/generators/cms/templates/migration.rb
honey-cms-0.2.4 lib/generators/cms/templates/migration.rb
honey-cms-0.2.3 lib/generators/cms/templates/migration.rb
honey-cms-0.2.2 lib/generators/cms/templates/migration.rb
honey-cms-0.2.1 lib/generators/cms/templates/migration.rb
honey-cms-0.2.0 lib/generators/cms/templates/migration.rb
honey-cms-0.1.2 lib/generators/cms/templates/migration.rb
honey-cms-0.1.1 lib/generators/cms/templates/migration.rb