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

release-app fix migration

Louis Beaumont4e67768198e2
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 54976157c..218be8d39 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.14.31"
+version = "0.14.32"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-server/src/db.rs b/screenpipe-server/src/db.rs
index 342622d1f..a728dd03a 100644
--- a/screenpipe-server/src/db.rs
+++ b/screenpipe-server/src/db.rs
@@ -89,17 +89,11 @@ impl DatabaseManager {
}
async fn run_migrations(pool: &SqlitePool) -> Result<(), sqlx::Error> {
- match sqlx::migrate!("./src/migrations").run(pool).await {
+ let mut migrator = sqlx::migrate!("./src/migrations");
+ migrator.set_ignore_missing(true);
+ match migrator.run(pool).await {
Ok(_) => Ok(()),
- Err(e) => {
- // Check if it's a version mismatch for our specific migration
- if e.to_string().contains("20241110041538") {
- debug!("ignoring known migration mismatch for 20241110041538");
- Ok(())
- } else {
- Err(e.into())
- }
- }
+ Err(e) => Err(e.into()),
}
}
diff --git a/screenpipe-server/src/migrations/20241110041538_add_speaker_id_to_transcription.sql b/screenpipe-server/src/migrations/20241110041538_add_speaker_id_to_transcription.sql
deleted file mode 100644
index d806a5a09..000000000
--- a/screenpipe-server/src/migrations/20241110041538_add_speaker_id_to_transcription.sql
+++ /dev/null
@@ -1,9 +0,0 @@
--- First check if the column exists
-SELECT CASE
- WHEN COUNT(*) = 0 THEN
- 'ALTER TABLE audio_transcriptions ADD COLUMN speaker_id INTEGER REFERENCES speakers(id);'
- ELSE
- 'SELECT 1;'
-END as sql_to_execute
-FROM pragma_table_info('audio_transcriptions')
-WHERE name = 'speaker_id';
\ No newline at end of file
diff --git a/screenpipe-server/src/migrations/20241126220600_ensure_speaker_id_column.sql b/screenpipe-server/src/migrations/20241126220600_ensure_speaker_id_column.sql
deleted file mode 100644
index f2784967e..000000000
--- a/screenpipe-server/src/migrations/20241126220600_ensure_speaker_id_column.sql
+++ /dev/null
@@ -1,28 +0,0 @@
--- Check if the column exists and add it if it doesn't
-SELECT CASE
- WHEN NOT EXISTS (
- SELECT 1
- FROM pragma_table_info('audio_transcriptions')
- WHERE name = 'speaker_id'
- )
- THEN
- 'ALTER TABLE audio_transcriptions ADD COLUMN speaker_id INTEGER REFERENCES speakers(id);'
- ELSE
- 'SELECT 1;'
-END as migration_sql;
-
--- Execute the generated SQL
-WITH migration AS (
- SELECT CASE
- WHEN NOT EXISTS (
- SELECT 1
- FROM pragma_table_info('audio_transcriptions')
- WHERE name = 'speaker_id'
- )
- THEN
- 'ALTER TABLE audio_transcriptions ADD COLUMN speaker_id INTEGER REFERENCES speakers(id);'
- ELSE
- 'SELECT 1;'
- END as sql_to_execute
-)
-SELECT sql_to_execute FROM migration;
diff --git a/screenpipe-server/src/migrations/20241127172038_create_speaker_id_col_final.sql b/screenpipe-server/src/migrations/20241127172038_create_speaker_id_col_final.sql
new file mode 100644
index 000000000..b5024224f
--- /dev/null
+++ b/screenpipe-server/src/migrations/20241127172038_create_speaker_id_col_final.sql
@@ -0,0 +1,11 @@
+CREATE TABLE IF NOT EXISTS audio_transcriptions_new AS
+SELECT *, NULL as speaker_id
+FROM audio_transcriptions
+WHERE 0;
+
+INSERT INTO audio_transcriptions_new
+SELECT *, NULL as speaker_id
+FROM audio_transcriptions;
+
+DROP TABLE audio_transcriptions;
+ALTER TABLE audio_transcriptions_new RENAME TO audio_transcriptions;
\ No newline at end of file
diff --git a/screenpipe-server/src/migrations/20241127220428_add_hallucination_column.sql b/screenpipe-server/src/migrations/20241127220428_add_hallucination_column.sql
new file mode 100644
index 000000000..94f90628d
--- /dev/null
+++ b/screenpipe-server/src/migrations/20241127220428_add_hallucination_column.sql
@@ -0,0 +1 @@
+ALTER TABLE speakers ADD COLUMN hallucination BOOLEAN DEFAULT FALSE;
\ No newline at end of file