activerecord-nulldb-adapter 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -56
- data/Appraisals +6 -35
- data/CHANGES.md +8 -0
- data/README.rdoc +6 -5
- data/activerecord-nulldb-adapter.gemspec +2 -2
- data/gemfiles/{activerecord_4.2.gemfile → activerecord_5.2.gemfile} +3 -2
- data/gemfiles/activerecord_6.0.gemfile +1 -1
- data/gemfiles/activerecord_master.gemfile +3 -6
- data/lib/active_record/connection_adapters/nulldb_adapter/core.rb +52 -1
- data/lib/active_record/connection_adapters/nulldb_adapter/table_definition.rb +7 -2
- data/lib/nulldb/version.rb +1 -1
- data/spec/nulldb_spec.rb +155 -2
- metadata +9 -15
- data/gemfiles/activerecord_2.3.gemfile +0 -17
- data/gemfiles/activerecord_3.2.gemfile +0 -16
- data/gemfiles/activerecord_4.0.gemfile +0 -16
- data/gemfiles/activerecord_4.1.gemfile +0 -16
- data/gemfiles/activerecord_5.0.gemfile +0 -16
- data/gemfiles/activerecord_5.1.gemfile +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e28ca94f06b2337cd9493abfad27346a67d83e2b1d2c62502d36488b141c8ce9
|
4
|
+
data.tar.gz: 8ba786f431c4869ffd2679a6306da5d80fcb93d10514cb78fc0c9e6a34d13f94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b482f6fc83e8ed912bd7157799bca3765000656744b54edc60c9c9dacde90e0ce1218f047c17ca02825d8c0224be44bda810db446ff2dd54054916f7f273720
|
7
|
+
data.tar.gz: 8ebc55bd87b24ce9355be8b435512cb01c84608acfe036a5835a059a85f9300fe95a968220edc441bbe7dd796670c3c27f22076ae2e20888620b0b068fb2450b
|
data/.travis.yml
CHANGED
@@ -4,22 +4,13 @@ bundler_args: --without development
|
|
4
4
|
sudo: false
|
5
5
|
|
6
6
|
rvm:
|
7
|
-
- 2.2
|
8
|
-
- 2.3
|
9
|
-
- 2.4
|
10
7
|
- 2.5
|
11
8
|
- 2.6
|
9
|
+
- 2.7
|
12
10
|
- jruby
|
13
|
-
- rbx
|
14
11
|
|
15
12
|
gemfile:
|
16
|
-
- gemfiles/
|
17
|
-
- gemfiles/activerecord_3.2.gemfile
|
18
|
-
- gemfiles/activerecord_4.0.gemfile
|
19
|
-
- gemfiles/activerecord_4.1.gemfile
|
20
|
-
- gemfiles/activerecord_4.2.gemfile
|
21
|
-
- gemfiles/activerecord_5.0.gemfile
|
22
|
-
- gemfiles/activerecord_5.1.gemfile
|
13
|
+
- gemfiles/activerecord_5.2.gemfile
|
23
14
|
- gemfiles/activerecord_6.0.gemfile
|
24
15
|
- gemfiles/activerecord_master.gemfile
|
25
16
|
|
@@ -27,49 +18,4 @@ matrix:
|
|
27
18
|
fast_finish: true
|
28
19
|
allow_failures:
|
29
20
|
- rvm: jruby
|
30
|
-
- rvm: rbx
|
31
21
|
- gemfile: gemfiles/activerecord_master.gemfile
|
32
|
-
exclude:
|
33
|
-
- rvm: 2.2
|
34
|
-
gemfile: gemfiles/activerecord_2.3.gemfile
|
35
|
-
- rvm: 2.2
|
36
|
-
gemfile: gemfiles/activerecord_6.0.gemfile
|
37
|
-
- rvm: 2.2
|
38
|
-
gemfile: gemfiles/activerecord_master.gemfile
|
39
|
-
- rvm: 2.3
|
40
|
-
gemfile: gemfiles/activerecord_2.3.gemfile
|
41
|
-
- rvm: 2.3
|
42
|
-
gemfile: gemfiles/activerecord_6.0.gemfile
|
43
|
-
- rvm: 2.3
|
44
|
-
gemfile: gemfiles/activerecord_master.gemfile
|
45
|
-
- rvm: 2.4
|
46
|
-
gemfile: gemfiles/activerecord_2.3.gemfile
|
47
|
-
- rvm: 2.4
|
48
|
-
gemfile: gemfiles/activerecord_3.2.gemfile
|
49
|
-
- rvm: 2.4
|
50
|
-
gemfile: gemfiles/activerecord_4.0.gemfile
|
51
|
-
- rvm: 2.4
|
52
|
-
gemfile: gemfiles/activerecord_4.1.gemfile
|
53
|
-
- rvm: 2.4
|
54
|
-
gemfile: gemfiles/activerecord_6.0.gemfile
|
55
|
-
- rvm: 2.4
|
56
|
-
gemfile: gemfiles/activerecord_master.gemfile
|
57
|
-
- rvm: 2.5
|
58
|
-
gemfile: gemfiles/activerecord_2.3.gemfile
|
59
|
-
- rvm: 2.5
|
60
|
-
gemfile: gemfiles/activerecord_3.2.gemfile
|
61
|
-
- rvm: 2.5
|
62
|
-
gemfile: gemfiles/activerecord_4.0.gemfile
|
63
|
-
- rvm: 2.5
|
64
|
-
gemfile: gemfiles/activerecord_4.1.gemfile
|
65
|
-
- rvm: 2.6
|
66
|
-
gemfile: gemfiles/activerecord_2.3.gemfile
|
67
|
-
- rvm: 2.6
|
68
|
-
gemfile: gemfiles/activerecord_3.2.gemfile
|
69
|
-
- rvm: 2.6
|
70
|
-
gemfile: gemfiles/activerecord_4.0.gemfile
|
71
|
-
- rvm: 2.6
|
72
|
-
gemfile: gemfiles/activerecord_4.1.gemfile
|
73
|
-
|
74
|
-
|
75
|
-
|
data/Appraisals
CHANGED
@@ -1,40 +1,11 @@
|
|
1
|
-
appraise "activerecord-2
|
2
|
-
gem
|
3
|
-
gem "activerecord", "~> 2.3.0"
|
1
|
+
appraise "activerecord-5.2" do
|
2
|
+
gem "activerecord", "~> 5.2.0"
|
4
3
|
end
|
5
4
|
|
6
|
-
appraise "activerecord-
|
7
|
-
gem "activerecord", "~>
|
8
|
-
end
|
9
|
-
|
10
|
-
appraise "activerecord-3.1" do
|
11
|
-
gem "activerecord", "~> 3.1.0"
|
12
|
-
end
|
13
|
-
|
14
|
-
appraise "activerecord-3.2" do
|
15
|
-
gem "activerecord", "~> 3.2.0"
|
16
|
-
end
|
17
|
-
|
18
|
-
appraise "activerecord-4.0" do
|
19
|
-
gem "activerecord", "~> 4.0.0"
|
20
|
-
end
|
21
|
-
|
22
|
-
appraise "activerecord-4.1" do
|
23
|
-
gem "activerecord", "~> 4.1.0"
|
24
|
-
end
|
25
|
-
|
26
|
-
appraise "activerecord-4.2" do
|
27
|
-
gem "activerecord", "~> 4.2.0"
|
28
|
-
end
|
29
|
-
|
30
|
-
appraise "activerecord-5.0" do
|
31
|
-
gem "activerecord", "~> 5.0.0"
|
32
|
-
end
|
33
|
-
|
34
|
-
appraise "activerecord-5.1" do
|
35
|
-
gem "activerecord", "~> 5.1.0"
|
5
|
+
appraise "activerecord-6.0" do
|
6
|
+
gem "activerecord", "~> 6.0.0"
|
36
7
|
end
|
37
8
|
|
38
|
-
appraise "activerecord-
|
39
|
-
gem "activerecord",
|
9
|
+
appraise "activerecord-master" do
|
10
|
+
gem "activerecord", github: 'rails/rails'
|
40
11
|
end
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
Unreleased
|
2
2
|
----------
|
3
3
|
|
4
|
+
0.5.0 (2020-10-15)
|
5
|
+
-----------
|
6
|
+
|
7
|
+
- *Breaking* Drop support to Ruby 2.2, 2.3, 2.4
|
8
|
+
- *Breaking* Drop support to Rails 2.X, 3.X, 4.X, 5.0, 5.1
|
9
|
+
- Drop support to old versions of Ruby and Rails. #96
|
10
|
+
- Added support for postgres column types included jsonb and ability to delete columns #94
|
11
|
+
|
4
12
|
0.4.0 (2019-07-22)
|
5
13
|
-----------
|
6
14
|
|
data/README.rdoc
CHANGED
@@ -16,14 +16,14 @@ a real database.
|
|
16
16
|
== Compatibility
|
17
17
|
|
18
18
|
=== Ruby
|
19
|
-
Currently supported Ruby versions: MRI 2.
|
19
|
+
Currently supported Ruby versions: MRI 2.5.x, 2.6.x, 2.7.x
|
20
20
|
|
21
|
-
Experimental support provided for: JRuby
|
21
|
+
Experimental support provided for: JRuby
|
22
22
|
|
23
23
|
=== ActiveRecord
|
24
|
-
Any version of ActiveRecord
|
24
|
+
Any version of ActiveRecord >= 5
|
25
25
|
|
26
|
-
It is tested against AR
|
26
|
+
It is tested against AR 5.2, 6.0 and master branch.
|
27
27
|
|
28
28
|
== Installation
|
29
29
|
|
@@ -136,7 +136,8 @@ nothing will be saved.
|
|
136
136
|
== Who
|
137
137
|
|
138
138
|
NullDB was originally written by Avdi Grimm <mailto:avdi@avdi.org>.
|
139
|
-
It is currently maintained by {
|
139
|
+
It is currently maintained by {Danilo Cabello}[https://github.com/cabello].
|
140
|
+
Previously maintained by: {Bram de Vries}[https://github.com/blaet].
|
140
141
|
|
141
142
|
== Where
|
142
143
|
|
@@ -17,10 +17,10 @@ Gem::Specification.new do |s|
|
|
17
17
|
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = `git ls-files`.split($/)
|
20
|
-
s.homepage = "
|
20
|
+
s.homepage = "https://github.com/nulldb/nulldb"
|
21
21
|
s.licenses = ["MIT"]
|
22
22
|
|
23
|
-
s.add_runtime_dependency 'activerecord', '>= 2.0
|
23
|
+
s.add_runtime_dependency 'activerecord', '>= 5.2.0'
|
24
24
|
s.add_development_dependency 'spec'
|
25
25
|
s.add_development_dependency 'rdoc'
|
26
26
|
s.add_development_dependency 'rspec'
|
@@ -2,15 +2,16 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "activerecord", "~>
|
5
|
+
gem "activerecord", "~> 5.2.0"
|
6
6
|
|
7
7
|
group :development, :test do
|
8
8
|
gem "spec"
|
9
9
|
gem "rspec", ">= 1.2.9"
|
10
10
|
gem "rake"
|
11
|
+
gem "rdoc"
|
11
12
|
end
|
12
13
|
|
13
14
|
group :development do
|
14
15
|
gem "appraisal"
|
15
|
-
gem "simplecov", :
|
16
|
+
gem "simplecov", require: false
|
16
17
|
end
|
@@ -2,19 +2,16 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
|
6
|
-
gem 'activerecord'
|
7
|
-
end
|
8
|
-
|
9
|
-
gem 'arel', github: 'rails/arel', branch: 'master'
|
5
|
+
gem "activerecord", github: "rails/rails"
|
10
6
|
|
11
7
|
group :development, :test do
|
12
8
|
gem "spec"
|
13
9
|
gem "rspec", ">= 1.2.9"
|
14
10
|
gem "rake"
|
11
|
+
gem "rdoc"
|
15
12
|
end
|
16
13
|
|
17
14
|
group :development do
|
18
15
|
gem "appraisal"
|
19
|
-
gem "simplecov", :
|
16
|
+
gem "simplecov", require: false
|
20
17
|
end
|
@@ -74,7 +74,14 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
|
|
74
74
|
|
75
75
|
yield table_definition if block_given?
|
76
76
|
|
77
|
-
@tables[table_name] = table_definition
|
77
|
+
@tables[table_name.to_s] = table_definition
|
78
|
+
end
|
79
|
+
|
80
|
+
def rename_table(table_name, new_name)
|
81
|
+
table_definition = @tables.delete(table_name.to_s)
|
82
|
+
|
83
|
+
table_definition.name = new_name.to_s
|
84
|
+
@tables[new_name.to_s] = table_definition
|
78
85
|
end
|
79
86
|
|
80
87
|
def add_index(table_name, column_names, options = {})
|
@@ -83,6 +90,11 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
|
|
83
90
|
@indexes[table_name] << IndexDefinition.new(table_name, index_name, (index_type == 'UNIQUE'), column_names, [], [])
|
84
91
|
end
|
85
92
|
|
93
|
+
def remove_index(table_name, options = {})
|
94
|
+
index_name = index_name_for_remove(table_name, options)
|
95
|
+
index = @indexes[table_name].reject! { |index| index.name == index_name }
|
96
|
+
end
|
97
|
+
|
86
98
|
unless instance_methods.include? :add_index_options
|
87
99
|
def add_index_options(table_name, column_name, options = {})
|
88
100
|
column_names = Array.wrap(column_name)
|
@@ -228,6 +240,45 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
|
|
228
240
|
columns(table_name).detect { |col| col.sql_type == :primary_key }.try(:name)
|
229
241
|
end
|
230
242
|
|
243
|
+
def add_column(table_name, column_name, type, options = {})
|
244
|
+
super
|
245
|
+
|
246
|
+
table_meta = @tables[table_name.to_s]
|
247
|
+
return unless table_meta
|
248
|
+
|
249
|
+
table_meta.column column_name, type, options
|
250
|
+
end
|
251
|
+
|
252
|
+
def change_column(table_name, column_name, type, options = {})
|
253
|
+
table_meta = @tables[table_name.to_s]
|
254
|
+
column = table_meta.columns.find { |column| column.name == column_name.to_s }
|
255
|
+
return unless column
|
256
|
+
|
257
|
+
column.type = type
|
258
|
+
column.options = options if options
|
259
|
+
end
|
260
|
+
|
261
|
+
def rename_column(table_name, column_name, new_column_name)
|
262
|
+
table_meta = @tables[table_name.to_s]
|
263
|
+
column = table_meta.columns.find { |column| column.name == column_name.to_s }
|
264
|
+
return unless column
|
265
|
+
|
266
|
+
column.name = new_column_name
|
267
|
+
end
|
268
|
+
|
269
|
+
def change_column_default(table_name, column_name, default_or_changes)
|
270
|
+
table_meta = @tables[table_name.to_s]
|
271
|
+
column = table_meta.columns.find { |column| column.name == column_name.to_s }
|
272
|
+
|
273
|
+
return unless column
|
274
|
+
|
275
|
+
if default_or_changes.kind_of? Hash
|
276
|
+
column.default = default_or_changes[:to]
|
277
|
+
else
|
278
|
+
column.default = default_or_changes
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
231
282
|
protected
|
232
283
|
|
233
284
|
def select(statement, name = nil, binds = [])
|
@@ -1,5 +1,10 @@
|
|
1
1
|
class ActiveRecord::ConnectionAdapters::NullDBAdapter
|
2
2
|
|
3
|
-
TableDefinition
|
4
|
-
|
3
|
+
class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
|
4
|
+
attr_accessor :name
|
5
|
+
alias_method :citext, :text
|
6
|
+
alias_method :interval, :text
|
7
|
+
alias_method :geometry, :text
|
8
|
+
alias_method :jsonb, :json if method_defined? :json
|
9
|
+
end
|
5
10
|
end
|
data/lib/nulldb/version.rb
CHANGED
data/spec/nulldb_spec.rb
CHANGED
@@ -84,6 +84,8 @@ describe "NullDB" do
|
|
84
84
|
|
85
85
|
add_index "employees", :name, :name => "index_employees_on_name"
|
86
86
|
add_index "employees", ["employee_number"], :name => "index_employees_on_employee_number", :unique => true
|
87
|
+
add_index "employees", :hire_date
|
88
|
+
remove_index "employees", :hire_date
|
87
89
|
add_index "employees_widgets", ["employee_id", "widget_id"], :name => "my_index"
|
88
90
|
|
89
91
|
add_fk_constraint "foo", "bar", "baz", "buz", "bungle"
|
@@ -265,7 +267,7 @@ describe "NullDB" do
|
|
265
267
|
end
|
266
268
|
|
267
269
|
|
268
|
-
it "should support adding indexes" do
|
270
|
+
it "should support adding and removing indexes" do
|
269
271
|
expect( Employee.connection.indexes('employees').size ).to eq 2
|
270
272
|
expect( Employee.connection.indexes('employees_widgets').size ).to eq 1
|
271
273
|
end
|
@@ -288,7 +290,7 @@ describe "NullDB" do
|
|
288
290
|
expect { NullDB.nullify }.to_not raise_error
|
289
291
|
end
|
290
292
|
|
291
|
-
it 'should handle count queries' do
|
293
|
+
it 'should handle count queries' do
|
292
294
|
expect(Employee.count).to eql(0)
|
293
295
|
end
|
294
296
|
end
|
@@ -324,6 +326,131 @@ describe NullDB::RSpec::NullifiedDatabase do
|
|
324
326
|
end
|
325
327
|
end
|
326
328
|
|
329
|
+
describe 'table changes' do
|
330
|
+
before(:each) do
|
331
|
+
ActiveRecord::Base.establish_connection :adapter => :nulldb
|
332
|
+
ActiveRecord::Migration.verbose = false
|
333
|
+
|
334
|
+
ActiveRecord::Schema.define do
|
335
|
+
create_table(:employees) do |t|
|
336
|
+
t.string :name, null: false, limit: 50
|
337
|
+
t.date :hire_date
|
338
|
+
t.integer :employee_number
|
339
|
+
t.decimal :salary
|
340
|
+
end
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
def should_have_column(klass, col_name, col_type)
|
345
|
+
col = klass.columns_hash[col_name.to_s]
|
346
|
+
expect(col.sql_type.to_s.gsub(/\([0-9]+\)/, "").to_sym).to eq col_type
|
347
|
+
end
|
348
|
+
|
349
|
+
describe 'rename_table' do
|
350
|
+
it 'should rename a table' do
|
351
|
+
expect{
|
352
|
+
ActiveRecord::Schema.define do
|
353
|
+
rename_table :employees, :workers
|
354
|
+
end
|
355
|
+
}.to_not raise_error
|
356
|
+
|
357
|
+
class Worker < ActiveRecord::Base
|
358
|
+
after_save :on_save_finished
|
359
|
+
|
360
|
+
def on_save_finished
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
should_have_column(Worker, :name, :string)
|
365
|
+
should_have_column(Worker, :hire_date, :date)
|
366
|
+
should_have_column(Worker, :employee_number, :integer)
|
367
|
+
should_have_column(Worker, :salary, :decimal)
|
368
|
+
|
369
|
+
worker = Worker.create(:name => "Bob Jones")
|
370
|
+
expect(worker.name).to eq "Bob Jones"
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
describe 'add_column' do
|
375
|
+
it 'should add a column to an existing table' do
|
376
|
+
expect{
|
377
|
+
ActiveRecord::Schema.define do
|
378
|
+
add_column :employees, :title, :string
|
379
|
+
end
|
380
|
+
Employee.connection.schema_cache.clear!
|
381
|
+
Employee.reset_column_information
|
382
|
+
}.to_not raise_error
|
383
|
+
|
384
|
+
should_have_column(Employee, :name, :string)
|
385
|
+
should_have_column(Employee, :hire_date, :date)
|
386
|
+
should_have_column(Employee, :employee_number, :integer)
|
387
|
+
should_have_column(Employee, :salary, :decimal)
|
388
|
+
should_have_column(Employee, :title, :string)
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
describe 'change_column' do
|
393
|
+
it 'should change the column type' do
|
394
|
+
expect{
|
395
|
+
ActiveRecord::Schema.define do
|
396
|
+
change_column :employees, :name, :text
|
397
|
+
end
|
398
|
+
Employee.connection.schema_cache.clear!
|
399
|
+
Employee.reset_column_information
|
400
|
+
}.to_not raise_error
|
401
|
+
|
402
|
+
should_have_column(Employee, :name, :text)
|
403
|
+
should_have_column(Employee, :hire_date, :date)
|
404
|
+
should_have_column(Employee, :employee_number, :integer)
|
405
|
+
should_have_column(Employee, :salary, :decimal)
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
describe 'rename_column' do
|
410
|
+
it 'should rename a column' do
|
411
|
+
expect{
|
412
|
+
ActiveRecord::Schema.define do
|
413
|
+
rename_column :employees, :name, :full_name
|
414
|
+
end
|
415
|
+
Employee.connection.schema_cache.clear!
|
416
|
+
Employee.reset_column_information
|
417
|
+
}.to_not raise_error
|
418
|
+
|
419
|
+
should_have_column(Employee, :full_name, :string)
|
420
|
+
should_have_column(Employee, :hire_date, :date)
|
421
|
+
should_have_column(Employee, :employee_number, :integer)
|
422
|
+
should_have_column(Employee, :salary, :decimal)
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
describe 'change_column_default' do
|
427
|
+
it 'should change default value of a column' do
|
428
|
+
expect{
|
429
|
+
ActiveRecord::Schema.define do
|
430
|
+
change_column_default :employees, :name, 'Jon Doe'
|
431
|
+
end
|
432
|
+
Employee.connection.schema_cache.clear!
|
433
|
+
Employee.reset_column_information
|
434
|
+
}.to_not raise_error
|
435
|
+
|
436
|
+
columns = Employee.columns
|
437
|
+
expect(columns.second.default).to eq('Jon Doe')
|
438
|
+
end
|
439
|
+
|
440
|
+
it 'should change default value of a with has syntax' do
|
441
|
+
expect{
|
442
|
+
ActiveRecord::Schema.define do
|
443
|
+
change_column_default :employees, :name, from: nil, to: 'Jon Doe'
|
444
|
+
end
|
445
|
+
Employee.connection.schema_cache.clear!
|
446
|
+
Employee.reset_column_information
|
447
|
+
}.to_not raise_error
|
448
|
+
|
449
|
+
columns = Employee.columns
|
450
|
+
expect(columns.second.default).to eq('Jon Doe')
|
451
|
+
end
|
452
|
+
end
|
453
|
+
end
|
327
454
|
|
328
455
|
describe 'adapter-specific extensions' do
|
329
456
|
before(:all) do
|
@@ -331,6 +458,11 @@ describe 'adapter-specific extensions' do
|
|
331
458
|
ActiveRecord::Migration.verbose = false
|
332
459
|
end
|
333
460
|
|
461
|
+
def should_have_column(klass, col_name, col_type)
|
462
|
+
col = klass.columns_hash[col_name.to_s]
|
463
|
+
expect(col.sql_type.to_s.gsub(/\([0-9]+\)/, "").to_sym).to eq col_type
|
464
|
+
end
|
465
|
+
|
334
466
|
it "supports 'enable_extension' in the schema definition" do
|
335
467
|
expect{
|
336
468
|
ActiveRecord::Schema.define do
|
@@ -339,6 +471,27 @@ describe 'adapter-specific extensions' do
|
|
339
471
|
}.to_not raise_error
|
340
472
|
end
|
341
473
|
|
474
|
+
it 'supports postgres extension columns' do
|
475
|
+
expect {
|
476
|
+
ActiveRecord::Schema.define do
|
477
|
+
create_table :extended_models do |t|
|
478
|
+
t.citext :text
|
479
|
+
t.interval :time_interval
|
480
|
+
t.geometry :feature_geometry, srid: 4326, type: "multi_polygon"
|
481
|
+
t.jsonb :jsonb_column
|
482
|
+
end
|
483
|
+
end
|
484
|
+
}.to_not raise_error
|
485
|
+
|
486
|
+
class ExtendedModel < ActiveRecord::Base
|
487
|
+
end
|
488
|
+
|
489
|
+
should_have_column(ExtendedModel, :text, :text)
|
490
|
+
should_have_column(ExtendedModel, :time_interval, :text)
|
491
|
+
should_have_column(ExtendedModel, :feature_geometry, :text)
|
492
|
+
should_have_column(ExtendedModel, :jsonb_column, :json)
|
493
|
+
end
|
494
|
+
|
342
495
|
if ActiveRecord::VERSION::MAJOR > 4
|
343
496
|
it 'registers a primary_key type' do
|
344
497
|
expect(ActiveRecord::Type.lookup(:primary_key, adapter: 'NullDB'))
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-nulldb-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Avdi Grimm
|
8
8
|
- Myron Marston
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-10-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 2.0
|
20
|
+
version: 5.2.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 2.0
|
27
|
+
version: 5.2.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: spec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,13 +128,7 @@ files:
|
|
128
128
|
- README.rdoc
|
129
129
|
- Rakefile
|
130
130
|
- activerecord-nulldb-adapter.gemspec
|
131
|
-
- gemfiles/
|
132
|
-
- gemfiles/activerecord_3.2.gemfile
|
133
|
-
- gemfiles/activerecord_4.0.gemfile
|
134
|
-
- gemfiles/activerecord_4.1.gemfile
|
135
|
-
- gemfiles/activerecord_4.2.gemfile
|
136
|
-
- gemfiles/activerecord_5.0.gemfile
|
137
|
-
- gemfiles/activerecord_5.1.gemfile
|
131
|
+
- gemfiles/activerecord_5.2.gemfile
|
138
132
|
- gemfiles/activerecord_6.0.gemfile
|
139
133
|
- gemfiles/activerecord_master.gemfile
|
140
134
|
- lib/active_record/connection_adapters/nulldb_adapter.rb
|
@@ -159,11 +153,11 @@ files:
|
|
159
153
|
- lib/tasks/database.rake
|
160
154
|
- spec/nulldb_spec.rb
|
161
155
|
- spec/spec.opts
|
162
|
-
homepage:
|
156
|
+
homepage: https://github.com/nulldb/nulldb
|
163
157
|
licenses:
|
164
158
|
- MIT
|
165
159
|
metadata: {}
|
166
|
-
post_install_message:
|
160
|
+
post_install_message:
|
167
161
|
rdoc_options: []
|
168
162
|
require_paths:
|
169
163
|
- lib
|
@@ -179,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
173
|
version: '0'
|
180
174
|
requirements: []
|
181
175
|
rubygems_version: 3.0.3
|
182
|
-
signing_key:
|
176
|
+
signing_key:
|
183
177
|
specification_version: 4
|
184
178
|
summary: The Null Object pattern as applied to ActiveRecord database adapters
|
185
179
|
test_files: []
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 2.3.0"
|
6
|
-
gem "iconv", :platforms => :ruby
|
7
|
-
|
8
|
-
group :development, :test do
|
9
|
-
gem "spec"
|
10
|
-
gem "rspec", ">= 1.2.9"
|
11
|
-
gem "rake"
|
12
|
-
end
|
13
|
-
|
14
|
-
group :development do
|
15
|
-
gem "appraisal"
|
16
|
-
gem "simplecov", :require => false
|
17
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 3.2.0"
|
6
|
-
|
7
|
-
group :development, :test do
|
8
|
-
gem "spec"
|
9
|
-
gem "rspec", ">= 1.2.9"
|
10
|
-
gem "rake"
|
11
|
-
end
|
12
|
-
|
13
|
-
group :development do
|
14
|
-
gem "appraisal"
|
15
|
-
gem "simplecov", :require => false
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 4.0.0"
|
6
|
-
|
7
|
-
group :development, :test do
|
8
|
-
gem "spec"
|
9
|
-
gem "rspec", ">= 1.2.9"
|
10
|
-
gem "rake"
|
11
|
-
end
|
12
|
-
|
13
|
-
group :development do
|
14
|
-
gem "appraisal"
|
15
|
-
gem "simplecov", :require => false
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 4.1.0"
|
6
|
-
|
7
|
-
group :development, :test do
|
8
|
-
gem "spec"
|
9
|
-
gem "rspec", ">= 1.2.9"
|
10
|
-
gem "rake"
|
11
|
-
end
|
12
|
-
|
13
|
-
group :development do
|
14
|
-
gem "appraisal"
|
15
|
-
gem "simplecov", :require => false
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 5.0.0"
|
6
|
-
|
7
|
-
group :development, :test do
|
8
|
-
gem "spec"
|
9
|
-
gem "rspec", ">= 1.2.9"
|
10
|
-
gem "rake"
|
11
|
-
end
|
12
|
-
|
13
|
-
group :development do
|
14
|
-
gem "appraisal"
|
15
|
-
gem "simplecov", :require => false
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 5.1.0"
|
6
|
-
|
7
|
-
group :development, :test do
|
8
|
-
gem "spec"
|
9
|
-
gem "rspec", ">= 1.2.9"
|
10
|
-
gem "rake"
|
11
|
-
end
|
12
|
-
|
13
|
-
group :development do
|
14
|
-
gem "appraisal"
|
15
|
-
gem "simplecov", :require => false
|
16
|
-
end
|