Hangfire schema with CockroachDB

Hi there! I’m unable to run Hangfire DB migrations using CockroachDB.

On application start, my “api” and “identity” schemas are created and migrations are applied. But it fails to create the Hangfire schema with an error: “Npgsql.PostgresException (0x80004005): 42601: at or near “do”: syntax error”

The issue seems to be with the newer SQL “DO” block, so I tried downgrading the nuget packages. It didn’t help though.
Hangfire.Core 1.8.9 → 1.7.4
Hangfire.AspNetCore 1.8.9 → 1.7.4
Hangfire.PostgreSql 1.20.5 → 1.4.8.1
Microsoft.EntityFrameworkCore 7.0.0 → 6.0.24
Npgsql.EntityFrameworkCore.PostgreSQL 6.0.24 → 6.0.2

Logs:
2024-03-29T14:00:47.226479+00:00 app[web.1]: [40m[32minfo[39m[22m[49m: Hangfire.PostgreSql.PostgreSqlStorage[0]
2024-03-29T14:00:47.226554+00:00 app[web.1]: Start installing Hangfire SQL objects…
2024-03-29T14:00:47.748046+00:00 app[web.1]: [41m[30mfail[39m[22m[49m: Hangfire.PostgreSql.PostgreSqlStorage[0]
2024-03-29T14:00:47.748135+00:00 app[web.1]: Error while executing install/upgrade
2024-03-29T14:00:47.748135+00:00 app[web.1]: Npgsql.PostgresException (0x80004005): 42601: at or near “do”: syntax error
2024-03-29T14:00:47.748136+00:00 app[web.1]:
2024-03-29T14:00:47.748137+00:00 app[web.1]: DETAIL: Detail redacted as it may contain sensitive data. Specify ‘Include Error Detail’ in the connection string to include this information.
2024-03-29T14:00:47.748140+00:00 app[web.1]: at Npgsql.Internal.NpgsqlConnector.g__ReadMessageLong|213_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
2024-03-29T14:00:47.748141+00:00 app[web.1]: at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
2024-03-29T14:00:47.748142+00:00 app[web.1]: at Npgsql.NpgsqlDataReader.NextResult()
2024-03-29T14:00:47.748142+00:00 app[web.1]: at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
2024-03-29T14:00:47.748142+00:00 app[web.1]: at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
2024-03-29T14:00:47.748142+00:00 app[web.1]: at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
2024-03-29T14:00:47.748143+00:00 app[web.1]: at Npgsql.NpgsqlCommand.ExecuteNonQuery()
2024-03-29T14:00:47.748143+00:00 app[web.1]: at Hangfire.PostgreSql.PostgreSqlObjectsInstaller.Install(NpgsqlConnection connection, String schemaName)
2024-03-29T14:00:47.748143+00:00 app[web.1]: Exception data:
2024-03-29T14:00:47.748144+00:00 app[web.1]: Severity: ERROR
2024-03-29T14:00:47.748144+00:00 app[web.1]: SqlState: 42601
2024-03-29T14:00:47.748144+00:00 app[web.1]: MessageText: at or near “do”: syntax error
2024-03-29T14:00:47.748144+00:00 app[web.1]: Detail: Detail redacted as it may contain sensitive data. Specify ‘Include Error Detail’ in the connection string to include this information.
2024-03-29T14:00:47.748145+00:00 app[web.1]: File: lexer.go
2024-03-29T14:00:47.748145+00:00 app[web.1]: Line: 404
2024-03-29T14:00:47.748145+00:00 app[web.1]: Routine: Error
2024-03-29T14:00:48.248086+00:00 app[web.1]: [41m[30mfail[39m[22m[49m: Hangfire.PostgreSql.PostgreSqlStorage[0]