flydata 0.8.7 → 0.8.8

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: 86638a18d82f42ee50003d03780a5e9a62b3d82a
4
- data.tar.gz: a6d911a12d67f294d1cb855e293a0add77f99a92
3
+ metadata.gz: f5fc3a906ed3837e16d5cedecaf192d488c140eb
4
+ data.tar.gz: b5ddcf8ea4abd89688e6ed096837bf53cfff14ee
5
5
  SHA512:
6
- metadata.gz: a97793d37523ba2319529941ff8661445b64836038bfa179e453800c45b18f4a91103174e0cc479d8ea821feb42e084f6098392ce7b9667b8d9d90e41f68f466
7
- data.tar.gz: 94c736d7dd868e197c96ea39404e04c3f466ab8bd07ae5370872d3a11a34f77be1adcf1027df83cf272789476b451089fee682d7781fcef5b5388ad8016756fe
6
+ metadata.gz: 14bd2021e7c507a6ab59e29e6e210776fd6a2a7bf2eaeb52d36b1da39839d1e575203066c2b14e6bb06628f8464b1b9b9510c13c64b7ada5d727b81d46ce230e
7
+ data.tar.gz: 83740aa8b34dd758656071446c34a8fd2ed0486a464eca577b9ea9ff0731ece4e190ba36292210cd66953adf761e2ff5abaeb6e484582b491d93d24928eab396
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ Jeweler::Tasks.new do |gem|
20
20
  gem.summary = %Q{FlyData Agent}
21
21
  gem.description = %Q{FlyData Agent}
22
22
  gem.email = "sysadmin@flydata.com"
23
- gem.authors = ["Koichi Fujikawa", "Masashi Miyazaki", "Matthew Luu", "Mak Inada", "Sriram NS"]
23
+ gem.authors = ["Koichi Fujikawa", "Masashi Miyazaki", "Matthew Luu", "Mak Inada", "Sriram NS", "Chie Inada"]
24
24
  # dependencies defined in Gemfile
25
25
  end
26
26
  Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.7
1
+ 0.8.8
@@ -145,6 +145,11 @@ class MysqlTableDef < Base
145
145
  # `col_smallint` smallint(6) DEFAULT NULL,
146
146
  if stripped_line.start_with?('`')
147
147
  column = parse_one_column_def(line)
148
+ unless column[:type]
149
+ tabledef_error = {error: "Unsupported column type '#{column[:source_type]}'", table: table_name}
150
+ position = :tabledef_error
151
+ next
152
+ end
148
153
  columns << column
149
154
  coldef = line.strip.gsub(/,$/, '')
150
155
  column_def[column[:column]] = coldef
@@ -236,6 +241,7 @@ class MysqlTableDef < Base
236
241
 
237
242
  # type
238
243
  type = line[start_pos..pos-1]
244
+ column[:source_type] = type
239
245
  column[:type] = convert_to_flydata_type(type)
240
246
 
241
247
  cond = :options
@@ -31,37 +31,37 @@ describe MysqlTableDef do
31
31
  it 'should set correct table name' do
