Class: Upgrade035HasDynamicColumns

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/has_dynamic_columns/templates/migration_0.3.5.rb

Class Method Summary collapse

Class Method Details

.downObject



13
14
# File 'lib/generators/has_dynamic_columns/templates/migration_0.3.5.rb', line 13

def self.down
end

.upObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/generators/has_dynamic_columns/templates/migration_0.3.5.rb', line 2

def self.up
	create_table :dynamic_column_model_data do |t|
		t.integer :value_id
		t.string :value_type
		t.timestamps null: false
	end
	add_index(:dynamic_column_model_data, [:value_id,:value_type], name: "index_by_value")
	add_column :dynamic_columns, :class_name, :string
	add_column :dynamic_columns, :column_name, :string
end