forked from hellofresh/klepto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser-orders.toml
56 lines (54 loc) · 1.57 KB
/
user-orders.toml
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
[[Tables]]
Name = "users"
[Tables.Anonymise]
email = "EmailAddress"
firstName = "FirstName"
password = "SimplePassword"
[Tables.Filter]
# import the last 100 active created users
Match = "users.active = true"
Limit = 100
[Tables.Filter.Sorts]
created_at = "desc"
[[Tables]]
# Dump only orders which are related to the matching users
Name = "orders"
# Behind the scenes it will generate the following sql query:
# SELECT orders.* FROM orders
# JOIN users ON users.id = orders.user_id
# WHERE users.status = 'active'
# ORDER BY created_at DESC
[[Tables.Relationships]]
Table = "orders"
ForeignKey = "user_id"
ReferencedTable = "users"
ReferencedKey = "id"
[Tables.Filter]
Match = "users.active = true"
Limit = 100
[Tables.Filter.Sorts]
created_at = "desc"
[[Tables]]
# Dump only order items which are related to the matching users orders
Name = "order_items"
# Behind the scenes it will generate the following sql query:
# SELECT order_items.* FROM order_items
# JOIN orders ON orders.id = order_items.order_id
# JOIN users ON users.id = orders.user_id
# WHERE users.status = 'active'
# ORDER BY created_at DESC
[[Tables.Relationships]]
Table = "order_items"
ForeignKey = "order_id"
ReferencedTable = "orders"
ReferencedKey = "id"
[[Tables.Relationships]]
Table = "orders"
ForeignKey = "user_id"
ReferencedTable = "users"
ReferencedKey = "id"
[Tables.Filter]
Match = "users.active = true"
Limit = 100
[Tables.Filter.Sorts]
created_at = "desc"