aboutsummaryrefslogtreecommitdiffstats
path: root/config/initializers/postgresql_adapter_patch.rb
diff options
context:
space:
mode:
authorRobert2017-04-24 14:16:52 +0200
committerRobert2017-04-24 14:16:52 +0200
commit2d19e65fa8d8ac037c7f00a638111788b7ee002c (patch)
tree830fe41ac13743f75f2c16f41dfd1ff399b99a9b /config/initializers/postgresql_adapter_patch.rb
parent5003acfc533baa824fed11cf6f82f86393b3a0f6 (diff)
parent1cbed80c913420c76ac7d3716b9d8c4bf4e14278 (diff)
downloadchouette-core-2d19e65fa8d8ac037c7f00a638111788b7ee002c.tar.bz2
conflict resolution and asset recompilation
Diffstat (limited to 'config/initializers/postgresql_adapter_patch.rb')
-rw-r--r--config/initializers/postgresql_adapter_patch.rb54
1 files changed, 0 insertions, 54 deletions
diff --git a/config/initializers/postgresql_adapter_patch.rb b/config/initializers/postgresql_adapter_patch.rb
deleted file mode 100644
index 2e4d73f85..000000000
--- a/config/initializers/postgresql_adapter_patch.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-# module ::ArJdbc
-# module PostgreSQL
-# def quote_column_name(name)
-# if name.is_a?(Array)
-# name.collect { |n| %("#{n.to_s.gsub("\"", "\"\"")}") }.join(',')
-# else
-# %("#{name.to_s.gsub("\"", "\"\"")}")
-# end
-# end
-# end
-# end
-# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:primary_key] = "bigserial primary key"
-
-# Add missing double-quote to write array of daterange in SQL query
-# See #1782
-
-class ActiveRecord::ConnectionAdapters::PostgreSQLColumn
-
- def self.array_to_string(value, column, adapter)
- casted_values = value.map do |val|
- if String === val
- if val == "NULL"
- "\"#{val}\""
- else
- quote_and_escape(adapter.type_cast(val, column, true))
- end
- elsif Range === val
- casted_value = adapter.type_cast(val, column, true)
- "\"#{casted_value}\""
- else
- adapter.type_cast(val, column, true)
- end
- end
- "{#{casted_values.join(',')}}"
- end
-
-end
-
-module ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID
- class DateRange < Range
- # Unnormalize daterange
- # [2016-11-19,2016-12-26) -> 2016-11-19..2016-12-25
- def type_cast(value)
- result = super value
-
- if result.respond_to?(:exclude_end?) && result.exclude_end?
- ::Range.new(result.begin, result.end - 1, false)
- else
- result
- end
- end
- end
- register_type 'daterange', DateRange.new(:date)
-end