Sha256: 7904ac35111dcc2720202d97faf6185252574ee36c90825526268c9ed48ed578

Contents?: true

Size: 851 Bytes

Versions: 6

Compression:

Stored size: 851 Bytes

Contents

module Torque
  module PostgreSQL
    module Adapter
      module ColumnMethods

        def interval(*args, **options)
          args.each { |name| column(name, :interval, options) }
        end

        def enum(*args, **options)
          args.each do |name|
            type = options.fetch(:subtype, name)
            column(name, type, options)
          end
        end

      end

      ActiveRecord::ConnectionAdapters::PostgreSQL::Table.include ColumnMethods
      ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition.include ColumnMethods

      if ActiveRecord::ConnectionAdapters::PostgreSQL.const_defined?('ColumnDefinition')
        module ColumnDefinition
          attr_accessor :subtype
        end

        ActiveRecord::ConnectionAdapters::PostgreSQL::ColumnDefinition.include ColumnDefinition
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
torque-postgresql-0.1.7 lib/torque/postgresql/adapter/schema_definitions.rb
torque-postgresql-0.1.6 lib/torque/postgresql/adapter/schema_definitions.rb
torque-postgresql-0.1.5 lib/torque/postgresql/adapter/schema_definitions.rb
torque-postgresql-0.1.4 lib/torque/postgresql/adapter/schema_definitions.rb
torque-postgresql-0.1.3 lib/torque/postgresql/adapter/schema_definitions.rb
torque-postgresql-0.1.2 lib/torque/postgresql/adapter/schema_definitions.rb