fix(v4): MySQL/MSSQL migration bugs found - #1776
Merged
Merged
Conversation
…on course MySQL: - Create target schemas before sequences, ENUM types and tables. ENUM types were created before their schema, so the table using them was lost, along with its FKs and sequence reset. - AUTO_INCREMENT integer columns become serial/bigserial (mirroring the CL default cast rules), instead of plain integer columns with no sequence. - DECODING TABLE NAMES MATCHING … AS <charset> now reads text columns as CAST(… AS BINARY) and decodes the stored bytes with that charset. SET NAMES asked the server to convert, which double-encoded the very data the clause is meant to repair. PostgreSQL target: - Fix the sequence reset off-by-one: setval(seq, MAX(col), true), or setval(seq, 1, false) on an empty table, so the first insert no longer collides with the last migrated row. - "Reset Sequences" counts sequences actually reset, not tables visited. SQL Server: - DEFAULT (N'new') lands as 'new', not as the literal text N'new'; doubled quotes in string literal defaults are unescaped. - Translate T-SQL default functions: GETDATE(), GETUTCDATE(), SYSDATETIME(), SYSUTCDATETIME(), SYSDATETIMEOFFSET() → CURRENT_TIMESTAMP, NEWID(), NEWSEQUENTIALID() → gen_random_uuid(). Logging: - Mask passwords in the Source/Target/Connected log lines, for pgloader URIs (user:****@) and JDBC URLs (password=****). Tests: unit tests for each fix; E2E coverage in the mysql suite (no more BEFORE LOAD DO create schema workaround, sequences, decoding) and a v4-only tsqldefaults database in the mssql suite. Baselines that recorded the missing nextval() defaults are updated. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
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.
MySQL:
PostgreSQL target:
SQL Server:
Logging:
Tests: unit tests for each fix; E2E coverage in the mysql suite (no more BEFORE LOAD DO create schema workaround, sequences, decoding) and a v4-only tsqldefaults database in the mssql suite. Baselines that recorded the missing nextval() defaults are updated.