lib/swift/db.rb in swift-0.4.3 vs lib/swift/db.rb in swift-0.5.0

- old
+ new

@@ -1,39 +1,30 @@ module Swift module DB class Mysql < Adapter def initialize options = {} super options.update(driver: 'mysql') - execute('select unix_timestamp() - unix_timestamp(utc_timestamp()) as offset') {|r| @tzoffset = r[:offset] } end - def timezone *args - super(*args) - execute('select unix_timestamp() - unix_timestamp(utc_timestamp()) as offset') {|r| @tzoffset = r[:offset] } - @tzoffset - end - def returning? false end end # Mysql class Postgres < Adapter def initialize options = {} super options.update(driver: 'postgresql') - sql = "select extract(epoch from now())::bigint - extract(epoch from now() at time zone 'UTC')::bigint" - execute('%s as offset' % sql) {|r| @tzoffset = r[:offset] } end - def timezone *args - super(*args) - sql = "select extract(epoch from now())::bigint - extract(epoch from now() at time zone 'UTC')::bigint" - execute('%s as offset' % sql) {|r| @tzoffset = r[:offset] } - @tzoffset - end - def returning? true + end + + def field_definition attribute + case attribute + when Type::IO then '%s bytea' % attribute.field + else super + end end end # Postgres end # DB end # Swift