Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
Use current boiler generation method
Browse files Browse the repository at this point in the history
  • Loading branch information
zdevaty committed Jun 26, 2024
1 parent 2489034 commit bbaac32
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
19 changes: 19 additions & 0 deletions generate-db.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql@latest
go get github.com/volatiletech/sqlboiler/v4
go get github.com/volatiletech/null/v8

docker run -d ^
--name "app_sql_boiler_code_generation" ^
-e "POSTGRES_PASSWORD=secret" ^
-p "6001:5432" ^
-v "%cd%"\conf\init.sql:/docker-entrypoint-initdb.d/init.sql ^
debezium/postgres:12 > NUL

timeout /t 5

sqlboiler psql ^
-c sqlboiler.toml ^
--wipe --no-tests

docker stop "app_sql_boiler_code_generation" > NUL

docker logs "app_sql_boiler_code_generation" 2>&1 | findstr "ERROR" || (
echo All good.
)

docker rm "app_sql_boiler_code_generation" > NUL

go mod tidy
18 changes: 18 additions & 0 deletions generate-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,26 @@ go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql@latest
go get github.com/volatiletech/sqlboiler/v4
go get github.com/volatiletech/null/v8

docker run -d \
--name "app_sql_boiler_code_generation" \
--platform "linux/amd64" \
-e "POSTGRES_PASSWORD=secret" \
-p "6001:5432" \
-v "${PWD}/conf/init.sql:/docker-entrypoint-initdb.d/init.sql" \
debezium/postgres:12

sleep 5

sqlboiler psql \
-c sqlboiler.toml \
--wipe --no-tests

docker stop "app_sql_boiler_code_generation" > /dev/null

docker logs "app_sql_boiler_code_generation" 2>&1 | grep "ERROR" || {
echo "All good."
}

docker rm "app_sql_boiler_code_generation" > /dev/null

go mod tidy
8 changes: 4 additions & 4 deletions sqlboiler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ no-tests = true
add-enum-types = true

[psql]
dbname = "iot"
dbname = "postgres"
host = "localhost"
port = 5433
user = "leicom"
pass = ".test"
port = 6001
user = "postgres"
pass = "secret"
schema = "saml_sp"
sslmode = "disable"

Expand Down

0 comments on commit bbaac32

Please sign in to comment.