itsgoin/crates/core
Scott Reimers 88dfbd26f4 Fix: idx_group_keys_root migration creates index on missing column
The Phase 2f `canonical_root_post_id` column was added to both the
CREATE TABLE block (for fresh DBs) and a conditional ALTER TABLE (for
upgrading DBs). The matching CREATE INDEX, however, was inlined in the
CREATE TABLE block — which runs BEFORE the ALTER. On an upgrading DB
with the v0.6.1 schema, CREATE TABLE IF NOT EXISTS is a no-op against
the existing (old) table, so the table still lacks the column when the
index statement runs and SQLite bails with "Error code 1: SQL error or
missing database" at offset 74.

Caught on the v0.6.2 anchor deploy — the anchor died right after start
because its v0.6.1 DB couldn't apply migrations.

Fix: remove the index from the CREATE TABLE block; run an unconditional
`CREATE INDEX IF NOT EXISTS idx_group_keys_root ...` in the migration
section, after the conditional ALTER has added the column. Idempotent
in both paths — fresh DB (column from CREATE TABLE) and upgrading DB
(column from ALTER).

121 / 121 core tests pass.
2026-04-23 00:00:06 -04:00
..
src Fix: idx_group_keys_root migration creates index on missing column 2026-04-23 00:00:06 -04:00
Cargo.toml v0.6.2 release: version bump + changelog 2026-04-22 23:54:40 -04:00