flydata 0.7.10 → 0.7.11

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: 2dde125415d768ce91d31ba571250fcc82211a6c
4
- data.tar.gz: 47de949761414acc3786397da03180e4f862cab8
3
+ metadata.gz: d5cb99d4fe2e890c02757c744e6c62f0946b2bf4
4
+ data.tar.gz: 5ca9a5c1618e2775b975adb6702d96399cb57ebf
5
5
  SHA512:
6
- metadata.gz: 6f21358a59fb60e600a0a823a80574bd923b269093dc1d91618f9dc3e6ef7813ab385171666f62e8c86ad84a94e6db1d4c4dbad561acf9276b4ff4f94af12a32
7
- data.tar.gz: 51daad9b9152816d384b367df2dbdffc3f3a0f3e9d07cf103759a8c2835d7b1bc71356961286f86da447a1dc0b2a218a9d9a669a6e4616f6da746ad8a4fb361d
6
+ metadata.gz: 634e6cee60de39ac8bdef5fe551095645b24adf5c54f9904499954b7682ee004feedcfa2d7d2a517b75ee2677706d2d9ab45430f17b67d99e0e3970b420d18d8
7
+ data.tar.gz: c03762c4bb3f013d349499ed50f6b4e9cbf4eb08d9943fdae5d8b6fb77eab53d9ce026813ee72122a03c8e79aa358e7c96e2aaedc49a5361615a6b99a607de22
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.10
1
+ 0.7.11
@@ -174,6 +174,9 @@ class PostgresqlTableDef < Base
174
174
  column[:default] = case column[:type]
175
175
  when 'boolean'
176
176
  to_boolean(information_schema_column["column_default"])
177
+ when '_unsupported'
178
+ # omit default value
179
+ nil
177
180
  else
178
181
  information_schema_column["column_default"] # TODO nil handling
179
182
  end
@@ -408,13 +408,17 @@ describe PostgresqlTableDef do
408
408
  subject {described_class.parse_one_column_def(information_schema_column)}
409
409
  let(:information_schema_column) { {} }
410
410
  let(:type) { double('type') }
411
+ let(:is_primary) { double('is_primary') }
412
+ let(:column_default) { double('column_default') }
411
413
  before do
412
414
  information_schema_column["is_primary"] = is_primary
415
+ information_schema_column["column_default"] = column_default
413
416
  allow(described_class).to receive(:convert_to_flydata_type).
414
417
  with(information_schema_column).
415
418
  and_return(type)
416
419
  end
417
420
 
421
+ # PRIMARY KEY
418
422
  context 'when the column is primary key' do
419
423
  let(:is_primary) { 't' }
420
424
  it { expect(subject[:primary_key]).to eq true}
@@ -429,6 +433,35 @@ describe PostgresqlTableDef do
429
433
  let(:is_primary) { nil }
430
434
  it { expect(subject[:primary_key]).to eq nil}
431
435
  end
436
+
437
+ # DEFAULT expression
438
+ context 'when the column type is a supported type' do
439
+ context 'when DEFAULT value is not specified' do
440
+ let(:type) { 'int4' }
441
+ let(:column_default) { nil }
442
+ it { expect(subject[:default]).to eq column_default }
443
+ end
444
+
445
+ context 'when DEFAULT value is specified' do
446
+ let(:type) { 'varchar(96)' }
447
+ let(:column_default) { "'FlyData, Inc.'"}
448
+ it { expect(subject[:default]).to eq column_default }
449
+ end
450
+ end
451
+
452
+ context 'when the column type is a unsupported' do
453
+ context 'when DEFAULT value is not specified' do
454
+ let(:type) { '_unsupported' }
455
+ let(:column_default) { nil }
456
+ it { expect(subject[:default]).to eq column_default }
457
+ end
458
+
459
+ context 'when DEFAULT value is specified' do
460
+ let(:type) { '_unsupported' }
461
+ let(:column_default) { "'{}'" }
462
+ it { expect(subject[:default]).to eq nil }
463
+ end
464
+ end
432
465
  end
433
466
  end
434
467
 
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flydata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.10
4
+ version: 0.7.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi Fujikawa
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-08-09 00:00:00.000000000 Z
15
+ date: 2016-08-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rest-client
@@ -882,7 +882,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
882
882
  version: '0'
883
883
  requirements: []
884
884
  rubyforge_project:
885
- rubygems_version: 2.4.3
885
+ rubygems_version: 2.2.2
886
886
  signing_key:
887
887
  specification_version: 4
888
888
  summary: FlyData Agent