Closed Rwatana closed 1 month ago
@nayuta-ai Please review my code.
@nayuta-ai I think I have modified the points. Please check my code.
@nayuta-ai
I thought I had made the changes to the makefile
, but I am not sure if it was completed completely, but I thought I had made the changes. If it is not sufficient, I would like to ask again.
Please check my code.
@nayuta-ai
I have left the .env
line in the .dockerignore
file and added the MySQL environment information to the Makefile to sustain the moveable code. Please check my code.
added the MySQL environment information to the Makefile to sustain the moveable code.
Why do you need to do this? Please include examples of cases where this has been implemented unsuccessfully.
The Makefile includes the following targets:
migrate_up:
migrate -path internal/server/infrastructure/mysql/db/schema -database "mysql://root:$(MYSQL_ROOT_PASSWORD)@tcp(localhost:3306)/${MYSQL_DATABASE}" up
migrate_down:
migrate -path internal/server/infrastructure/mysql/db/schema -database "mysql://root:$(MYSQL_ROOT_PASSWORD)@tcp(localhost:3306)/${MYSQL_DATABASE}" down
exec_db:
docker compose exec db mysql -u root -p$(MYSQL_ROOT_PASSWORD) ${MYSQL_DATABASE}
Therefore, I think it’s necessary to include the environment variables used in these commands. Since I removed the loading of the .env
file, I believe these commands will no longer work.
If I don't do that change, I think errors will occur when executing the above commands in the local environment.
➜ log_service git:(feature/#19_Setup_Docker_for_sqlc_and_gomock) make migrate_up
migrate -path internal/server/infrastructure/mysql/db/schema -database "mysql://root:@tcp(localhost:3306)/" up
error: failed to open database, "mysql://root:@tcp(localhost:3306)/": Error 1045: Access denied for user 'root'@'192.168.32.1' (using password: NO)
make: *** [migrate_up] Error 1
➜ log_service git:(feature/#19_Setup_Docker_for_sqlc_and_gomock) ✗
Did you load the .env
file?
It can execute as below.
$ make migrate_up
migrate -path internal/server/infrastructure/mysql/db/schema -database "mysql://root:password@tcp(localhost:3306)/example" up
no change
@nayuta-ai I misunderstood the mechanism of operation. I apologize for the inconvenience. I have made corrections, so please check my code.
@nayuta-ai I have incorporated the sentence as per your suggestion and confirmed that it works properly. Please review my code.
Issue Number
19
Implementation Summary
This pull request implements the execution of
sqlc
andmockgen
commands within a Docker container. This change ensures that code generation and mocking are done in a consistent environment, reducing the risk of version mismatches across different development setups.Scope of Impact
make docker-generate-mock
is run.Particular Points to Check
Test
1
make docker-generate-mock
Schedule
10/13