Sha256: 7e96418e0cb16fce80dad7d46f594e8f8e8131c6df489edd8dc052d110252556

Contents?: true

Size: 687 Bytes

Versions: 21

Compression:

Stored size: 687 Bytes

Contents

class ActsAsTaggableOnMigration < 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

21 entries across 21 versions & 1 rubygems

Version Path
custom-attributes-0.0.1 generators/has_custom_attributes_migration/templates/migration.rb