Fix job query for H2

Unfortunately, the new h2 version has some regressions related to
CTEs. The query selecting the next group failed only for H2 after the
update. The query has been rewritten to not use union on CTE tables.
The weird thing was that the error only occured using bind values and
was not reproducible with "just string" SQL in the h2 console.

The QJobTest are now running on all databases.
This commit is contained in:
eikek
2022-08-12 16:30:32 +02:00
parent 0a3ac9f121
commit 5bbe073bf3
6 changed files with 109 additions and 88 deletions

View File

@ -300,11 +300,6 @@ object RJob {
def setProgress(jobId: Ident, perc: Int): ConnectionIO[Int] =
DML.update(T, T.id === jobId, DML.set(T.progress.setTo(perc)))
def selectWaiting: ConnectionIO[Option[RJob]] = {
val sql = run(select(T.all), from(T), T.state === JobState.waiting)
sql.query[RJob].to[Vector].map(_.headOption)
}
def selectGroupInState(states: NonEmptyList[JobState]): ConnectionIO[Vector[Ident]] = {
val sql =
Select(select(T.group), from(T), T.state.in(states)).orderBy(T.group)