Skip to content

Commit

Permalink
commands to seed db
Browse files Browse the repository at this point in the history
  • Loading branch information
kamsandhu93 committed May 31, 2023
1 parent 1e50293 commit 782e4f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ tidy:

up:
$(DOC_COM) up -d --build --wait
sleep 1
make seed-db

up-db:
$(DOC_COM) up -d --wait db phpmyadmin
sleep 1
make seed-db

down:
$(DOC_COM) down --remove-orphans
Expand Down Expand Up @@ -55,3 +59,6 @@ ci-checks: fmt tidy lint build test vet
(echo; echo "Unexpected difference in directories after code goimports and go mod tidy. Run the 'make fmt' and 'make tidy' commands then commit."; exit 1)
@echo "All checks passed \U0001F44D"

seed-db:
docker exec gqldenring-db-1 bash -c "mysql -pqwerty db < /seed.sql"

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
networks:
- "internal"
volumes:
- "database_mysql:/var/lib/mysql"
- "./db/sql/weapons.sql:/seed.sql"

phpmyadmin:
platform: linux/x86_64
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func main() {
srv := handler.NewDefaultServer(generated.NewExecutableSchema(generated.Config{Resolvers: resolver}))
srv.AroundOperations(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler {
oc := graphql.GetOperationContext(ctx)
log.Printf("[INFO] Incoming operation: %s %s", oc.OperationName, strings.Replace(oc.RawQuery, "\n", " ", -1))
log.Printf("[INFO] Incoming operation: %s %s %s", oc.OperationName, oc.Variables, strings.Replace(oc.RawQuery, "\n", " ", -1))
return next(ctx)
})

Expand Down

0 comments on commit 782e4f6

Please sign in to comment.