Skip to content

Run tests on MySQL and Postgres in CI#575

Draft
duncanmcclean wants to merge 15 commits into5.xfrom
mysql-postgres
Draft

Run tests on MySQL and Postgres in CI#575
duncanmcclean wants to merge 15 commits into5.xfrom
mysql-postgres

Conversation

@duncanmcclean
Copy link
Copy Markdown
Member

No description provided.

duncanmcclean and others added 15 commits April 30, 2026 10:04
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>
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.

1 participant