Skip to content

Commit a9539bb

Browse files
authored
fail process on invalid sql (#25)
* fail process on invalid sql * let copilot fix the test 😬
1 parent 570ac9d commit a9539bb

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

PgCodeGen.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class PgCodeGen private (
245245

246246
def run(): Future[List[File]] =
247247
for
248-
_ <- Future {
248+
_ <- Future.fromTry {
249249
if debug then println("Running migrations...")
250250

251251
Zone:

test.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,17 @@ docker run --rm --name codegentest -e POSTGRES_PASSWORD=postgres -p 5555:5432 -d
9090
-force=true && echo "✅ Code generation for provided connection ok.") || (docker rm -f codegentest; exit 1)
9191

9292
docker rm -f codegentest
93+
94+
echo "⏳Process should fail on running invalid sql"
95+
if $CODEGEN_BIN \
96+
-use-docker-image=postgres:17-alpine \
97+
-output-dir=test-generated \
98+
-pkg-name=generated \
99+
-exclude-tables=unsupported_yet \
100+
-source-dir=test/migrations_invalid \
101+
-force=true; then
102+
echo "❌ Process did not fail as expected"
103+
exit 1
104+
else
105+
echo "✅ Process failed as expected"
106+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
syntax error;

0 commit comments

Comments
 (0)