Skip to content

Upgrade to v0.19.0 fails: V6__routines migration checksum mismatch on existing PostgreSQL databases #1328

@milenkobeslic

Description

@milenkobeslic

Description

Upgrading from v0.18.0 (or any earlier release) to v0.19.0 fails on startup with:

Error: Migration failed: applied migration V6__routines is different than filesystem one V6__routines

Root Cause

PR #1151 modified the already-applied V6__routines.sql migration in place, changing:

-- v0.18.0 (sha 36f63cb, 2930 bytes)
notify_user TEXT NOT NULL DEFAULT 'default',

to:

-- v0.19.0 (sha 9697251, 2903 bytes)
notify_user TEXT,

The PR also correctly added V13__owner_scope_notify_targets.sql to handle the schema change incrementally for existing databases. However, because V6 was also modified, refinery's checksum validation rejects the upgrade before V13 can run.

The PR body acknowledges this under Database Impact:

Adds migrations/V13__owner_scope_notify_targets.sql and updates fresh-schema migrations/V6__routines.sql so routines.notify_user can be NULL.

This works for fresh installs but breaks every existing PostgreSQL database upgrading to v0.19.0.

Steps to Reproduce

  1. Install IronClaw v0.18.0 (or earlier) with PostgreSQL backend
  2. Run it at least once so migrations V1–V12 are applied
  3. Replace the binary with v0.19.0
  4. Start IronClaw — fails immediately with the checksum error

Expected Behavior

Upgrade from v0.18.0 to v0.19.0 should apply V13 incrementally without touching the checksum of already-applied migrations.

Suggested Fix

Revert V6__routines.sql to its v0.18.0 content (sha 36f63cb). The V13__owner_scope_notify_targets.sql migration already handles the schema change correctly for both existing and fresh databases (since ALTER COLUMN DROP NOT NULL is a no-op if the column is already nullable).

Environment

  • IronClaw v0.18.0 → v0.19.0 upgrade
  • PostgreSQL 16 + pgvector 0.8.0
  • Platform: aarch64 Linux (NVIDIA DGX Spark)
  • Database backend: PostgreSQL (refinery migrations)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions