phase 4: fix execution FK violation — create entity row before insert
- phase3.go: RequestExecution now calls InsertEntity before InsertExecution (executions.entity_id references entities.id via FK constraint). - mcp/server.go: request_execution MCP tool same fix — inserts entities row with slug 'exec:<target>:<id8>' before executions insert. - docker-compose.yml: fix seed OIKOS_SEEDS_DIR from /app/seeds to /seeds (distroless image COPY destination).
This commit is contained in:
@@ -504,6 +504,18 @@ func (s *Server) RequestExecution(ctx context.Context, req gen.RequestExecutionR
|
||||
defer tx.Rollback(ctx)
|
||||
|
||||
q := sqlcgen.New(tx)
|
||||
|
||||
execSlug := "exec:" + id.String()[:8]
|
||||
if _, err := q.InsertEntity(ctx, sqlcgen.InsertEntityParams{
|
||||
ID: id,
|
||||
Slug: execSlug,
|
||||
Type: "execution",
|
||||
Name: req.Body.Action + " on " + req.Body.Target,
|
||||
Attributes: []byte("{}"),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := q.InsertExecution(ctx, sqlcgen.InsertExecutionParams{
|
||||
EntityID: id,
|
||||
TargetEntityID: &targetID,
|
||||
|
||||
Reference in New Issue
Block a user