sunitparekh/data-anonymization

View on GitHub
lib/thor/templates/whitelist_template.erb

Summary

Maintainability
Test Coverage
require 'data-anonymization'

DataAnon::Utils::Logging.logger.level = Logger::INFO

database 'Template' do

  strategy DataAnon::Strategy::Whitelist
  source_db <%= DataAnon::Utils::TemplateHelper.source_connection_specs_rdbms @configuration_hash %>
  destination_db <%= DataAnon::Utils::TemplateHelper.destination_connection_specs_rdbms @configuration_hash %>

  <% @tables.each do |table| %>
  table '<%= table %>' do
    primary_key '<%= @ar_object.connection.primary_key("#{table}").nil? ? "<No primary key found. Possible composite key. Please enter the value>" : @ar_object.connection.primary_key("#{table}") %>'
    <%- @ar_object.connection.indexes("#{table}").each do |index| -%>
    whitelist '<%= index.columns.first %>'
    <%- end -%>
  end
  <% end %>

end