mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-02 13:32:51 +00:00
Add counter to joblog for correct log order
This is to distinguish log entries created at the same time.
This commit is contained in:
parent
bcf86d97f5
commit
80ddca9aa3
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE "joblog"
|
||||||
|
ADD COLUMN "counter" bigint auto_increment;
|
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE `joblog`
|
||||||
|
ADD COLUMN `counter` mediumint auto_increment unique;
|
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE "joblog"
|
||||||
|
ADD COLUMN "counter" bigserial;
|
@ -26,6 +26,10 @@ object RJobLog {
|
|||||||
val created = Column("created")
|
val created = Column("created")
|
||||||
val message = Column("message")
|
val message = Column("message")
|
||||||
val all = List(id, jobId, level, created, message)
|
val all = List(id, jobId, level, created, message)
|
||||||
|
|
||||||
|
// separate column only for sorting, so not included in `all` and
|
||||||
|
// the case class
|
||||||
|
val counter = Column("counter")
|
||||||
}
|
}
|
||||||
import Columns._
|
import Columns._
|
||||||
|
|
||||||
@ -37,7 +41,7 @@ object RJobLog {
|
|||||||
).update.run
|
).update.run
|
||||||
|
|
||||||
def findLogs(id: Ident): ConnectionIO[Vector[RJobLog]] =
|
def findLogs(id: Ident): ConnectionIO[Vector[RJobLog]] =
|
||||||
(selectSimple(all, table, jobId.is(id)) ++ orderBy(created.asc))
|
(selectSimple(all, table, jobId.is(id)) ++ orderBy(created.asc, counter.asc))
|
||||||
.query[RJobLog]
|
.query[RJobLog]
|
||||||
.to[Vector]
|
.to[Vector]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user