Upstream sync required: bf195784 #3

Closed
opened 2026-03-09 22:15:57 -03:00 by github-actions[bot] · 0 comments
github-actions[bot] commented 2026-03-09 22:15:57 -03:00 (Migrated from github.com)

Upstream changes detected

The upstream develop branch has moved ahead of our pinned submodule commit.

Commit
Submodule (current) 40c98e84
Upstream develop (latest) bf195784
Full diff Compare on GitHub

🗄️ New / changed Flyway migrations (1)

Port these to Liquibase in src/main/resources/db/changelog/changelogs/.

  • V130__Add_book_per_file_organization_mode.sql

🔍 Changed repositories (1)

Check for new nativeQuery = true annotations — these need JPQL rewrites in our overlay for SQLite/PostgreSQL compatibility.

  • BookRepository.java

✅ Checklist

  • Update submodule to bf195784 (or the latest stable tag)
  • Port 1 new Flyway migration(s) to Liquibase changelogs
  • Audit 1 changed repository file(s) for new native queries
  • Diff upstream build.gradle for dependency changes
  • Build and run full test suite (./gradlew test)
Full diff (watched paths only)
diff --git a/booklore-api/src/main/java/org/booklore/repository/BookRepository.java b/booklore-api/src/main/java/org/booklore/repository/BookRepository.java
index 08ffb61b..7ba0c1ea 100644
--- a/booklore-api/src/main/java/org/booklore/repository/BookRepository.java
+++ b/booklore-api/src/main/java/org/booklore/repository/BookRepository.java
@@ -27,12 +27,15 @@ public interface BookRepository extends JpaRepository<BookEntity, Long>, JpaSpec
     @Query("SELECT b FROM BookEntity b JOIN b.bookFiles bf WHERE bf.currentHash = :currentHash AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false)")
     Optional<BookEntity> findByCurrentHash(@Param("currentHash") String currentHash);
 
+    @Query("SELECT b FROM BookEntity b JOIN FETCH b.bookFiles bf WHERE bf.currentHash = :currentHash AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false OR b.deletedAt > :cutoff)")
+    Optional<BookEntity> findByCurrentHashIncludingRecentlyDeleted(@Param("currentHash") String currentHash, @Param("cutoff") Instant cutoff);
+
     Optional<BookEntity> findByBookCoverHash(String bookCoverHash);
 
     @Query("SELECT b.id FROM BookEntity b WHERE b.library.id = :libraryId AND (b.deleted IS NULL OR b.deleted = false)")
     Set<Long> findBookIdsByLibraryId(@Param("libraryId") long libraryId);
 
-    @Query("SELECT DISTINCT b FROM BookEntity b JOIN b.bookFiles bf WHERE b.libraryPath.id = :libraryPathId AND bf.fileSubPath LIKE CONCAT(:fileSubPathPrefix, '%') AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false)")
+    @Query("SELECT DISTINCT b FROM BookEntity b JOIN b.bookFiles bf WHERE b.libraryPath.id = :libraryPathId AND (bf.fileSubPath = :fileSubPathPrefix OR bf.fileSubPath LIKE CONCAT(:fileSubPathPrefix, '/%')) AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false)")
     List<BookEntity> findAllByLibraryPathIdAndFileSubPathStartingWith(@Param("libraryPathId") Long libraryPathId, @Param("fileSubPathPrefix") String fileSubPathPrefix);
 
     @Query("SELECT DISTINCT b FROM BookEntity b JOIN b.bookFiles bf WHERE b.libraryPath.id = :libraryPathId AND bf.fileSubPath = :fileSubPath AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false)")
@@ -129,6 +132,19 @@ public interface BookRepository extends JpaRepository<BookEntity, Long>, JpaSpec
     @Query("SELECT COUNT(b) FROM BookEntity b WHERE b.deleted = TRUE")
     long countAllSoftDeleted();
 
