SQLStreams

the messaging platform that is just Postgres

You last visited on 9999-99-99 Show what's new since then

Delete the system

Edit this page
System · Related pages
Posted: 2026-09-16 · Report this thread
brandon Site Admin brandon profile Posts: 96
Destroy(ctx context.Context, options *DestroyOptions) error

Permanently deletes every SQLStreams stream and message in the installation, including built-in streams, consumer groups, schedules, workers, and shared tables. The PostgreSQL schema itself remains.

Example

Use an initialized client with ClientConfig.AllowDestroy enabled. Stop applications using the installation and remove user streams before calling with the default guards.

if err := client.System().Destroy(ctx, nil); err != nil {
return err
}

Parameters

Parameter Type Required Description
ctx context.Context Yes Cancellation or its deadline interrupts deletion. Earlier deletion steps remain completed.
options *DestroyOptions No nil retains the live-worker and user-stream guards.

DestroyOptions

Field Type Default Description
Force bool false Bypasses live-worker and registered-user-stream checks. Does not stop those processes or bypass ClientConfig.AllowDestroy.

Returns

Condition Return value
Deletion succeeds nil.
System is already absent and deletion is enabled nil.
Deletion is disabled, refused, or fails A non-nil error.

CLI

sqlstreams system destroy --yes

--yes skips typing the database name to confirm. --force bypasses the live-worker and user-stream guards. Noninteractive use and --output json require --yes. Unlike the Go API, the CLI reports an absent system as a failure.

Errors

Error When
ErrDestroyDisabled The client was created without AllowDestroy.
ErrSystemLive A worker instance is live and Force is false.
ErrStreamsRegistered A non-system stream remains registered and Force is false.
ErrStreamPartitionsRemain A stream’s partitions cannot be fully removed.
Database or context error A deletion step fails or is interrupted.