forked from Brendonovich/prisma-engines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
273 lines (190 loc) Β· 7.66 KB
/
Makefile
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
CONFIG_PATH = ./query-engine/connector-test-kit-rs/test-configs
CONFIG_FILE = .test_config
SCHEMA_EXAMPLES_PATH = ./query-engine/example_schemas
DEV_SCHEMA_FILE = dev_datamodel.prisma
LIBRARY_EXT := $(shell \
case "$$(uname -s)" in \
(Darwin) echo "dylib" ;; \
(MINGW*|MSYS*|CYGWIN*) echo "dll" ;; \
(*) echo "so" ;; \
esac)
default: build
#####################
# Boostrap commands #
#####################
bootstrap-darwin:
script/bootstrap-darwin
##################
# Build commands #
##################
build:
cargo build
# Emulate pedantic CI compilation.
pedantic:
RUSTFLAGS="-D warnings" cargo fmt -- --check && RUSTFLAGS="-D warnings" cargo clippy --all-targets
release:
cargo build --release
#################
# Test commands #
#################
test-qe:
cargo test --package query-engine-tests
test-qe-verbose:
cargo test --package query-engine-tests -- --nocapture
# Single threaded thread execution.
test-qe-st:
cargo test --package query-engine-tests -- --test-threads 1
# Single threaded thread execution, verbose.
test-qe-verbose-st:
cargo test --package query-engine-tests -- --nocapture --test-threads 1
###########################
# Database setup commands #
###########################
all-dbs-up:
docker compose -f docker-compose.yml up -d --remove-orphans
all-dbs-down:
docker compose -f docker-compose.yml down -v --remove-orphans
start-sqlite:
dev-sqlite:
cp $(CONFIG_PATH)/sqlite $(CONFIG_FILE)
start-postgres9:
docker compose -f docker-compose.yml up -d --remove-orphans postgres9
dev-postgres9: start-postgres9
cp $(CONFIG_PATH)/postgres9 $(CONFIG_FILE)
start-postgres10:
docker compose -f docker-compose.yml up -d --remove-orphans postgres10
dev-postgres10: start-postgres10
cp $(CONFIG_PATH)/postgres10 $(CONFIG_FILE)
start-postgres11:
docker compose -f docker-compose.yml up -d --remove-orphans postgres11
dev-postgres11: start-postgres11
cp $(CONFIG_PATH)/postgres11 $(CONFIG_FILE)
start-postgres12:
docker compose -f docker-compose.yml up -d --remove-orphans postgres12
dev-postgres12: start-postgres12
cp $(CONFIG_PATH)/postgres12 $(CONFIG_FILE)
start-postgres13:
docker compose -f docker-compose.yml up -d --remove-orphans postgres13
dev-postgres13: start-postgres13
cp $(CONFIG_PATH)/postgres13 $(CONFIG_FILE)
start-postgres14:
docker compose -f docker-compose.yml up -d --remove-orphans postgres14
dev-postgres14: start-postgres14
cp $(CONFIG_PATH)/postgres14 $(CONFIG_FILE)
start-postgres15:
docker compose -f docker-compose.yml up -d --remove-orphans postgres15
dev-postgres15: start-postgres15
cp $(CONFIG_PATH)/postgres15 $(CONFIG_FILE)
start-cockroach_22_2:
docker compose -f docker-compose.yml up -d --remove-orphans cockroach_22_2
dev-cockroach_22_2: start-cockroach_22_2
cp $(CONFIG_PATH)/cockroach_22_2 $(CONFIG_FILE)
start-cockroach_22_1_0:
docker compose -f docker-compose.yml up -d --remove-orphans cockroach_22_1_0
dev-cockroach_22_1_0: start-cockroach_22_1_0
cp $(CONFIG_PATH)/cockroach_22_1 $(CONFIG_FILE)
start-cockroach_21_2_0_patched:
docker compose -f docker-compose.yml up -d --remove-orphans cockroach_21_2_0_patched
dev-cockroach_21_2_0_patched: start-cockroach_21_2_0_patched
cp $(CONFIG_PATH)/cockroach_21_2_0_patched $(CONFIG_FILE)
dev-pgbouncer:
docker compose -f docker-compose.yml up -d --remove-orphans pgbouncer postgres11
start-mysql_5_7:
docker compose -f docker-compose.yml up -d --remove-orphans mysql-5-7
dev-mysql: start-mysql_5_7
cp $(CONFIG_PATH)/mysql57 $(CONFIG_FILE)
start-mysql_5_6:
docker compose -f docker-compose.yml up -d --remove-orphans mysql-5-6
dev-mysql_5_6: start-mysql_5_6
cp $(CONFIG_PATH)/mysql56 $(CONFIG_FILE)
start-mysql_8:
docker compose -f docker-compose.yml up -d --remove-orphans mysql-8-0
dev-mysql8: start-mysql_8
cp $(CONFIG_PATH)/mysql8 $(CONFIG_FILE)
start-mysql_mariadb:
docker compose -f docker-compose.yml up -d --remove-orphans mariadb-10-0
dev-mariadb: start-mysql_mariadb
cp $(CONFIG_PATH)/mariadb $(CONFIG_FILE)
start-mssql_2019:
docker compose -f docker-compose.yml up -d --remove-orphans mssql-2019
dev-mssql2019: start-mssql_2019
cp $(CONFIG_PATH)/sqlserver2019 $(CONFIG_FILE)
start-mssql_2022:
docker compose -f docker-compose.yml up -d --remove-orphans mssql-2022
dev-mssql2022: start-mssql_2022
cp $(CONFIG_PATH)/sqlserver2022 $(CONFIG_FILE)
start-mssql_edge:
docker compose -f docker-compose.yml up -d --remove-orphans azure-edge
dev-mssql_edge: start-mssql_edge
cp $(CONFIG_PATH)/sqlserver2019 $(CONFIG_FILE)
start-mssql_2017:
docker compose -f docker-compose.yml up -d --remove-orphans mssql-2017
dev-mssql2017: start-mssql_2017
cp $(CONFIG_PATH)/sqlserver2017 $(CONFIG_FILE)
start-mongodb42-single:
docker compose -f docker-compose.yml up -d --remove-orphans mongo42-single
start-mongodb44-single:
docker compose -f docker-compose.yml up -d --remove-orphans mongo44-single
start-mongodb4-single: start-mongodb44-single
start-mongodb5-single:
docker compose -f docker-compose.yml up -d --remove-orphans mongo5-single
start-mongodb_4_2:
docker compose -f docker-compose.yml up -d --remove-orphans mongo42
start-mongodb_4_4:
docker compose -f docker-compose.yml up -d --remove-orphans mongo44
dev-mongodb_4_4: start-mongodb_4_4
cp $(CONFIG_PATH)/mongodb44 $(CONFIG_FILE)
start-mongodb_5:
docker compose -f docker-compose.yml up -d --remove-orphans mongo5
dev-mongodb_5: start-mongodb_5
cp $(CONFIG_PATH)/mongodb5 $(CONFIG_FILE)
dev-mongodb_4_2: start-mongodb_4_2
cp $(CONFIG_PATH)/mongodb42 $(CONFIG_FILE)
start-vitess_5_7:
docker compose -f docker-compose.yml up -d --remove-orphans vitess-test-5_7 vitess-shadow-5_7
dev-vitess_5_7: start-vitess_5_7
cp $(CONFIG_PATH)/vitess_5_7 $(CONFIG_FILE)
start-vitess_8_0:
docker compose -f docker-compose.yml up -d --remove-orphans vitess-test-8_0 vitess-shadow-8_0
dev-vitess_8_0: start-vitess_8_0
cp $(CONFIG_PATH)/vitess_8_0 $(CONFIG_FILE)
######################
# Local dev commands #
######################
# Quick schema validation of whatever you have in the dev_datamodel.prisma file.
validate:
cargo run --bin test-cli -- validate-datamodel dev_datamodel.prisma
qe:
cargo run --bin query-engine -- --enable-playground --enable-raw-queries --enable-metrics --enable-open-telemetry --enable-telemetry-in-response
qe-dmmf:
cargo run --bin query-engine -- cli dmmf > dmmf.json
push-schema:
cargo run --bin test-cli -- schema-push $(DEV_SCHEMA_FILE) --force
qe-dev-chinook-sqlite:
cp $(SCHEMA_EXAMPLES_PATH)/chinook_sqlite.prisma $(DEV_SCHEMA_FILE)
qe-dev-chinook-postgres10: start-postgres10
cp $(SCHEMA_EXAMPLES_PATH)/chinook_postgres10.prisma $(DEV_SCHEMA_FILE)
sleep 5
make push-schema
qe-dev-mongo_4_4: start-mongodb_4_4
cp $(SCHEMA_EXAMPLES_PATH)/generic_mongo4.prisma $(DEV_SCHEMA_FILE)
use-local-migration-engine:
cargo build --release
cp target/release/migration-engine $(PRISMA2_BINARY_PATH)/
use-local-query-engine:
cargo build --release
cp target/release/query-engine $(PRISMA2_BINARY_PATH)/runtime/
cp target/release/query-engine $(PRISMA2_BINARY_PATH)/query-engine-darwin
show-metrics:
docker compose -f docker-compose.yml up -d --remove-orphans grafana prometheus
## OpenTelemetry
otel:
docker compose up --remove-orphans -d otel
# Build the debug version of Query Engine Node-API library ready to be consumed by Node.js
.PHONY: qe-node-api
qe-node-api: build target/debug/libquery_engine.node
%.node: %.$(LIBRARY_EXT)
# Remove the file first to work around a macOS bug: https://openradar.appspot.com/FB8914243
# otherwise macOS gatekeeper may kill the Node.js process when it tries to load the library
if [[ "$$(uname -sm)" == "Darwin arm64" ]]; then rm -f $@; fi
cp $< $@