Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 0.1.44-beta.15 - 2026-09-14

### Fixed

- Restore compatibility with databases created by beta.11 and later by bundling
the previously released TODO target-lock migration with its original identity.

### Tests

- Verify the beta.11 migration hash and confirm compatible databases are inspected
without changing their bytes.

## 0.1.44-beta.14 - 2026-09-14

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE `todo_target_lock` (
`session_id` text PRIMARY KEY NOT NULL,
`revision` integer NOT NULL,
`data` text NOT NULL,
`time_created` integer NOT NULL,
`time_updated` integer NOT NULL,
FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON UPDATE no action ON DELETE cascade
);
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
inspectCompatibility,
recordSchemaIdentity,
} from "../../src/storage/compatibility"
import { identifyMigrations } from "../../src/storage/migration-journal"
import { identifyMigrations, supportedMigrationJournal } from "../../src/storage/migration-journal"
import { init } from "../../src/storage/db.bun"
import { mendChannelDbPath } from "../../src/storage/resolve-default-sqlite-path"

Expand Down Expand Up @@ -50,6 +50,27 @@ test("known legacy schema is compatible; persisted SQL identity rejects drift",
expect(inspectCompatibility(file, [{ ...journal[0], hash: "f".repeat(64) }]).compatible).toBe(false)
})

test("target-lock migration from beta 11 remains compatible without changing database bytes", () => {
const target = supportedMigrationJournal().find((entry) => entry.name === "20260912160000_todo_target_lock")
expect(target).toEqual({
name: "20260912160000_todo_target_lock",
timestamp: 1789228800000,
hash: "70cfa4c0564c863794823218a7e39e645c10b6a99ffa47b39d4eb87bd41e6ef1",
})
const file = path.join(root, "target-lock.db")
const db = new Database(file, { create: true })
db.run("CREATE TABLE __drizzle_migrations (name TEXT, created_at NUMERIC)")
db.run("CREATE TABLE __mendcode_schema_identity (name TEXT PRIMARY KEY, timestamp INTEGER NOT NULL, hash TEXT NOT NULL)")
db.run("INSERT INTO __drizzle_migrations VALUES (?, ?)", [target!.name, target!.timestamp])
db.run("INSERT INTO __mendcode_schema_identity VALUES (?, ?, ?)", [target!.name, target!.timestamp, target!.hash])
db.close()
const before = readFileSync(file)
const result = inspectCompatibility(file, supportedMigrationJournal())
expect(result.compatible).toBe(true)
expect(result.legacy).toBe(false)
expect(readFileSync(file)).toEqual(before)
})

test("snapshot includes WAL commits only when migrations are pending", () => {
const { file, db } = fixture("backup")
db.run("PRAGMA journal_mode=WAL")
Expand Down
Loading