activerecord-oracle_enhanced-adapter 1.7.8 → 1.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.md +12 -0
- data/VERSION +1 -1
- data/activerecord-oracle_enhanced-adapter.gemspec +2 -2
- data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +2 -2
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +16 -4
- data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +1 -1
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +40 -0
- data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +36 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c66ea5a29bbc96acd0537074b8acb1826adc37db
|
4
|
+
data.tar.gz: 82238858ccab6ab176f310583077aa375f710958
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a17e233a007cd95860964daccd49cd9d271650b853a6486256d83cdba8f12c3d92a8088d64ee9dd89fba415e9a587683453a8b1970652bb79dd5d51a87c3fc5
|
7
|
+
data.tar.gz: 4d13330c563debb87972c50be25d63e560c91edca0444ef4c2869b72d5de4ea9184e6a7f24b9f70f01f25b9fc7e65be445c6729fa60f5da9d836647f0786050c
|
data/History.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 1.7.9 / 2016-12-26
|
2
|
+
|
3
|
+
* Changes and bug fixes
|
4
|
+
|
5
|
+
* Fix ORA-00933 error when executing `rails db:schema:load` [#1084]
|
6
|
+
* Quoting booleans should return a frozen string [#1083]
|
7
|
+
* Quoting booleans should return a frozen string [#1083]
|
8
|
+
* CI against ruby 2.4.0 [#1096, #1086]
|
9
|
+
|
10
|
+
* Known issues
|
11
|
+
* No changes since 1.7.7
|
12
|
+
|
1
13
|
## 1.7.8 / 2016-12-06
|
2
14
|
|
3
15
|
* Changes and bug fixes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.9
|
@@ -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.
|
3
|
+
s.version = "1.7.9"
|
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-12-
|
9
|
+
s.date = %q{2016-12-26}
|
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
|
}
|
@@ -103,7 +103,7 @@ module ActiveRecord
|
|
103
103
|
|
104
104
|
def quoted_true #:nodoc:
|
105
105
|
return "'#{self.class.boolean_to_string(true)}'" if emulate_booleans_from_strings
|
106
|
-
"1"
|
106
|
+
"1".freeze
|
107
107
|
end
|
108
108
|
|
109
109
|
def unquoted_true #:nodoc:
|
@@ -113,7 +113,7 @@ module ActiveRecord
|
|
113
113
|
|
114
114
|
def quoted_false #:nodoc:
|
115
115
|
return "'#{self.class.boolean_to_string(false)}'" if emulate_booleans_from_strings
|
116
|
-
"0"
|
116
|
+
"0".freeze
|
117
117
|
end
|
118
118
|
|
119
119
|
def unquoted_false #:nodoc:
|
@@ -118,11 +118,23 @@ module ActiveRecord
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def insert_versions_sql(versions) # :nodoc:
|
121
|
-
sm_table = ActiveRecord::Migrator.schema_migrations_table_name
|
121
|
+
sm_table = quote_table_name(ActiveRecord::Migrator.schema_migrations_table_name)
|
122
122
|
|
123
|
-
|
124
|
-
"INSERT
|
125
|
-
|
123
|
+
if supports_multi_insert?
|
124
|
+
versions.inject("INSERT ALL\n") { |sql, version|
|
125
|
+
sql << "INTO #{sm_table} (version) VALUES (#{quote(version)})\n"
|
126
|
+
} << "SELECT * FROM DUAL\n"
|
127
|
+
else
|
128
|
+
if versions.is_a?(Array)
|
129
|
+
# called from ActiveRecord::Base.connection#dump_schema_information
|
130
|
+
versions.map { |version|
|
131
|
+
"INSERT INTO #{sm_table} (version) VALUES (#{quote(version)})"
|
132
|
+
}.join("\n\n/\n\n")
|
133
|
+
else
|
134
|
+
# called from ActiveRecord::Base.connection#assume_migrated_upto_version
|
135
|
+
"INSERT INTO #{sm_table} (version) VALUES (#{quote(versions)})"
|
136
|
+
end
|
137
|
+
end
|
126
138
|
end
|
127
139
|
|
128
140
|
def initialize_schema_migrations_table
|
@@ -1429,4 +1429,44 @@ end
|
|
1429
1429
|
end
|
1430
1430
|
|
1431
1431
|
end
|
1432
|
+
|
1433
|
+
describe "load schema" do
|
1434
|
+
let(:versions) {
|
1435
|
+
%w(20160101000000 20160102000000 20160103000000)
|
1436
|
+
}
|
1437
|
+
|
1438
|
+
before do
|
1439
|
+
@conn = ActiveRecord::Base.connection
|
1440
|
+
|
1441
|
+
ActiveRecord::SchemaMigration.create_table
|
1442
|
+
end
|
1443
|
+
|
1444
|
+
context "multi insert is supported" do
|
1445
|
+
it "should loads the migration schema table from insert versions sql" do
|
1446
|
+
skip "Not supported in this database version" unless ActiveRecord::Base.connection.supports_multi_insert?
|
1447
|
+
|
1448
|
+
expect {
|
1449
|
+
@conn.execute @conn.insert_versions_sql(versions)
|
1450
|
+
}.not_to raise_error
|
1451
|
+
|
1452
|
+
expect(@conn.select_value("SELECT COUNT(version) FROM schema_migrations")).to eq versions.count
|
1453
|
+
end
|
1454
|
+
end
|
1455
|
+
|
1456
|
+
context "multi insert is NOT supported" do
|
1457
|
+
it "should loads the migration schema table from insert versions sql" do
|
1458
|
+
skip "Not supported in this database version" if ActiveRecord::Base.connection.supports_multi_insert?
|
1459
|
+
|
1460
|
+
expect {
|
1461
|
+
versions.each { |version| @conn.execute @conn.insert_versions_sql(version) }
|
1462
|
+
}.not_to raise_error
|
1463
|
+
|
1464
|
+
expect(@conn.select_value("SELECT COUNT(version) FROM schema_migrations")).to eq versions.count
|
1465
|
+
end
|
1466
|
+
end
|
1467
|
+
|
1468
|
+
after do
|
1469
|
+
ActiveRecord::SchemaMigration.drop_table
|
1470
|
+
end
|
1471
|
+
end
|
1432
1472
|
end
|
@@ -291,6 +291,9 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
291
291
|
Time.parse("2016.01.#{i}").strftime("%Y%m%d%H%M%S")
|
292
292
|
end
|
293
293
|
end
|
294
|
+
|
295
|
+
let(:dump) { ActiveRecord::Base.connection.dump_schema_information }
|
296
|
+
|
294
297
|
before do
|
295
298
|
ActiveRecord::SchemaMigration.reset_table_name
|
296
299
|
ActiveRecord::SchemaMigration.create_table
|
@@ -298,18 +301,42 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
298
301
|
ActiveRecord::SchemaMigration.create!(:version => i)
|
299
302
|
end
|
300
303
|
end
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
304
|
+
|
305
|
+
context "multi insert is supported" do
|
306
|
+
it "should dump schema migrations using multi inserts" do
|
307
|
+
skip "Not supported in this database version" unless ActiveRecord::Base.connection.supports_multi_insert?
|
308
|
+
|
309
|
+
expect(dump).to eq <<-SQL.strip_heredoc
|
310
|
+
INSERT ALL
|
311
|
+
INTO "SCHEMA_MIGRATIONS" (version) VALUES ('20160101000000')
|
312
|
+
INTO "SCHEMA_MIGRATIONS" (version) VALUES ('20160102000000')
|
313
|
+
INTO "SCHEMA_MIGRATIONS" (version) VALUES ('20160103000000')
|
314
|
+
INTO "SCHEMA_MIGRATIONS" (version) VALUES ('20160104000000')
|
315
|
+
INTO "SCHEMA_MIGRATIONS" (version) VALUES ('20160105000000')
|
316
|
+
INTO "SCHEMA_MIGRATIONS" (version) VALUES ('20160106000000')
|
317
|
+
INTO "SCHEMA_MIGRATIONS" (version) VALUES ('20160107000000')
|
318
|
+
INTO "SCHEMA_MIGRATIONS" (version) VALUES ('20160108000000')
|
319
|
+
INTO "SCHEMA_MIGRATIONS" (version) VALUES ('20160109000000')
|
320
|
+
INTO "SCHEMA_MIGRATIONS" (version) VALUES ('20160110000000')
|
321
|
+
SELECT * FROM DUAL
|
322
|
+
SQL
|
305
323
|
end
|
306
324
|
end
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
325
|
+
|
326
|
+
context "multi insert is NOT supported" do
|
327
|
+
let(:insert_statement_per_migration) {
|
328
|
+
1.step(10).map { |i|
|
329
|
+
%Q|INSERT INTO "SCHEMA_MIGRATIONS" (version) VALUES ('201601#{sprintf("%02d", i)}000000')|
|
330
|
+
}.join("\n\n/\n\n")
|
331
|
+
}
|
332
|
+
|
333
|
+
it "should dump schema migrations one version per insert" do
|
334
|
+
skip "Not supported in this database version" if ActiveRecord::Base.connection.supports_multi_insert?
|
335
|
+
|
336
|
+
expect(dump).to eq insert_statement_per_migration
|
337
|
+
end
|
312
338
|
end
|
339
|
+
|
313
340
|
after do
|
314
341
|
ActiveRecord::SchemaMigration.drop_table
|
315
342
|
end
|
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.
|
4
|
+
version: 1.7.9
|
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-12-
|
11
|
+
date: 2016-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|