Expand description
Setup command and connection validation for deployment tracking infrastructure.
Provides three concerns:
setup()— Idempotent, self-healing creation of the_mz_deploydatabase, tables, views, indexes, and (when RBAC is enabled) roles. The only function that writes to_mz_deploy. Invoked exclusively by the explicitsetupCLI command. When RBAC is enabled, must run as a superuser: phase 4 issuesGRANT ... ON SYSTEMstatements (CREATEDB, CREATECLUSTER) that only a superuser can execute under RBAC. When RBAC is disabled, the role/grant phase is skipped entirely. Safe to re-run.verify()— Read-only existence check. Every non-setupcommand calls this and surfacesCliError::SetupRequiredif the infrastructure is missing or partially installed. Never writes.validate_connection()— Pre-flight checks that the connected role has exactly one mz-deploy role membership.run()— ThesetupCLI command entry point.
Enums§
- MzDeploy
Role - The mz-deploy role assigned to the current database user.
Functions§
- is_
rbac_ enabled - require_
createdb - Verify the current role has
CREATEDBprivilege.mz-deploy devcalls this before attempting to create overlay databases. - require_
deployer - Require that the validated role is
Deployer. - require_
developer - Require that the validated role is
Developer. - run
- Initialize deployment tracking database and tables.
- setup
- Bring the deployment tracking infrastructure up to the current schema.
- validate_
connection - Validate that the current role has a valid mz-deploy role membership or is a superuser. Returns the detected role on success.
- verify
- Check that every object
setupwould create is already present.