Skip to content

Conversation

@gfx
Copy link
Collaborator

@gfx gfx commented Sep 24, 2025

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 24, 2025

SQLDef Migration Preview

-- Apply --
BEGIN;
ALTER TABLE `users` ADD COLUMN `email` varchar(255) NULL AFTER `username`;
CREATE INDEX idx_users_email ON users(email);
COMMIT;

This comment was created by sqldef-preview-action.

@gfx gfx changed the title Example Fix examples Sep 24, 2025
@gfx gfx changed the title Fix examples Implement examples Sep 24, 2025
gfx added 20 commits September 24, 2025 10:11
- When version is 'latest', use /releases/latest/download/ URL path
- Otherwise use standard /releases/download/{version}/ path
- Update example workflow to use 'latest' for all databases
- Fix getSchemaFromBranch to handle missing files in base branch gracefully
- Use empty baseline schema when file doesn't exist in main branch
- Update MSSQL to stable 2019-CU32-ubuntu-20.04 version (used for sqldef development)
- Fix sqlcmd paths for MSSQL 2019 version
- Rebuild dist/index.js with all fixes
- Handle missing schema files in base branch gracefully
- Skip baseline application when no baseline schema exists
- Return empty string instead of creating empty file for missing schemas
- Only clean up temp files that actually exist
The CI tests create their own schema.sql files dynamically.
Having this file in the branch causes conflicts during testing.
- Correctly capture exit code from exec.exec with ignoreReturnCode
- Remove unnecessary .catch() that was never triggered
- This fixes CI tests to properly detect missing baseline schemas
- Add baseline schemas for all database tests
- Use baseline-schema-file parameter to enable comparison mode
- Skip PR comment posting when baseline file is explicitly provided
- Fix SQLite schema syntax (remove IF NOT EXISTS, use TEXT for timestamps)
- Add MSSQL test workflow with 2019 version
- Tests now properly compare baseline vs desired schemas
SQLite doesn't support DEFAULT CURRENT_TIMESTAMP with TEXT columns
sqlite3def may need the database file to exist
- Run --version check after downloading sqldef binary to ensure it works
- Update MSSQL Docker image from 2019-CU32 to 2022-latest
- Update sqlcmd paths from /opt/mssql-tools to /opt/mssql-tools18
- Add -No flag to sqlcmd commands for non-interactive mode
- Install mssql-tools18 package in CI workflows
These tests are already covered by example.yaml workflow
gfx added 8 commits September 24, 2025 13:29
When password is empty, don't include the -p flag at all as it causes
the commands to expect the password as the next argument, leading to
connection failures in CI.
Always include -p parameter for MySQL even with empty password.
mysqldef expects -p with empty string for passwordless connections.
- MySQL: Don't include -p flag when password is empty
- MSSQL: Use mssql-tools18 path with -C flag for newer images
- MySQL: Use MYSQL_PWD environment variable for password (handles empty passwords)
- MSSQL: Fix flag confusion - use -p for port, -P for password
- Test direct MySQL connection from host
- Log environment variables being set (masked)
- Help diagnose why mysqldef can't connect
MySQL in Docker requires TCP connection, not Unix socket. Using localhost
attempts to connect via socket, while 127.0.0.1 forces TCP connection.
MySQL with empty password seems to have connection issues in CI.
Using a test password for more reliable connections.
@gfx gfx merged commit 9fea056 into main Sep 24, 2025
5 checks passed
@gfx gfx deleted the example branch September 24, 2025 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants