You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Powernode backend uses PostgreSQL (with pgvector for embeddings) and UUIDv7 primary keys across all tables. Models live under server/app/models/ in 13 namespace directories that reflect feature domains (account, ai, chat, database, data_management, devops, file_management, knowledge_base, mcp, monitoring, review, shared, supply_chain), alongside the top-level core models. This reference catalogues each namespace, summarises the tables per area, and documents the schema conventions that controllers, migrations, and seeds must follow.
Model Namespaces
Top-Level Models
Core platform models not in a namespace.
Model
Description
User
Platform users with authentication and permissions
MCP protocol principal records. (The MCP server/tool/session/execution models listed under Top-Level Models above are not namespaced; only Principal lives under Mcp::.)
Model
Description
Principal
MCP authentication principal (token-bearing caller identity)
Key Relationships
flowchart LR
Account --> User
User --> Role
Role --> Permission
Account --> Subscription
Subscription --> Plan
Account --> AiAgent[Ai::Agent]
AiAgent --> AiAgentExecution[Ai::AgentExecution]
Account --> AiMission[Ai::Mission]
AiMission --> AiMissionApproval[Ai::MissionApproval]
Account --> AiRalphLoop[Ai::RalphLoop]
AiRalphLoop --> AiRalphTask[Ai::RalphTask]
Account --> AiAgentTeam[Ai::AgentTeam]
AiAgentTeam --> AiAgentTeamMember[Ai::AgentTeamMember]
Account --> AiKnowledgeGraphNode[Ai::KnowledgeGraphNode]
AiKnowledgeGraphNode --> AiKnowledgeGraphEdge[Ai::KnowledgeGraphEdge]
Account --> DevopsPipeline[Devops::Pipeline]
DevopsPipeline --> DevopsPipelineRun[Devops::PipelineRun]
Account --> Invoice
Invoice --> Payment
Loading
Database Conventions
Convention
Detail
Primary keys
UUIDv7 (chronologically sortable) — generate via UUID7.generate
Foreign keys
t.references with type :uuid (index included automatically — never add_index separately)
Always pair class_name: with foreign_key: — e.g. belongs_to :provider, class_name: "Ai::Provider", foreign_key: "ai_provider_id".
All namespaced models MUST use :: separator in class_name: — e.g. class_name: "Ai::AgentTeam", never "AiAgentTeam".
Migration patterns:
t.references automatically creates an index; never add add_index for reference columns. Customise via the declaration itself: t.references :account, index: { unique: true }.
After modifying seeds, run cd server && rails db:seed and verify completion.