Skip to content

Build your personal knowledge base with Trilium Notes

feat(ocr): update this new migration to also add a `ocr_last_processed` column

perf3ct508cbeaa1b5f
diff --git a/apps/server/src/assets/db/schema.sql b/apps/server/src/assets/db/schema.sql
index 07d924a915..cf4f3aa37a 100644
--- a/apps/server/src/assets/db/schema.sql
+++ b/apps/server/src/assets/db/schema.sql
@@ -107,6 +107,8 @@ CREATE TABLE IF NOT EXISTS "recent_notes"
CREATE TABLE IF NOT EXISTS "blobs" (
`blobId` TEXT NOT NULL,
`content` TEXT NULL DEFAULT NULL,
+ `ocr_text` TEXT DEFAULT NULL,
+ `ocr_last_processed` TEXT DEFAULT NULL,
`dateModified` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
PRIMARY KEY(`blobId`)
diff --git a/apps/server/src/migrations/migrations.ts b/apps/server/src/migrations/migrations.ts
index 2566649922..2d34543ae2 100644
--- a/apps/server/src/migrations/migrations.ts
+++ b/apps/server/src/migrations/migrations.ts
@@ -6,16 +6,23 @@
// Migrations should be kept in descending order, so the latest migration is first.
const MIGRATIONS: (SqlMigration | JsMigration)[] = [
- // Add OCR text column to blobs table for storing extracted text from images
+ // Add OCR text column and last processed timestamp to blobs table
{
version: 234,
sql: /*sql*/`\
-- Add OCR text column to blobs table
ALTER TABLE blobs ADD COLUMN ocr_text TEXT DEFAULT NULL;
+ -- Add OCR last processed timestamp to blobs table
+ ALTER TABLE blobs ADD COLUMN ocr_last_processed TEXT DEFAULT NULL;
+
-- Create index for OCR text searches
CREATE INDEX IF NOT EXISTS idx_blobs_ocr_text
ON blobs (ocr_text);
+
+ -- Create index for OCR last processed timestamp
+ CREATE INDEX IF NOT EXISTS idx_blobs_ocr_last_processed
+ ON blobs (ocr_last_processed);
`
},
// Migrate geo map to collection