-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
90 lines (84 loc) · 2.73 KB
/
Taskfile.yml
File metadata and controls
90 lines (84 loc) · 2.73 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
version: "3"
vars:
URI: "mongodb://user:pass@localhost:2717/?authSource=admin"
RESULTS_DIR: results
BIN: "{{.ROOT_DIR}}/target/debug/mongo2pg"
DATABASES: >-
sample_airbnb
sample_analytics
sample_geospatial
sample_mflix
sample_supplies
sample_training
sample_weatherdata
retail
tasks:
build:
desc: Build the mongo2pg binary (debug)
cmds:
- cargo build
sources:
- src/**/*.rs
- Cargo.toml
- Cargo.lock
generates:
- target/debug/mongo2pg
infer:
desc: Infer schemas for all sample databases, generate SQL DDL into {{.RESULTS_DIR}}/infer/
silent: true
deps: [build]
vars:
OUT: "{{.RESULTS_DIR}}/infer"
cmds:
- mkdir -p "{{.OUT}}"
- |
for db in {{.DATABASES}}
do
echo "📁 init $db"
"{{.BIN}}" init --project-base "{{.OUT}}" --project-name "$db" --uri "{{.URI}}"
echo "📐 infer $db"
"{{.BIN}}" infer --uri "{{.URI}}" -c "{{.OUT}}/$db/config/$db.conf" --no-output 2>/dev/null
echo "🛠️ to-pg $db"
"{{.BIN}}" to-pg -c "{{.OUT}}/$db/config/$db.conf"
echo "📊 report"
"{{.BIN}}" report -c "{{.OUT}}/$db/config/$db.conf"
done
- echo "👉 results in {{.OUT}}"
infer-with-jsonb:
desc: Infer schemas with --jsonb 🪆, generate SQL DDL and HTML report into {{.RESULTS_DIR}}/infer-with-jsonb/
silent: true
deps: [build]
vars:
OUT: "{{.RESULTS_DIR}}/infer-with-jsonb"
cmds:
- mkdir -p "{{.OUT}}"
- |
for db in {{.DATABASES}}
do
echo "📁 init $db"
"{{.BIN}}" init --project-base "{{.OUT}}" --project-name "$db" --uri "{{.URI}}"
echo "📐 infer $db"
"{{.BIN}}" infer --uri "{{.URI}}" -c "{{.OUT}}/$db/config/$db.conf" --jsonb --no-output 2>/dev/null
echo "🛠️ to-pg $db"
"{{.BIN}}" to-pg -c "{{.OUT}}/$db/config/$db.conf"
echo "📊 report"
"{{.BIN}}" report -c "{{.OUT}}/$db/config/$db.conf"
done
- echo "👉 results in {{.OUT}}"
make-tutorial:
desc: Create tutorial schemas
silent: true
deps: [build]
vars:
OUT: "tutorial/base"
DB: "retail"
cmds:
- |
echo "📁 init {{.DB}}"
"{{.BIN}}" init --project-base "{{.OUT}}" --project-name "{{.DB}}" --uri "{{.URI}}"
echo "📐 infer {{.DB}}"
"{{.BIN}}" infer --uri "{{.URI}}" -c "{{.OUT}}/{{.DB}}/config/{{.DB}}.conf" --jsonb --no-output 2>/dev/null
echo "🛠️ to-pg {{.DB}}"
"{{.BIN}}" to-pg -c "{{.OUT}}/{{.DB}}/config/{{.DB}}.conf"
echo "📊 report"
"{{.BIN}}" report -c "{{.OUT}}/{{.DB}}/config/{{.DB}}.conf"