Migration failure when upgrading from Nakama 3.32.1 → 3.34.1 (console_user.acl column missing)

Hi,
I upgraded my Nakama server from 3.32.1 to 3.34.1 and encountered a migration failure related to the console_user table.

Setup
• Nakama version before upgrade: 3.32.1
• Nakama version after upgrade: 3.34.1
• Database: CockroachDB v24.3.15
• Deployment: Docker
• Startup command: nakama migrate up --database.address …

Errors

2025-11-18 17:33:42 {"level":"info","ts":"2025-11-18T14:03:42.136Z","caller":"server/db.go:140","msg":"Database information","version":"CockroachDB CCL v24.3.15 (x86_64-pc-linux-gnu, built 2025/06/23 13:44:54, go1.22.8 X:nocoverageredesign)"}
2025-11-18 17:33:42 {"level":"info","ts":"2025-11-18T14:03:42.136Z","caller":"migrate/migrate.go:109","msg":"Applying database migrations","limit":-1}
2025-11-18 17:33:42 {"level":"fatal","ts":"2025-11-18T14:03:42.152Z","caller":"migrate/migrate.go:113","msg":"Failed to apply migrations","count":0,"error":"failed to exec migration statement \"\\n\\nUPDATE console_user\\n    SET acl = CASE\\n        WHEN role = 1 THEN '{\\\"admin\\\":true}'::jsonb\\n        ELSE '{\\\"admin\\\":false}'::jsonb\\n    END;\\n\": ERROR: column \"acl\" does not exist (SQLSTATE 42703)"}
2025-11-18 17:33:42 {"level":"info","ts":"2025-11-18T14:03:42.568Z","caller":"server/db.go:140","msg":"Database information","version":"CockroachDB CCL v24.3.15 (x86_64-pc-linux-gnu, built 2025/06/23 13:44:54, go1.22.8 X:nocoverageredesign)"}

It seems the migration attempts to update the new acl column on console_user, but that column does not exist in my database schema.
This causes migration failure and prevents Nakama from starting.
Any guidance would be appreciated.

1 Like

Hi @sadegh-askari,

I just attempted to migrate from a clean cockroach db, first to version 3.32.1, and then to 3.34.1, and I didn’t observe any issues.

I find it odd that the column doesn’t exist, it should as it’s created immediately before running that UPDATE statement: nakama/migrate/sql/20250926112031-console-fine-grained-acl.sql at v3.34.1 · heroiclabs/nakama · GitHub.

Could you please provide the output of your crdb nakama db migration_info table, and the current schema of console_user please?

Hi, I also have issues with migration after updating from 3.26 to 3.34.1

nakama-1       | {"level":"info","ts":"2025-11-21T08:57:18.588Z","caller":"migrate/migrate.go:109","msg":"Applying database migrations","limit":-1}
nakama-1       | {"level":"fatal","ts":"2025-11-21T08:57:18.640Z","caller":"migrate/migrate.go:113","msg":"Failed to apply migrations","count":0,"error":"failed to exec migration statement \"\\n\\nUPDATE console_user\\n    SET acl = CASE\\n        WHEN role = 1 THEN '{\\\"admin\\\":true}'::jsonb\\n        ELSE '{\\\"admin\\\":false}'::jsonb\\n    END;\\n\": ERROR: column \"acl\" does not exist (SQLSTATE 42703)"}

Migration info:

console_user schema:

Thanks for any advices :wink:

Here is the output you requested.

Migration Info:

console_user Table Schema:

@MichalKrela did you get the error on CockroachDB as well? If yes, which version?

Not really, at least nothing was printed to the console as a separate log. I digged into cockroach log file, attaching to this message. I was on v23.2, then I updated to 24.1, but nothing changed after the update.

cockroachdblogs.txt (253.8 KB)

I tested on v25.3 and the error seems to be gone.

Alternatively, you could just try to run the following SQL:

ALTER TABLE console_user ADD COLUMN IF NOT EXISTS acl jsonb NOT NULL DEFAULT '{"admin":false}'::jsonb;

UPDATE console_user
    SET acl = CASE
        WHEN role = 1 THEN '{"admin":true}'::jsonb
        ELSE '{"admin":false}'::jsonb
    END;
ALTER TABLE console_user DROP COLUMN IF EXISTS role;

on the DB, the migration should succeed afterwards (assuming the DB is on a recent enough schema).

I tried running the manual SQL statements you provided:
But CockroachDB rejected them due to sql_safe_updates being enabled. These are the errors I received:

ERROR: rejected (sql_safe_updates = true): UPDATE without WHERE or LIMIT clause
ERROR: rejected (sql_safe_updates = true): ALTER TABLE DROP COLUMN will remove all data in that column and drop any indexes that reference that column
HINT: See: https://go.crdb.dev/issue-v/46541/v24.3

It looks like CockroachDB blocks UPDATE statements without a WHERE clause and DROP COLUMN statements when sql_safe_updates is true.

This might be the root cause of the original migration failure as well, since the migration script runs the same UPDATE statement without a WHERE clause.

1 Like

I have not seen this rejection error before and I’d assume this flag is only on from CRDB client connections to the database. Plus, I’ve had no issue migrating on CRDB 25.3 as mentioned above. I don’t think this is the issue that was causing the migration to fail. If this prevented you from running the queries with the fix, you’d only need to:

SET sql_safe_updates = false;

in your cli session before running the queries.

Best.