Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix: backfill agent_id column on x_scheduled_posts and x_pending_reviews

nirholas92208ead0b26
diff --git a/api/_lib/migrations/2026-05-27-x-posts-agent-id-backfill.sql b/api/_lib/migrations/2026-05-27-x-posts-agent-id-backfill.sql
new file mode 100644
index 000000000..132590da7
--- /dev/null
+++ b/api/_lib/migrations/2026-05-27-x-posts-agent-id-backfill.sql
@@ -0,0 +1,10 @@
+-- Backfill migration: ensure agent_id exists on x_scheduled_posts and
+-- x_pending_reviews for tenant DBs created before the column was added.
+--
+-- Root cause: 2026-05-25-marketplace-and-social-tables.sql creates these
+-- tables with agent_id using CREATE TABLE IF NOT EXISTS, which is a no-op
+-- when the table already exists from an older deployment. The ALTER TABLE
+-- below is the idempotent fix.
+
+ALTER TABLE x_scheduled_posts ADD COLUMN IF NOT EXISTS agent_id uuid REFERENCES agent_identities(id) ON DELETE SET NULL;
+ALTER TABLE x_pending_reviews ADD COLUMN IF NOT EXISTS agent_id uuid REFERENCES agent_identities(id) ON DELETE SET NULL;