Skip to content

Commit 95e16ac

Browse files
committed
Fix CI issues for MySQL and MSSQL
- MySQL: Don't include -p flag when password is empty - MSSQL: Use mssql-tools18 path with -C flag for newer images
1 parent 5bf3141 commit 95e16ac

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

.github/workflows/example.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,17 @@ jobs:
142142
143143
# Wait for MSSQL to be ready
144144
for i in {1..60}; do
145-
if docker exec $(docker compose ps -q mssql) /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "SELECT 1" >/dev/null 2>&1; then
145+
# Try both old and new sqlcmd paths for compatibility
146+
if docker exec $(docker compose ps -q mssql) /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "SELECT 1" -C >/dev/null 2>&1 || \
147+
docker exec $(docker compose ps -q mssql) /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "SELECT 1" >/dev/null 2>&1; then
146148
echo "MSSQL is ready"
147149
break
148150
fi
149151
echo "Waiting for MSSQL..."
150152
sleep 3
151153
done
152-
# Create the test database
154+
# Create the test database (try both paths)
155+
docker exec $(docker compose ps -q mssql) /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "CREATE DATABASE testdb;" -C || \
153156
docker exec $(docker compose ps -q mssql) /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "CREATE DATABASE testdb;"
154157
155158
- name: Preview MSSQL schema changes

dist/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ function getCommandConfig(command) {
126126
config.args.push("-h", host, "-P", port);
127127
if (user)
128128
config.args.push("-u", user);
129-
// Always include -p with the password value (even if empty)
130-
// mysqldef accepts -p with empty string for passwordless connections
131-
config.args.push(`-p${password}`);
129+
// Only include -p if password is not empty
130+
// Empty password means no authentication needed
131+
if (password && password.trim() !== "") {
132+
config.args.push(`-p${password}`);
133+
}
132134
if (database)
133135
config.args.push(database);
134136
break;

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ function getCommandConfig(command: string): CommandConfig {
100100

101101
config.args.push("-h", host, "-P", port);
102102
if (user) config.args.push("-u", user);
103-
// Always include -p with the password value (even if empty)
104-
// mysqldef accepts -p with empty string for passwordless connections
105-
config.args.push(`-p${password}`);
103+
// Only include -p if password is not empty
104+
// Empty password means no authentication needed
105+
if (password && password.trim() !== "") {
106+
config.args.push(`-p${password}`);
107+
}
106108
if (database) config.args.push(database);
107109
break;
108110
}

0 commit comments

Comments
 (0)