diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/Book.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/Book.kt index 9823d7b9a..14e84e588 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/Book.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/Book.kt @@ -54,8 +54,8 @@ class Book( @JoinColumn(name = "media_id", nullable = false) var media: Media = Media() - @Column(name = "number", nullable = false, columnDefinition = "REAL") - var number: Float = 0F + @Column(name = "number", nullable = false) + var number: Int = 0 fun fileName(): String = FilenameUtils.getName(url.toString()) diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/Series.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/Series.kt index dba878a8b..002e298c6 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/Series.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/Series.kt @@ -61,7 +61,7 @@ class Series( _books.clear() value.forEach { it.series = this } _books.addAll(value.sortedWith(compareBy(natSortComparator) { it.name })) - _books.forEachIndexed { index, book -> book.number = index + 1F } + _books.forEachIndexed { index, book -> book.number = index + 1 } } @OneToOne(optional = false, orphanRemoval = true, cascade = [CascadeType.ALL], fetch = FetchType.LAZY) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/dto/BookDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/dto/BookDto.kt index 2f91d9f59..86b6c7fb7 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/dto/BookDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/dto/BookDto.kt @@ -10,7 +10,7 @@ data class BookDto( val seriesId: Long, val name: String, val url: String, - val number: Float, + val number: Int, @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") val created: LocalDateTime?, @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") diff --git a/komga/src/main/resources/db/migration/V20200306174948__book_number_to_int.sql b/komga/src/main/resources/db/migration/V20200306174948__book_number_to_int.sql new file mode 100644 index 000000000..230cbb2af --- /dev/null +++ b/komga/src/main/resources/db/migration/V20200306174948__book_number_to_int.sql @@ -0,0 +1,2 @@ +alter table book + alter column number set data type int;