-
Notifications
You must be signed in to change notification settings - Fork 0
Implement examples #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
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. |
- 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
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.