+    @Query("""
+        SELECT DISTINCT b FROM BookEntity b
+        JOIN FETCH b.bookFiles bf
+        WHERE b.libraryPath.id = :libraryPathId
+        AND (bf.fileSubPath = :folderPath
+             OR bf.fileSubPath LIKE CONCAT(:folderPath, '/%')
+             OR (bf.folderBased = true AND CONCAT(bf.fileSubPath, '/', bf.fileName) = :folderPath))
+        AND bf.isBookFormat = true
+        AND (b.deleted IS NULL OR b.deleted = false)
+        """)
+    List<BookEntity> findBooksWithFilesUnderPath(@Param("libraryPathId") Long libraryPathId,
+                                                  @Param("folderPath") String folderPath);
+
     @Query(value = """
         SELECT b.*
         FROM book b
diff --git a/booklore-api/src/main/resources/db/migration/V130__Add_book_per_file_organization_mode.sql b/booklore-api/src/main/resources/db/migration/V130__Add_book_per_file_organization_mode.sql
new file mode 100644
index 00000000..034c35bb
--- /dev/null
+++ b/booklore-api/src/main/resources/db/migration/V130__Add_book_per_file_organization_mode.sql
@@ -0,0 +1 @@
+ALTER TABLE library MODIFY COLUMN organization_mode VARCHAR(50) DEFAULT 'BOOK_PER_FILE';

## Upstream changes detected The upstream `develop` branch has moved ahead of our pinned submodule commit. | | Commit | |---|---| | **Submodule (current)** | [`40c98e84`](https://github.com/booklore-app/booklore/commit/40c98e84) | | **Upstream develop (latest)** | [`bf195784`](https://github.com/booklore-app/booklore/commit/bf195784) | | **Full diff** | [Compare on GitHub](https://github.com/booklore-app/booklore/compare/40c98e84...bf195784) | ### 🗄️ New / changed Flyway migrations (1) Port these to Liquibase in `src/main/resources/db/changelog/changelogs/`. - `V130__Add_book_per_file_organization_mode.sql` ### 🔍 Changed repositories (1) Check for new `nativeQuery = true` annotations — these need JPQL rewrites in our overlay for SQLite/PostgreSQL compatibility. - `BookRepository.java` ### ✅ Checklist - [ ] Update submodule to `bf195784` (or the latest stable tag) - [ ] Port 1 new Flyway migration(s) to Liquibase changelogs - [ ] Audit 1 changed repository file(s) for new native queries - [ ] Diff upstream `build.gradle` for dependency changes - [ ] Build and run full test suite (`./gradlew test`) <details> <summary>Full diff (watched paths only)</summary> ```diff diff --git a/booklore-api/src/main/java/org/booklore/repository/BookRepository.java b/booklore-api/src/main/java/org/booklore/repository/BookRepository.java index 08ffb61b..7ba0c1ea 100644 --- a/booklore-api/src/main/java/org/booklore/repository/BookRepository.java +++ b/booklore-api/src/main/java/org/booklore/repository/BookRepository.java @@ -27,12 +27,15 @@ public interface BookRepository extends JpaRepository<BookEntity, Long>, JpaSpec @Query("SELECT b FROM BookEntity b JOIN b.bookFiles bf WHERE bf.currentHash = :currentHash AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false)") Optional<BookEntity> findByCurrentHash(@Param("currentHash") String currentHash); + @Query("SELECT b FROM BookEntity b JOIN FETCH b.bookFiles bf WHERE bf.currentHash = :currentHash AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false OR b.deletedAt > :cutoff)") + Optional<BookEntity> findByCurrentHashIncludingRecentlyDeleted(@Param("currentHash") String currentHash, @Param("cutoff") Instant cutoff); + Optional<BookEntity> findByBookCoverHash(String bookCoverHash); @Query("SELECT b.id FROM BookEntity b WHERE b.library.id = :libraryId AND (b.deleted IS NULL OR b.deleted = false)") Set<Long> findBookIdsByLibraryId(@Param("libraryId") long libraryId); - @Query("SELECT DISTINCT b FROM BookEntity b JOIN b.bookFiles bf WHERE b.libraryPath.id = :libraryPathId AND bf.fileSubPath LIKE CONCAT(:fileSubPathPrefix, '%') AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false)") + @Query("SELECT DISTINCT b FROM BookEntity b JOIN b.bookFiles bf WHERE b.libraryPath.id = :libraryPathId AND (bf.fileSubPath = :fileSubPathPrefix OR bf.fileSubPath LIKE CONCAT(:fileSubPathPrefix, '/%')) AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false)") List<BookEntity> findAllByLibraryPathIdAndFileSubPathStartingWith(@Param("libraryPathId") Long libraryPathId, @Param("fileSubPathPrefix") String fileSubPathPrefix); @Query("SELECT DISTINCT b FROM BookEntity b JOIN b.bookFiles bf WHERE b.libraryPath.id = :libraryPathId AND bf.fileSubPath = :fileSubPath AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false)") @@ -129,6 +132,19 @@ public interface BookRepository extends JpaRepository<BookEntity, Long>, JpaSpec @Query("SELECT COUNT(b) FROM BookEntity b WHERE b.deleted = TRUE") long countAllSoftDeleted(); + @Query(""" + SELECT DISTINCT b FROM BookEntity b + JOIN FETCH b.bookFiles bf + WHERE b.libraryPath.id = :libraryPathId + AND (bf.fileSubPath = :folderPath + OR bf.fileSubPath LIKE CONCAT(:folderPath, '/%') + OR (bf.folderBased = true AND CONCAT(bf.fileSubPath, '/', bf.fileName) = :folderPath)) + AND bf.isBookFormat = true + AND (b.deleted IS NULL OR b.deleted = false) + """) + List<BookEntity> findBooksWithFilesUnderPath(@Param("libraryPathId") Long libraryPathId, + @Param("folderPath") String folderPath); + @Query(value = """ SELECT b.* FROM book b diff --git a/booklore-api/src/main/resources/db/migration/V130__Add_book_per_file_organization_mode.sql b/booklore-api/src/main/resources/db/migration/V130__Add_book_per_file_organization_mode.sql new file mode 100644 index 00000000..034c35bb --- /dev/null +++ b/booklore-api/src/main/resources/db/migration/V130__Add_book_per_file_organization_mode.sql @@ -0,0 +1 @@ +ALTER TABLE library MODIFY COLUMN organization_mode VARCHAR(50) DEFAULT 'BOOK_PER_FILE'; ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
binarymelon/booklore-multidb#3
No description provided.