Commit eb586c7f authored by Micaël Bergeron's avatar Micaël Bergeron

remove mapping keys for join tables

parent fbfb7138
...@@ -21,12 +21,12 @@ module Pseudonymizer ...@@ -21,12 +21,12 @@ module Pseudonymizer
tables = config[:tables] tables = config[:tables]
FileUtils.mkdir_p(output_dir) unless File.directory?(output_dir) FileUtils.mkdir_p(output_dir) unless File.directory?(output_dir)
schema_to_yml
@output_files = tables.map do |k, v| @output_files = tables.map do |k, v|
table_to_csv(k, v[:whitelist], v[:pseudo]) table_to_csv(k, v[:whitelist], v[:pseudo])
end.compact end.compact
schema_to_yml
file_list_to_json file_list_to_json
@output_files @output_files
end end
...@@ -96,12 +96,16 @@ module Pseudonymizer ...@@ -96,12 +96,16 @@ module Pseudonymizer
end end
def set_schema_column_types(table, type_results) def set_schema_column_types(table, type_results)
has_id = type_results.any? {|c| c[:name] == "id" }
type_results.each do |type_result| type_results.each do |type_result|
@schema[table][type_result[:name]] = type_result[:data_type] @schema[table.to_s][type_result[:name]] = type_result[:data_type]
end end
# hard coded because all mapping keys in GL are id if has_id
@schema[table]["gl_mapping_key"] = "id" # if there is an ID, it is the mapping_key
@schema[table.to_s]["gl_mapping_key"] = "id"
end
end end
def write_to_csv_file(table, contents) def write_to_csv_file(table, contents)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment