Sha256: e8e2e0d34d00981dcc93548c773d2fab0fd7a608abf9e2d1d050600b94284f24

Contents?: true

Size: 686 Bytes

Versions: 13

Compression:

Stored size: 686 Bytes

Contents

class CustomAttributesMigration < ActiveRecord::Migration
  def self.up
    create_table :custom_attributes do |t|
			# label
      t.string :field_name
      t.string :field_label

      # value type
      t.string :value_type
			
			# fields for value storage
      t.string :text_value
      t.datetime :date_time_value
      t.integer :number_value
      t.float :float_value

			# sorting
      t.integer :position
			# link to object
      t.references :item, :polymorphic => true

      t.timestamps
    end

    add_index :custom_attributes, :value_type
    add_index :custom_attributes, [:item_id, :item_type]
  end

  def self.down
    drop_table :custom_attributes
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
custom-attributes-0.2.27 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.26 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.25 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.24 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.23 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.22 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.18 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.17 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.16 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.15 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.12 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.5 lib/generators/custom_attributes/migration/templates/active_record/migration.rb
custom-attributes-0.2.4 lib/generators/acts_as_taggable_on/migration/templates/active_record/migration.rb