Fixed:
✓ Removed DATE() function from UNIQUE constraint (not allowed in PostgreSQL)
✓ Removed foreign key reference to non-existent 'projects' table
✓ Changed to simple primary key constraints instead
✓ Created index for daily metrics rollup instead of UNIQUE(DATE())
Tested against production database:
✓ All 5 agent memory tables created (agent_prompt, agent_skill, agent_decision, agent_registry, role_prompt_mapping, prompt_usage_log)
✓ All indexes created successfully
✓ Database now at 21 tables total (14 existing + 7 new)
Migration sequence verified:
001_init_schema.sql ✓
002_m8_2_dual_write_chunks.sql ✓
003_workflows_schema.sql ✓
004_agent_memory_schema.sql ✓