Sha256: e0e1e095f03defce06b8c6a23108c431d17620450e375cd8a7f9de1477e5afc4

Contents?: true

Size: 651 Bytes

Versions: 25

Compression:

Stored size: 651 Bytes

Contents

module Weighable
  module ActiveRecord
    module MigrationExtensions
      module SchemaStatements
        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

        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
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
weighable-1.5.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-1.4.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-1.3.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-1.2.1 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-1.2.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-1.1.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-1.0.1 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-1.0.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.10.1 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.10.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.9.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.8.1 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.8.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.7.1 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.7.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.6.1 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.6.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.5.1 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.5.0 lib/weighable/active_record/migration_extensions/schema_statements.rb
weighable-0.4.0 lib/weighable/active_record/migration_extensions/schema_statements.rb