lib/embulk/input/zendesk/plugin.rb in embulk-input-zendesk-0.1.11 vs lib/embulk/input/zendesk/plugin.rb in embulk-input-zendesk-0.1.12

- old
+ new

@@ -55,11 +55,16 @@ # https://github.com/embulk/embulk/issues/379 # This is workaround for that if records.any? {|r| [Array, Hash].include?(r[hash[:name]].class) } hash[:type] = :json end - if hash[:name].match(/_id$/) - # NOTE: sometimes *_id will be guessed as timestamp format:%d%m%Y (e.g. 21031998), all *_id columns should be type:long + + case hash[:name] + when /_id$/ + # NOTE: sometimes *_id will be guessed as timestamp format:%d%m%Y (e.g. 21031998), all *_id columns should be type:string + hash[:type] = :string + hash.delete(:format) # has it if type:timestamp + when "id" hash[:type] = :long hash.delete(:format) # has it if type:timestamp end hash