class RailsPropertiesMigration

Public Class Methods

down() click to toggle source
# File lib/generators/rails_properties/migration/templates/migration.rb, line 18
def self.down
  drop_table :properties
end
up() click to toggle source
# File lib/generators/rails_properties/migration/templates/migration.rb, line 8
def self.up
  create_table :properties do |t|
    t.string     :var,    :null => false
    t.text       :value
    t.references :target, :null => false, :polymorphic => true
    t.timestamps :null => true
  end
  add_index :properties, [ :target_type, :target_id, :var ], :unique => true
end