-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
48 lines (35 loc) · 1.6 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
MIGRATION_DIR := test/db
MIGRATION_SCRIPTS := $(foreach dir, $(MIGRATION_DIR), $(wildcard $(dir)/*))
tests: test/test.db \
test/generated/generic/objects.go \
test/generated/sqlite/objects.go \
test/generated/mysql/objects.go \
test/generated/postgres/objects.go \
sqlc/fields.go \
sqlc/schema.go
go run test/migrate_db.go
go test -v ./...
test/test.db: test/migration_steps.go
go run test/migrate_db.go
test/generated/mysql:
mkdir -p $@
test/generated/sqlite:
mkdir -p $@
test/generated/generic:
mkdir -p $@
test/generated/postgres:
mkdir -p $@
test/generated/generic/objects.go: sqlc/schema.go test/test.db test/migration_steps.go test/generated/generic main.go
go run main.go -p generic -o $@ -f test/test.db -t sqlite
test/generated/sqlite/objects.go: sqlc/schema.go test/test.db test/migration_steps.go test/generated/sqlite main.go
go run main.go -p sqlite -o $@ -f test/test.db -t sqlite
test/generated/mysql/objects.go: sqlc/schema.go test/migration_steps.go test/generated/mysql main.go
go run main.go -p mysql -o $@ -u "sqlc:sqlc@/sqlc" -t mysql -s sqlc
test/generated/postgres/objects.go: sqlc/schema.go test/migration_steps.go test/generated/postgres main.go
go run main.go -p postgres -o $@ -u "postgres://sqlc:sqlc@localhost/sqlc?sslmode=disable" -t postgres -s public
sqlc/fields.go: sqlc/tmpl/fields.tmpl sqlc/field_generator.go meta/types.go
go run sqlc/field_generator.go
sqlc/schema.go: sqlc/fields.go sqlc/tmpl/schema.tmpl
go-bindata -pkg=sqlc -o=$@ sqlc/tmpl
test/migration_steps.go: $(MIGRATION_SCRIPTS)
go-bindata -pkg=test -o=$@ test/db/mysql test/db/sqlite test/db/postgres