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

chore: drop unused database tables (friend_wearable_requests, ocr_text_embeddings, chunked_text_*)

Louis Beaumont351d721092e7
diff --git a/crates/screenpipe-db/src/db.rs b/crates/screenpipe-db/src/db.rs
index 62991acbf..85c9b43d1 100644
--- a/crates/screenpipe-db/src/db.rs
+++ b/crates/screenpipe-db/src/db.rs
@@ -3897,29 +3897,7 @@ impl DatabaseManager {
.fetch_all(&mut **tx.conn())
.await?;
- // 3. Delete chunked_text_entries (no CASCADE) — by frame_id
- sqlx::query(
- "DELETE FROM chunked_text_entries WHERE frame_id IN (SELECT id FROM frames WHERE timestamp BETWEEN ?1 AND ?2)",
- )
- .bind(&start_str)
- .bind(&end_str)
- .execute(&mut **tx.conn())
- .await?;
-
- // Also delete chunked_text_entries by audio_chunk_id for orphaned audio chunks
- sqlx::query(
- r#"DELETE FROM chunked_text_entries WHERE audio_chunk_id IN (
- SELECT id FROM audio_chunks
- WHERE id IN (SELECT DISTINCT audio_chunk_id FROM audio_transcriptions WHERE timestamp BETWEEN ?1 AND ?2)
- AND id NOT IN (SELECT DISTINCT audio_chunk_id FROM audio_transcriptions WHERE timestamp NOT BETWEEN ?1 AND ?2)
- )"#,
- )
- .bind(&start_str)
- .bind(&end_str)
- .execute(&mut **tx.conn())
- .await?;
-
- // 4. Delete ocr_text — triggers ocr_text_delete -> cleans ocr_text_fts
+ // 3. Delete ocr_text — triggers ocr_text_delete -> cleans ocr_text_fts
let ocr_result = sqlx::query(
"DELETE FROM ocr_text WHERE frame_id IN (SELECT id FROM frames WHERE timestamp BETWEEN ?1 AND ?2)",
)
diff --git a/crates/screenpipe-db/src/migrations/20260311000000_drop_unused_tables.sql b/crates/screenpipe-db/src/migrations/20260311000000_drop_unused_tables.sql
new file mode 100644
index 000000000..910a0cfe6
--- /dev/null
+++ b/crates/screenpipe-db/src/migrations/20260311000000_drop_unused_tables.sql
@@ -0,0 +1,15 @@
+-- Drop unused tables that have no inserts or queries in the codebase.
+
+-- friend_wearable_requests: created for wearable API feature that was never completed.
+-- No INSERT or SELECT statements exist anywhere in the codebase.
+DROP TABLE IF EXISTS friend_wearable_requests;
+
+-- ocr_text_embeddings: created for an embedding pipeline that was never implemented.
+-- No INSERT statements exist anywhere in the codebase.
+DROP TABLE IF EXISTS ocr_text_embeddings;
+
+-- chunked_text_*: legacy text chunking system, only referenced in deletion cleanup.
+-- No active inserts or reads.
+DROP TABLE IF EXISTS chunked_text_index_fts;
+DROP TABLE IF EXISTS chunked_text_entries;
+DROP TABLE IF EXISTS chunked_text_index;