Skip to content

0.5.0 — skip backups when nothing to migrate; keep real backups

Latest

Choose a tag to compare

@GRimAce11 GRimAce11 released this 04 Dec 05:13
· 1 commit to main since this release

Fixed

  • The pre-migration backup was deleted after a successful migration.
    Strata compared Z_METADATA.Z_VERSION before and after to decide whether
    a migration ran, but that is Core Data's store-format version and does not
    change on a migration, so the backup was treated as unneeded and removed.
    It now compares the model version identifiers SwiftData records in the
    store, and keeps the backup when it can't tell.
  • Backups could fail with SQLITE_CANTOPEN on a WAL store whose -shm
    file was missing: the store was opened read-only, which cannot create it.
    Strata now opens it read-write (it still only reads), falling back to
    read-only, and backup errors report both connections' messages.

Changed

  • No backup on launches with nothing to migrate. SafeModelContainer.make
    used to copy the whole store, write two journal entries (each forced to
    disk) and run the hooks on every launch, then delete the copy when no
    migration was needed. When the store already records the destination
    schema's versionIdentifier, it now opens the container directly: no
    backup, no journal writes, no preMigration/postMigration hooks. Any
    doubt takes the full, backed-up path as before.
  • The migration journal is compacted after each completed migration
    (entries older than 90 days are dropped), so it no longer grows forever.

Added

  • SafetyIntegrationTests: rollback after a failed migration, recovery after
    an interrupted one, and the fast path, all against real SwiftData stores.