activerecord-oracle_enhanced-adapter 1.7.2 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73094ef54aa9a2de8339c36bcc8ac13f4c57eb65
4
- data.tar.gz: b7b35ded1d9bbfe4381828c13fdcf3c64403f894
3
+ metadata.gz: 8d1b4bd554898d5bc0e1eb9d5d5ee7d234132c11
4
+ data.tar.gz: 96f3480896225af451693db4d8eb4554e3ad2ab9
5
5
  SHA512:
6
- metadata.gz: 662edf53de71588e9bbd306de4d9a8e9ee69cecf6cee88db77d138213fc5e359198bb2828b9e383041e1b394c6d94cb678e95779c8b90701bad179ced9e65259
7
- data.tar.gz: ed56d147a8dc254a47be094c803748673e249e4f187b9b01a37ab8ded2171366cb20ea3dae6018083a6a4e33766f7d41d4eca5432a2eb2270b1b4bde8143126d
6
+ metadata.gz: ee52bda6c519c796a33671a46e0f15ed64e138c20212977e22cae620e1ac98d825d9091de20314fc58db1beca058671cc5eb6aa6c62e2d8f3fba47575b3c073d
7
+ data.tar.gz: a8851fbdf4b8fdac1faf736f7e4be8a086ec7ad84ad94764c7c635b9a0b8bab0bbcd2f1dc1a00a937e6673ec1dca5143efc617c8daddc038526ed680ff29f572
data/History.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.7.3 / 2016-10-03
2
+
3
+ * Changes and bug fixes
4
+ * Respect `ActiveRecord::Base.default_timezone = :utc` rather than connection `time_zone` value [#755, #998]
5
+
6
+ * Known issues
7
+ * No changes since 1.7.0.rc1
8
+
1
9
  ## 1.7.2 / 2016-09-19
2
10
 
3
11
  * Changes and bug fixes
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.2
1
+ 1.7.3
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{activerecord-oracle_enhanced-adapter}
3
- s.version = "1.7.2"
3
+ s.version = "1.7.3"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.required_ruby_version = '>= 2.2.2'
7
7
  s.license = 'MIT'
8
8
  s.authors = [%q{Raimonds Simanovskis}]
9
- s.date = %q{2016-09-19}
9
+ s.date = %q{2016-10-03}
10
10
  s.description = %q{Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.
11
11
  This adapter is superset of original ActiveRecord Oracle adapter.
12
12
  }
@@ -350,7 +350,11 @@ module ActiveRecord
350
350
  conn.non_blocking = true if async
351
351
  conn.prefetch_rows = prefetch_rows
352
352
  conn.exec "alter session set cursor_sharing = #{cursor_sharing}" rescue nil
353
- conn.exec "alter session set time_zone = '#{time_zone}'" unless time_zone.blank?
353
+ if ActiveRecord::Base.default_timezone == :local
354
+ conn.exec "alter session set time_zone = '#{time_zone}'" unless time_zone.blank?
355
+ elsif ActiveRecord::Base.default_timezone == :utc
356
+ conn.exec "alter session set time_zone = '+00:00'"
357
+ end
354
358
  conn.exec "alter session set current_schema = #{schema}" unless schema.blank?
355
359
 
356
360
  # Initialize NLS parameters
@@ -110,6 +110,33 @@ describe "OracleEnhancedConnection" do
110
110
  end
111
111
  end
112
112
 
113
+ describe "default_timezone" do
114
+ before(:all) do
115
+ ActiveRecord::Base.establish_connection(CONNECTION_WITH_TIMEZONE_PARAMS)
116
+ ActiveRecord::Schema.define do
117
+ create_table :posts, :force => true do |t|
118
+ t.timestamps null: false
119
+ end
120
+ end
121
+ class ::Post < ActiveRecord::Base
122
+ end
123
+ end
124
+
125
+ after(:all) do
126
+ Object.send(:remove_const, "Post")
127
+ ActiveRecord::Base.clear_cache!
128
+ end
129
+
130
+ it "should respect default_timezone = :utc than time_zone setting" do
131
+ # it expects that ActiveRecord::Base.default_timezone = :utc
132
+ ActiveRecord::ConnectionAdapters::OracleEnhancedConnection.create(CONNECTION_WITH_TIMEZONE_PARAMS)
133
+ post = Post.create!
134
+ created_at = post.created_at
135
+ expect(post).to eq(Post.find_by!(created_at: created_at))
136
+ end
137
+
138
+ end
139
+
113
140
  if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
114
141
 
115
142
  describe "create JDBC connection" do
data/spec/spec_helper.rb CHANGED
@@ -143,6 +143,16 @@ CONNECTION_WITH_SCHEMA_PARAMS = {
143
143
  :schema => DATABASE_SCHEMA
144
144
  }
145
145
 
146
+ CONNECTION_WITH_TIMEZONE_PARAMS = {
147
+ :adapter => "oracle_enhanced",
148
+ :database => DATABASE_NAME,
149
+ :host => DATABASE_HOST,
150
+ :port => DATABASE_PORT,
151
+ :username => DATABASE_USER,
152
+ :password => DATABASE_PASSWORD,
153
+ :time_zone => "Europe/Riga"
154
+ }
155
+
146
156
  SYS_CONNECTION_PARAMS = {
147
157
  :adapter => "oracle_enhanced",
148
158
  :database => DATABASE_NAME,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-oracle_enhanced-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raimonds Simanovskis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-19 00:00:00.000000000 Z
11
+ date: 2016-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord