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

fix: rename duplicate migration version 20260210000000 → 20260210100000

Louis Beaumont47175e71513b
diff --git a/crates/screenpipe-db/src/db.rs b/crates/screenpipe-db/src/db.rs
index dd9316f5b..20535a80c 100644
--- a/crates/screenpipe-db/src/db.rs
+++ b/crates/screenpipe-db/src/db.rs
@@ -177,52 +177,9 @@ impl DatabaseManager {
async fn run_migrations(pool: &SqlitePool) -> Result<(), sqlx::Error> {
let mut migrator = sqlx::migrate!("./src/migrations");
migrator.set_ignore_missing(true);
- match migrator.run(pool).await {
- Ok(_) => Ok(()),
- Err(e) => {
- let err_str = e.to_string();
- // Handle checksum mismatch from modified migrations.
- // This can happen when a migration file was changed after being applied
- // (e.g., the fps migration was modified between v0.3.130 and v0.3.131).
- // Fix: update the stored checksum to match the current file, then retry.
- if err_str.contains("was previously applied but has been modified") {
- tracing::warn!(
- "Migration checksum mismatch detected: {}. Updating checksums and retrying...",
- err_str
- );
- Self::fix_migration_checksums(pool, &migrator).await?;
- // Retry after fixing checksums
- migrator.run(pool).await.map_err(|e| e.into())
- } else {
- Err(e.into())
- }
- }
- }
+ migrator.run(pool).await.map_err(|e| e.into())
}
- /// Fix checksum mismatches by updating stored checksums to match current migration files.
- /// This is needed when a migration file was modified after being applied to the DB
- /// (which happened with the fps migration between v0.3.130 and v0.3.131).
- async fn fix_migration_checksums(
- pool: &SqlitePool,
- migrator: &sqlx::migrate::Migrator,
- ) -> Result<(), sqlx::Error> {
- for migration in migrator.iter() {
- if migration.migration_type.is_down_migration() {
- continue;
- }
- // Update the checksum for any previously-applied migration to match the current file
- let version = migration.version;
- let checksum_bytes: &[u8] = &migration.checksum;
- sqlx::query("UPDATE _sqlx_migrations SET checksum = ? WHERE version = ?")
- .bind(checksum_bytes)
- .bind(version)
- .execute(pool)
- .await?;
- }
- tracing::info!("Migration checksums updated successfully");
- Ok(())
- }
/// Acquire a connection with `BEGIN IMMEDIATE`, serialized via write semaphore.
///
diff --git a/crates/screenpipe-db/src/migrations/20260210000000_fix_orphaned_speaker_transcriptions.sql b/crates/screenpipe-db/src/migrations/20260210100000_fix_orphaned_speaker_transcriptions.sql
similarity index 100%
rename from crates/screenpipe-db/src/migrations/20260210000000_fix_orphaned_speaker_transcriptions.sql
rename to crates/screenpipe-db/src/migrations/20260210100000_fix_orphaned_speaker_transcriptions.sql