Skip to content

ci: run ScalaTests against SQL Server 2022 and resolve dialect incompatibilities - #2945

Merged
simonredfern merged 37 commits into
OpenBankProject:developfrom
hongwei1:scalatest-sqlserver-actions
Oct 16, 2026
Merged

simonredfern merged 37 commits into
OpenBankProject:developfrom
hongwei1:scalatest-sqlserver-actions

Conversation

@hongwei1

@hongwei1 hongwei1 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

CI tests run against in-memory H2 by default. SQL Server 2022, SQL Server 2017 (CU20) or PostgreSQL 16 can be selected for a run through the database input of the manual workflow dispatch (h2, sqlserver, sqlserver2017, postgres), or by adding the test-sqlserver / test-postgres label to a pull request. A shared setup-test-database action starts and health-checks the container (pinned images, and the job fails if the database does not come up), generates the connection properties for it, and gives SQL Server and PostgreSQL shards a 75-minute limit instead of 25. The code is made to run on SQL Server: pagination and row locks go through DoobieUtil.pagination, lockHint and forUpdate, isSqlServer is computed once, NOW() has a T-SQL form, string_agg operands are cast to NVARCHAR(MAX), consent listing avoids DISTINCT over text columns, and DATETIME columns are upgraded to DATETIME2 at schemify time with their indexes, defaults and NOT NULL kept, so dates before 1753 are stored.

The role name and metric consumer id migrations drop and recreate their dependent indexes around ALTER COLUMN and keep NVARCHAR, the dynamic data id keeps NVARCHAR(255), v_consent is ensured once at the end of the migration chain, and the currency code migration trims trailing spaces on SQL Server, where they are otherwise ignored in comparisons. A row-level Dynamic Entity record keeps its <entity>_id through PUT and PATCH, and cascade delete of an entity finds its records by row id. New suites cover the DATETIME2 upgrade, the dialect helpers and the row-level update, and run against SQL Server when it is the test database; the code.api.http4sbridge test package is now code.api.http4sserver. All ten shards pass on H2, PostgreSQL 16, SQL Server 2022 and SQL Server 2017. Not covered yet: some consent and settlement-account scenarios have failed in local SQL Server runs and are not addressed here.

The unique index on mappedentitlement is dropped only when it exists and is recreated only when it is missing, so a database that lacks an index of that name no longer fails the batch and aborts boot on every start.
…ep it NVARCHAR

The guard compared a byte length with a character count, so an NVARCHAR column of 125 to 249 characters was skipped, and the ALTER turned the column into VARCHAR, which no longer matched the mapped model. The check now uses the character length and the column stays NVARCHAR(250).
@sonarqubecloud

Copy link
Copy Markdown

@simonredfern
simonredfern merged commit 81375ee into OpenBankProject:develop Oct 16, 2026
13 checks passed
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