Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

migrations to add new tables for chunked screen and audio data along with indication of models and sources for each data point

matthew-heartful6fba5ab4ac8f
diff --git a/screenpipe-server/src/migrations/202408050005_ V2__create_inverted_index_table.sql b/screenpipe-server/src/migrations/202408050005_ V2__create_inverted_index_table.sql
new file mode 100644
index 000000000..0b7fd838e
--- /dev/null
+++ b/screenpipe-server/src/migrations/202408050005_ V2__create_inverted_index_table.sql
@@ -0,0 +1,23 @@
+CREATE TABLE chunked_text_index (
+ text_id INTEGER PRIMARY KEY AUTOINCREMENT,
+ text TEXT NOT NULL UNIQUE
+);
+
+CREATE TABLE chunked_text_entries (
+ text_id INTEGER NOT NULL,
+ frame_id INTEGER,
+ audio_chunk_id INTEGER,
+ timestamp DATETIME NOT NULL,
+ engine TEXT NOT NULL,
+ chunking_engine TEXT NOT NULL,
+ source TEXT NOT NULL,
+ FOREIGN KEY (text_id) REFERENCES chunked_text_index(text_id),
+ FOREIGN KEY (frame_id) REFERENCES frames(id),
+ FOREIGN KEY (audio_chunk_id) REFERENCES audio_chunks(id)
+);
+
+-- Add ocr_engine column to ocr_text table
+ALTER TABLE ocr_text ADD COLUMN ocr_engine TEXT NOT NULL DEFAULT 'unknown';
+
+-- Update existing rows to have a default value
+UPDATE ocr_text SET ocr_engine = 'unknown' WHERE ocr_engine IS NULL;
\ No newline at end of file
diff --git a/screenpipe-server/src/migrations/202408070006_V2_add_transcription_engine.sql b/screenpipe-server/src/migrations/202408070006_V2_add_transcription_engine.sql
new file mode 100644
index 000000000..3c281df42
--- /dev/null
+++ b/screenpipe-server/src/migrations/202408070006_V2_add_transcription_engine.sql
@@ -0,0 +1,5 @@
+-- Add transcription_engine column to audio_transcriptions table
+ALTER TABLE audio_transcriptions ADD COLUMN transcription_engine TEXT NOT NULL DEFAULT 'Whisper';
+
+-- Update existing rows to have 'Whisper' as the default value
+UPDATE audio_transcriptions SET transcription_engine = 'Whisper' WHERE transcription_engine IS NULL;
\ No newline at end of file