Documentation
¶
Overview ¶
Command wg-init creates a deployment's first organisation and administrator.
`workgraph-migrate -fresh` leaves the schema with nobody in it, which is correct and unusable: every request is resolved to a user row and refused when there is none, so with no users there is no way in to create the first one. This writes that row.
Run once, at install time, on a host with database access — the same place and the same way as wg-registry. It connects as the application role and does its work through system_bootstrap_organisation, which is SECURITY DEFINER because at bootstrap there is no app user for RLS to check by definition.
wg-init -org acme -org-name "Acme Ltd" \
-admin-email ops@acme.example -admin-name "Dana Ops"
Idempotent: running it again with the same arguments reports already_initialised and changes nothing. It refuses to create a second organisation, because one company per deployment is the documented stance and a bootstrap tool that could quietly add a tenant would contradict it.
Flags rather than prompts, deliberately. This runs inside an install script next to the migration step, and a tool that stops to ask cannot be run unattended. Everything it needs is on the command line or it refuses and says which part is missing.