32
32
  expect(subject[:columns]).to eq(
33
33
  [
34
- {:column=>"id", :type=>"int8(20)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
35
- {:column=>"col_binary", :type=>"binary(202)", :default=>nil},
36
- {:column=>"col_blob", :type=>"varbinary(65535)"},
37
- {:column=>"col_bool", :type=>"int1(1)", :default=>"'0'"},
38
- {:column=>"col_char", :type=>"varchar(18)", :default=>nil},
39
- {:column=>"col_date", :type=>"date", :default=>nil},
40
- {:column=>"col_datetime", :type=>"datetime", :default=>nil},
41
- {:column=>"col_decimal", :type=>"numeric(5,2)", :default=>nil},
42
- {:column=>"col_double", :type=>"float8", :default=>nil},
43
- {:column=>"col_float", :type=>"float4", :default=>nil},
44
- {:column=>"col_float_4_2", :type=>"float4(4,2)", :default=>nil},
45
- {:column=>"col_int", :type=>"int4(11)", :default=>nil},
46
- {:column=>"col_int_6", :type=>"int4(6)", :default=>nil},
47
- {:column=>"col_json", :type=>"json", :default=>nil},
48
- {:column=>"col_longblob", :type=>"varbinary(4294967295)"},
49
- {:column=>"col_longtext", :type=>"text"},
50
- {:column=>"col_mediumblob", :type=>"varbinary(16777215)"},
51
- {:column=>"col_mediumint", :type=>"int3(9)", :default=>nil},
52
- {:column=>"col_mediumtext", :type=>"text"},
53
- {:column=>"col_smallint", :type=>"int2(6)", :default=>nil},
54
- {:column=>"col_text", :type=>"text"},
55
- {:column=>"col_time", :type=>"time", :default=>nil},
56
- {:column=>"col_timestamp", :type=>"datetime", :not_null=>true, :default=>"CURRENT_TIMESTAMP"},
57
- {:column=>"col_tinyblob", :type=>"varbinary(255)"},
58
- {:column=>"col_tinyint", :type=>"int1(4)", :default=>nil},
59
- {:column=>"col_tinytext", :type=>"text"},
60
- {:column=>"col_varbinary", :type=>"varbinary(512)", :default=>nil},
61
- {:column=>"col_varchar", :type=>"varchar(372)", :default=>nil},
62
- {:column=>"col_year", :type=>"year", :default=>nil},
63
- {:column=>"col_year_4", :type=>"year(4)", :default=>nil},
64
- {:column=>"col_year_2", :type=>"year(2)", :default=>nil},
34
+ {:column=>"id", :source_type=>"bigint(20)", :type=>"int8(20)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
35
+ {:column=>"col_binary", :source_type=>"binary(100)", :type=>"binary(202)", :default=>nil},
36
+ {:column=>"col_blob", :source_type=>"blob", :type=>"varbinary(65535)"},
37
+ {:column=>"col_bool", :source_type=>"tinyint(1)", :type=>"int1(1)", :default=>"'0'"},
38
+ {:column=>"col_char", :source_type=>"char(6)", :type=>"varchar(18)", :default=>nil},
39
+ {:column=>"col_date", :source_type=>"date", :type=>"date", :default=>nil},
40
+ {:column=>"col_datetime", :source_type=>"datetime", :type=>"datetime", :default=>nil},
41
+ {:column=>"col_decimal", :source_type=>"decimal(5,2)", :type=>"numeric(5,2)", :default=>nil},
42
+ {:column=>"col_double", :source_type=>"double", :type=>"float8", :default=>nil},
43
+ {:column=>"col_float", :source_type=>"float", :type=>"float4", :default=>nil},
44
+ {:column=>"col_float_4_2", :source_type=>"float(4,2)", :type=>"float4(4,2)", :default=>nil},
45
+ {:column=>"col_int", :source_type=>"int(11)", :type=>"int4(11)", :default=>nil},
46
+ {:column=>"col_int_6", :source_type=>"int(6)", :type=>"int4(6)", :default=>nil},
47
+ {:column=>"col_json", :source_type=>"json", :type=>"json", :default=>nil},
48
+ {:column=>"col_longblob", :source_type=>"longblob", :type=>"varbinary(4294967295)"},
49
+ {:column=>"col_longtext", :source_type=>"longtext", :type=>"text"},
50
+ {:column=>"col_mediumblob", :source_type=>"mediumblob", :type=>"varbinary(16777215)"},
51
+ {:column=>"col_mediumint", :source_type=>"mediumint(9)", :type=>"int3(9)", :default=>nil},
52
+ {:column=>"col_mediumtext", :source_type=>"mediumtext", :type=>"text"},
53
+ {:column=>"col_smallint", :source_type=>"smallint(6)", :type=>"int2(6)", :default=>nil},
54
+ {:column=>"col_text", :source_type=>"text", :type=>"text"},
55
+ {:column=>"col_time", :source_type=>"time", :type=>"time", :default=>nil},
56
+ {:column=>"col_timestamp", :source_type=>"timestamp", :type=>"datetime", :not_null=>true, :default=>"CURRENT_TIMESTAMP"},
57
+ {:column=>"col_tinyblob", :source_type=>"tinyblob", :type=>"varbinary(255)"},
58
+ {:column=>"col_tinyint", :source_type=>"tinyint(4)", :type=>"int1(4)", :default=>nil},
59
+ {:column=>"col_tinytext", :source_type=>"tinytext", :type=>"text"},
60
+ {:column=>"col_varbinary", :source_type=>"varbinary(255)", :type=>"varbinary(512)", :default=>nil},
61
+ {:column=>"col_varchar", :source_type=>"varchar(124)", :type=>"varchar(372)", :default=>nil},
62
+ {:column=>"col_year", :source_type=>"year", :type=>"year", :default=>nil},
63
+ {:column=>"col_year_4", :source_type=>"year(4)", :type=>"year(4)", :default=>nil},
64
+ {:column=>"col_year_2", :source_type=>"year(2)", :type=>"year(2)", :default=>nil},
65
65
  ]
66
66
  )
67
67
  end
@@ -164,9 +164,9 @@ describe MysqlTableDef do
164
164
  it 'comment should be set' do
165
165
  expect(subject[:columns]).to eq(
166
166
  [
167
- {:column=>"id", :type=>"int4(11)", :not_null=>true, :default=>"'0'",
167
+ {:column=>"id", :source_type=>"int(11)", :type=>"int4(11)", :not_null=>true, :default=>"'0'",
168
168
  :comment=>"this is primary key", :primary_key=>true},
169
- {:column=>"value", :type=>"text"}
169
+ {:column=>"value", :source_type=>"text", :type=>"text"}
170
170
  ]
171
171
  )
172
172
  end
@@ -176,9 +176,9 @@ describe MysqlTableDef do
176
176
  it 'comment should be set with replaced chars' do
177
177
  expect(subject[:columns]).to eq(
178
178
  [
179
- {:column=>"id", :type=>"int4(11)", :not_null=>true, :default=>"'0'",
179
+ {:column=>"id", :source_type=>"int(11)", :type=>"int4(11)", :not_null=>true, :default=>"'0'",
180
180
  :comment=>"a?2BY???i", :primary_key=>true},
181
- {:column=>"value", :type=>"text", :comment=>"あいうえお"}
181
+ {:column=>"value", :source_type=>"text", :type=>"text", :comment=>"あいうえお"}
182
182
  ]
183
183
  )
184
184
  end
@@ -190,9 +190,9 @@ describe MysqlTableDef do
190
190
  it 'multi pk should be set' do
191
191
  expect(subject[:columns]).to eq(
192
192
  [
193
- {:column=>"id1", :type=>"int4(11)", :not_null=>true, :default=>"'0'", :primary_key=>true},
194
- {:column=>"id2", :type=>"int4(11)", :not_null=>true, :default=>"'0'", :primary_key=>true},
195
- {:column=>"value", :type=>"text"}
193
+ {:column=>"id1", :source_type=>"int(11)", :type=>"int4(11)", :not_null=>true, :default=>"'0'", :primary_key=>true},
194
+ {:column=>"id2", :source_type=>"int(11)", :type=>"int4(11)", :not_null=>true, :default=>"'0'", :primary_key=>true},
195
+ {:column=>"value", :source_type=>"text", :type=>"text"}
196
196
  ]
197
197
  )
198
198
  end
@@ -203,10 +203,10 @@ describe MysqlTableDef do
203
203
  it 'enum columns should be parsed' do
204
204
  expect(subject[:columns]).to eq(
205
205
  [
206
- {:column=>"id", :type=>"int4(11)", :not_null=>true, :primary_key=>true},
207
- {:column=>"enum_1", :type=>"enum('apple','orange','banana')", :default=>nil},
208
- {:column=>"enum_2", :type=>"enum('a','b','c')", :default=>"'a'"},
209
- {:column=>"enum_3", :type=>"enum('e','f','g')", :not_null=>true},
206
+ {:column=>"id", :source_type=>"int(11)", :type=>"int4(11)", :not_null=>true, :primary_key=>true},
207
+ {:column=>"enum_1", :source_type=>"enum('apple','orange','banana')", :type=>"enum('apple','orange','banana')", :default=>nil},
208
+ {:column=>"enum_2", :source_type=>"enum('a','b','c')", :type=>"enum('a','b','c')", :default=>"'a'"},
209
+ {:column=>"enum_3", :source_type=>"enum('e','f','g')", :type=>"enum('e','f','g')", :not_null=>true},
210
210
  ]
211
211
  )
212
212
  end
@@ -217,10 +217,10 @@ describe MysqlTableDef do
217
217
  it 'should parse the dump correctly' do
218
218
  expect(subject[:columns]).to eq(
219
219
  [
220
- {:column=>"no", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
221
- {:column=>"product_category", :type=>"int4(11)", :not_null=>true},
222
- {:column=>"product_id", :type=>"int4(11)", :not_null=>true},
223
- {:column=>"customer_id", :type=>"int4(11)", :not_null=>true},
220
+ {:column=>"no", :source_type=>"int(11)", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
221
+ {:column=>"product_category", :source_type=>"int(11)", :type=>"int4(11)", :not_null=>true},
222
+ {:column=>"product_id", :source_type=>"int(11)", :type=>"int4(11)", :not_null=>true},
223
+ {:column=>"customer_id", :source_type=>"int(11)", :type=>"int4(11)", :not_null=>true},
224
224
  ]
225
225
  )
226
226
  end
@@ -231,13 +231,13 @@ describe MysqlTableDef do
231
231
  it 'should include unsigned in column type' do
232
232
  expect(subject[:columns]).to eq(
233
233
  [
234
- {:column=>"id", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
235
- {:column=>"value_int", :type=>"int4(10) unsigned", :default=>nil},
236
- {:column=>"value_float", :type=>"float4 unsigned", :default=>nil},
237
- {:column=>"value_dec", :type=>"numeric(10,2) unsigned", :default=>nil},
238
- {:column=>"value_double", :type=>"float8 unsigned", :default=>nil},
239
- {:column=>"name", :type=>"varchar(768)", :default=>nil},
240
- {:column=>"value_small_int", :type=>"int2(5) unsigned", :default=>nil}
234
+ {:column=>"id", :source_type=>"int(11)", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
235
+ {:column=>"value_int", :source_type=>"int(10)", :type=>"int4(10) unsigned", :default=>nil},
236
+ {:column=>"value_float", :source_type=>"float", :type=>"float4 unsigned", :default=>nil},
237
+ {:column=>"value_dec", :source_type=>"decimal(10,2)", :type=>"numeric(10,2) unsigned", :default=>nil},
238
+ {:column=>"value_double", :source_type=>"double", :type=>"float8 unsigned", :default=>nil},
239
+ {:column=>"name", :source_type=>"varchar(256)", :type=>"varchar(768)", :default=>nil},
240
+ {:column=>"value_small_int", :source_type=>"smallint(5)", :type=>"int2(5) unsigned", :default=>nil}
241
241
  ]
242
242
  )
243
243
  end
@@ -248,10 +248,10 @@ describe MysqlTableDef do
248
248
  it 'should include unique in column def' do
249
249
  expect(subject[:columns]).to eq(
250
250
  [
251
- {:column=>"id", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
252
- {:column=>"title", :type=>"varchar(768)", :unique=>true, :default=>nil},
253
- {:column=>"name", :type=>"text"},
254
- {:column=>"num", :type=>"int4(11)", :unique=>true, :default=>nil}
251
+ {:column=>"id", :source_type=>"int(11)", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
252
+ {:column=>"title", :source_type=>"varchar(256)", :type=>"varchar(768)", :unique=>true, :default=>nil},
253
+ {:column=>"name", :source_type=>"text", :type=>"text"},
254
+ {:column=>"num", :source_type=>"int(11)", :type=>"int4(11)", :unique=>true, :default=>nil}
255
255
  ]
256
256
  )
257
257
  end
@@ -262,10 +262,10 @@ describe MysqlTableDef do
262
262
  it 'should include unique in column def' do
263
263
  expect(subject[:columns]).to eq(
264
264
  [
265
- {:column=>"id", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
266
- {:column=>"title", :type=>"varchar(768)", :unique=>true, :default=>nil},
267
- {:column=>"name", :type=>"text"},
268
- {:column=>"num", :type=>"int4(11)", :unique=>true, :default=>nil}
265
+ {:column=>"id", :source_type=>"int(11)", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
266
+ {:column=>"title", :source_type=>"varchar(256)", :type=>"varchar(768)", :unique=>true, :default=>nil},
267
+ {:column=>"name", :source_type=>"text", :type=>"text"},
268
+ {:column=>"num", :source_type=>"int(11)", :type=>"int4(11)", :unique=>true, :default=>nil}
269
269
  ]
270
270
  )
271
271
  end
@@ -314,10 +314,10 @@ describe MysqlTableDef do
314
314
  it 'should not include unique in column def' do
315
315
  expect(subject[:columns]).to eq(
316
316
  [
317
- {:column=>"id", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true },
318
- {:column=>"title", :type=>"varchar(768)", :default=>nil , :comment=>"This column is not unique column."},
319
- {:column=>"name", :type=>"text"},
320
- {:column=>"num", :type=>"int4(11)", :default=>nil}
317
+ {:column=>"id", :source_type=>"int(11)", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true },
318
+ {:column=>"title", :source_type=>"varchar(256)", :type=>"varchar(768)", :default=>nil , :comment=>"This column is not unique column."},
319
+ {:column=>"name", :source_type=>"text", :type=>"text"},
320
+ {:column=>"num", :source_type=>"int(11)", :type=>"int4(11)", :default=>nil}
321
321
  ]
322
322
  )
323
323
  end
@@ -328,10 +328,10 @@ describe MysqlTableDef do
328
328
  it 'should not include AUTO_INCREMENT in column def' do
329
329
  expect(subject[:columns]).to eq(
330
330
  [
331
- {:column=>"id", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true },
332
- {:column=>"title", :type=>"varchar(768)", :default=>nil , :comment=>"This column is not AUTO_INCREMENT column."},
333
- {:column=>"name", :type=>"text"},
334
- {:column=>"num", :type=>"int4(11)", :default=>nil}
331
+ {:column=>"id", :source_type=>"int(11)", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true },
332
+ {:column=>"title", :source_type=>"varchar(256)", :type=>"varchar(768)", :default=>nil , :comment=>"This column is not AUTO_INCREMENT column."},
333
+ {:column=>"name", :source_type=>"text", :type=>"text"},
334
+ {:column=>"num", :source_type=>"int(11)", :type=>"int4(11)", :default=>nil}
335
335
  ]
336
336
  )
337
337
  end
@@ -342,10 +342,10 @@ describe MysqlTableDef do
342
342
  it 'should not include unsigned in column def' do
343
343
  expect(subject[:columns]).to eq(
344
344
  [
345
- {:column=>"id", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true },
346
- {:column=>"title", :type=>"varchar(768)", :default=>nil , :comment=>"This column is not unsigned column."},
347
- {:column=>"name", :type=>"text"},
348
- {:column=>"num", :type=>"int4(11)", :default=>nil}
345
+ {:column=>"id", :source_type=>"int(11)", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true },
346
+ {:column=>"title", :source_type=>"varchar(256)", :type=>"varchar(768)", :default=>nil , :comment=>"This column is not unsigned column."},
347
+ {:column=>"name", :source_type=>"text", :type=>"text"},
348
+ {:column=>"num", :source_type=>"int(11)", :type=>"int4(11)", :default=>nil}
349
349
  ]
350
350
  )
351
351
  end
@@ -357,10 +357,10 @@ describe MysqlTableDef do
357
357
  it 'should not include not null in column def' do
358
358
  expect(subject[:columns]).to eq(
359
359
  [
360
- {:column=>"id", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true },
361
- {:column=>"title", :type=>"varchar(768)", :default=>nil , :comment=>"This column is not null column."},
362
- {:column=>"name", :type=>"text"},
363
- {:column=>"num", :type=>"int4(11)", :default=>nil}
360
+ {:column=>"id", :source_type=>"int(11)", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true },
361
+ {:column=>"title", :source_type=>"varchar(256)", :type=>"varchar(768)", :default=>nil , :comment=>"This column is not null column."},
362
+ {:column=>"name", :source_type=>"text", :type=>"text"},
363
+ {:column=>"num", :source_type=>"int(11)", :type=>"int4(11)", :default=>nil}
364
364
  ]
365
365
  )
366
366
  end
@@ -538,6 +538,7 @@ describe MysqlTableDef do
538
538
  let(:query) { " `#{colname}` text," }
539
539
  let(:expected_result) {
540
540
  { column: colname,
541
+ source_type: 'text',
541
542
  type: 'text',
542
543
  }
543
544
  }
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.8.7
4
+ version: 0.8.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi Fujikawa
@@ -9,10 +9,11 @@ authors:
9
9
  - Matthew Luu
10
10
  - Mak Inada
11
11
  - Sriram NS
12
+ - Chie Inada
12
13
  autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
- date: 2017-03-24 00:00:00.000000000 Z
16
+ date: 2017-03-25 00:00:00.000000000 Z
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency
18
19
  name: rest-client