-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdell_whitelist.rb
69 lines (54 loc) · 2.63 KB
/
dell_whitelist.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require 'data-anonymization'
DataAnon::Utils::Logging.logger.level = Logger::INFO
connection_spec = {:adapter => 'postgresql', :host => 'localhost', :port => 5432, :pool => 5, :username => 'developer', :password => 'password', :database => 'dell'}
database 'DellStore' do
strategy DataAnon::Strategy::Whitelist
source_db :adapter => 'postgresql', :host => 'localhost', :port => 5432, :pool => 5, :username => 'developer', :password => 'password', :database => 'dell'
destination_db :adapter => 'postgresql', :host => 'localhost', :port => 5432, :pool => 5, :username => 'developer', :password => 'password', :database => 'dell_empty'
table 'categories' do
primary_key 'category'
whitelist 'category','categoryname'
end
table 'products' do
primary_key 'prod_id'
whitelist 'prod_id','category','title','actor','price','special','common_prod_id'
end
table 'inventory' do
primary_key 'prod_id'
whitelist 'prod_id','quan_in_stock','sales'
end
table 'reorder' do
primary_key 'prod_id'
whitelist 'prod_id','date_low','quan_low','date_reordered','quan_reordered','date_expected'
end
table 'customers' do
primary_key 'customerid'
whitelist 'customerid', 'income', 'city', 'country', 'region', 'creditcardexpiration'
anonymize('firstname').using FieldStrategy::RandomString.new
anonymize('lastname').using FieldStrategy::RandomLastName.new
anonymize('address1').using FieldStrategy::RandomAddress.region_US
anonymize('address2').using FieldStrategy::RandomString.new
anonymize('state').using FieldStrategy::SelectFromDatabase.new("customers","state", connection_spec)
anonymize('zip').using FieldStrategy::RandomZipcode.region_US
anonymize('email').using FieldStrategy::RandomMailinatorEmail.new
anonymize('phone').using FieldStrategy::RandomPhoneNumber.new
anonymize('creditcardtype').using FieldStrategy::SelectFromDatabase.new("customers","creditcardtype", connection_spec)
anonymize('creditcard').using FieldStrategy::RandomPhoneNumber.new
anonymize('username').using FieldStrategy::StringTemplate.new('user#{row_number}')
anonymize('password') { |f| 'password'}
anonymize('age')
anonymize('gender').using FieldStrategy::SelectFromList.new(['M','F'])
end
table 'orders' do
primary_key 'orderid'
whitelist 'orderid','orderdate','customerid','netamount','tax','totalamount'
end
table 'orderlines' do
primary_key 'orderlineid','orderid'
whitelist 'orderlineid','orderid','prod_id','quantity','orderdate'
end
table 'cust_hist' do
primary_key 'customerid','orderid','prod_id'
whitelist 'customerid','orderid','prod_id'
end
end