Skip to content

Commit 11872d1

Browse files
committed
scripts: use sed to work around sqlc LEFT JOIN issue
In this commit, we modify the main script that we use to run the `sqlc` code generation to also replace the two fields that need to be `sql.NullInt32` for the LEFT JOIN compilation to work. Can be removed once this issue is fixed: sqlc-dev/sqlc#1334
1 parent c3bffba commit 11872d1

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ tarod-debug
1818
# Output of the go coverage tool, specifically when used with LiteIDE
1919
*.out
2020

21+
# Sed backup files.
22+
*.bak
23+
2124
# Dependency directories (remove the comment below to include it)
2225
# vendor/

‎scripts/gen_sqlc_docker.sh‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@ docker run \
1717
-v "$DIR/../:/build" \
1818
-w /build \
1919
kjconroy/sqlc:1.14.0 generate
20+
21+
# Until https://github.com/kyleconroy/sqlc/issues/1334 is fixed, we need to
22+
# manually modify some types so LEFT JOIN queries compile properly.
23+
echo "Fixing LEFT JOIN issue..."
24+
sed -i.bak -E 's/FamKeyFamily([[:space:]])+int32/FamKeyFamily\1sql.NullInt32/g' tarodb/sqlite/assets.sql.go
25+
sed -i.bak -E 's/FamKeyIndex([[:space:]])+int32/FamKeyIndex\1sql.NullInt32/g' tarodb/sqlite/assets.sql.go
26+
27+
echo "Reformatting modified files.."
28+
go fmt tarodb/sqlite/assets.sql.go

0 commit comments

Comments
 (0)