flydata 0.7.2 → 0.7.2.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 041b42f8c7a79544e1075015c40b5f4d617eb983
|
4
|
+
data.tar.gz: 18a938ab66c2754e67821cdb93178f0450991d8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0afce08535788fde831998db168317d125ab4e4249f36dd9d10fee443ca3e62bb3dfce478bc3953e04d5d57dd7fa560e4ba2a1948c517021378f52a0686abc58
|
7
|
+
data.tar.gz: e7af6dd1ec9470fd25a5c853858123112deb8f90c1a7543d09dc99c5564d75398c63f934125906f29bbf91b53d8cc8fa923f014b32c7b164f7554bf0058b44bd
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.2
|
1
|
+
0.7.2.1
|
@@ -56,7 +56,7 @@ class RedshiftTableDef
|
|
56
56
|
options[:backup_postfix] = "_flydata#{Time.now.strftime('%Y%m%d%H%M%S')}"
|
57
57
|
tabledef += "BEGIN;\n"
|
58
58
|
tabledef += remove_table_sql(flydata_tabledef, schema_name, options) unless options[:ctl_only]
|
59
|
-
tabledef += create_table_sql(flydata_tabledef, schema_name) unless options[:ctl_only]
|
59
|
+
tabledef += create_table_sql(flydata_tabledef, schema_name, options) unless options[:ctl_only]
|
60
60
|
tabledef += comment_sql(flydata_tabledef, schema_name) unless options[:ctl_only]
|
61
61
|
tabledef += flydata_ctl_sql(flydata_tabledef, schema_name)
|
62
62
|
tabledef += "COMMIT;\n"
|
@@ -167,7 +167,7 @@ EOS
|
|
167
167
|
sql += drop_backup_table_sql(flydata_tabledef, schema_name, options)
|
168
168
|
# create an empty table to prevent RENAME TABLE query from failing
|
169
169
|
sql += create_table_sql(flydata_tabledef, schema_name,
|
170
|
-
create_table_sql: CREATE_TABLE_IF_NOT_EXISTS_SQL)
|
170
|
+
options.merge(create_table_sql: CREATE_TABLE_IF_NOT_EXISTS_SQL))
|
171
171
|
backup_tbl = table_name_for_ddl(
|
172
172
|
"#{table_name}#{options[:backup_postfix]}", nil)
|
173
173
|
sql += RENAME_TABLE_SQL % [redshift_tbl, backup_tbl]
|
@@ -194,6 +194,13 @@ EOS
|
|
194
194
|
ct_sql = options[:create_table_sql] || CREATE_TABLE_SQL
|
195
195
|
lines = flydata_tabledef[:columns].collect{|column| column_def_sql(column) }
|
196
196
|
pk_def = primary_key_sql(flydata_tabledef)
|
197
|
+
|
198
|
+
unless options[:skip_primary_key_check]
|
199
|
+
unless pk_def
|
200
|
+
$log.error "no primary key defined in table: #{flydata_tabledef[:table_name]}"
|
201
|
+
raise "no primary key defined"
|
202
|
+
end
|
203
|
+
end
|
197
204
|
lines << pk_def if pk_def
|
198
205
|
|
199
206
|
contents = lines.join(",\n")
|
@@ -403,6 +403,33 @@ describe PostgresqlTableDef do
|
|
403
403
|
end
|
404
404
|
end
|
405
405
|
end
|
406
|
+
|
407
|
+
describe '.parse_one_column_def' do
|
408
|
+
subject {described_class.parse_one_column_def(information_schema_column)}
|
409
|
+
let(:information_schema_column) { {} }
|
410
|
+
let(:type) { double('type') }
|
411
|
+
before do
|
412
|
+
information_schema_column["is_primary"] = is_primary
|
413
|
+
allow(described_class).to receive(:convert_to_flydata_type).
|
414
|
+
with(information_schema_column).
|
415
|
+
and_return(type)
|
416
|
+
end
|
417
|
+
|
418
|
+
context 'when the column is primary key' do
|
419
|
+
let(:is_primary) { 't' }
|
420
|
+
it { expect(subject[:primary_key]).to eq true}
|
421
|
+
end
|
422
|
+
|
423
|
+
context 'when the column is index key' do
|
424
|
+
let(:is_primary) { 'f' }
|
425
|
+
it { expect(subject[:primary_key]).to eq nil}
|
426
|
+
end
|
427
|
+
|
428
|
+
context 'when the column is not primary key or index key' do
|
429
|
+
let(:is_primary) { nil }
|
430
|
+
it { expect(subject[:primary_key]).to eq nil}
|
431
|
+
end
|
432
|
+
end
|
406
433
|
end
|
407
434
|
|
408
435
|
end
|
data/flydata.gemspec
CHANGED
Binary file
|
data/lib/flydata/command/sync.rb
CHANGED
@@ -1184,7 +1184,7 @@ EOM
|
|
1184
1184
|
flydata_tabledefs.each do |flydata_tabledef|
|
1185
1185
|
skip_drop_table = opts.drop_append_only? ? false : append_only.include?(flydata_tabledef[:table_name])
|
1186
1186
|
puts FlydataCore::TableDef::SyncRedshiftTableDef.from_flydata_tabledef(flydata_tabledef,
|
1187
|
-
flydata_ctl_table: create_flydata_ctl_table, schema_name: schema_name, ctl_only: opts.ctl_only?, skip_drop_table: skip_drop_table)
|
1187
|
+
flydata_ctl_table: create_flydata_ctl_table, schema_name: schema_name, ctl_only: opts.ctl_only?, skip_drop_table: skip_drop_table, skip_primary_key_check: opts.skip_primary_key_check?)
|
1188
1188
|
create_flydata_ctl_table = false
|
1189
1189
|
end
|
1190
1190
|
table_validity_hash = {}
|
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.2
|
4
|
+
version: 0.7.2.1
|
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-04-
|
15
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rest-client
|