Sha256: 7f55757f4246ac05923133023a50e70e31c50d9349ddf02be4ac826eafca7aee
Contents?: true
Size: 889 Bytes
Versions: 15
Compression:
Stored size: 889 Bytes
Contents
require 'jdbc_adapter/tsql_helper' module ::JdbcSpec module ActiveRecordExtensions def cachedb_connection( config ) config[:port] ||= 1972 config[:url] ||= "jdbc:Cache://#{config[:host]}:#{config[:port]}/#{ config[:database]}" config[:driver] ||= "com.intersys.jdbc.CacheDriver" jdbc_connection( config ) end end module CacheDB include TSqlMethods def self.adapter_matcher(name, *) name =~ /cache/i ? self : false end def self.column_selector [ /cache/i, lambda { | cfg, col | col.extend( ::JdbcSpec::CacheDB::Column ) } ] end module Column end def create_table(name, options = { }) super(name, options) primary_key = options[:primary_key] || "id" execute "ALTER TABLE #{name} ADD CONSTRAINT #{name}_PK PRIMARY KEY(#{primary_key})" unless options[:id] == false end end end
Version data entries
15 entries across 15 versions & 4 rubygems