Run tests on MySQL and Postgres in CI#575
Draft
duncanmcclean wants to merge 15 commits into5.xfrom
Draft
Conversation
With RefreshDatabase on real databases, the entries table persists across test classes via transactions. When switching between integer and string ID variants, the migration would fail with "table already exists". Drop the table and clear migration records before applying the correct variant. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test was checking for exact SQL with double-quoted identifiers, which is SQLite/Postgres style. MySQL uses backticks. Check for keywords instead of the exact SQL string. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
MySQL/Postgres may return JSON object keys in a different order than the input. Use assertEquals instead of assertSame to ignore key order. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On MySQL/Postgres, JSON columns store data in a normalized format that doesn't match compact json_encode() output. Using castAsJson() ensures proper comparison regardless of database driver. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test uses string IDs ('foo', 'bar') for entries but the default
migration creates a bigint column. Postgres strictly enforces column
types and rejects string values in bigint columns.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Same fix as previous commit, applied to ImportFormsTest, ImportGlobalsTest, ImportRevisionsTest, FormSubmissionTest, AddonSettingsRepositoryTest, and UpdateGlobalVariablesTest. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Postgres enforces UUID format on uuid columns. Replace placeholder IDs like 'abc-123' with properly formatted UUIDs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Postgres enforces UUID format on uuid columns. Replace 'foo'/'bar' entry IDs with properly formatted UUIDs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The down migration converts decimal IDs back to bigint auto_increment. On MySQL/Postgres, decimal values like 1234567890.0001 and 1234567890.0002 truncate to the same bigint, causing a unique constraint violation. Clear the table first since the down migration is only used in testing/rollback scenarios. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Postgres auto-increment sequences don't advance when IDs are explicitly inserted, causing duplicate key violations when propagation auto-generates IDs. Switch to UUID entries and use valid UUIDs throughout. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Postgres extract() requires a timestamp type but JSON ->> returns text. Add whereDate/whereMonth/whereDay/whereYear overrides that cast JSON-extracted values to timestamp on Postgres. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Postgres rejects the string 'missing' as input for a bigint column. Use a numeric ID that doesn't exist instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix whereJsonContains test data to match "contains ALL" semantics used by MySQL/Postgres (not "contains ANY") - Sort results in assertions where database ordering isn't guaranteed - Skip tests that fundamentally rely on SQLite's weak typing (select JSON data fields as columns, join bigint with text, whereHas with mixed-type JSON contains) - Skip whereBetween tests on Postgres where JSON text values can't be compared numerically - Add Blink::flush() and ->values() to status filter test - Add isUsingPostgres() helper to TestCase Co-Authored-By: Claude Opus 4.6 (1M context) <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.
No description provided.