module Weighable::ActiveRecord::MigrationExtensions::SchemaStatements

Public Instance Methods

add_weighable(table_name, column) click to toggle source
# File lib/weighable/active_record/migration_extensions/schema_statements.rb, line 5
def add_weighable(table_name, column)
  add_column table_name, "#{column}_value", :decimal, precision: 30, scale: 15
  add_column table_name, "#{column}_unit", :integer, limit: 1
  add_column table_name, "#{column}_display_unit", :integer, limit: 1
end
remove_weighable(table_name, column) click to toggle source
# File lib/weighable/active_record/migration_extensions/schema_statements.rb, line 11
def remove_weighable(table_name, column)
  remove_column table_name, "#{column}_value"
  remove_column table_name, "#{column}_unit"
  remove_column table_name, "#{column}_display_unit"
end