TurboPanel Docs
Database

Managed databases

Managed database instances, their replicas, backups and recovery runs.

Tables on this page: backup · managed · recovery · replica. Generated from migration 0004_schema_comments; see How to read this.

backup

One completed managed-engine backup artifact recorded from the daemon's managed.backup result; unique per (managed_id, backup_id), cascades with the cluster.

ColumnTypeNullDefaultDescription
id (PK)uuidnouuidv7()Primary key (uuidv7(), time-ordered).
created_attimestamp(3) with time zonenonow()Row creation time.
managed_iduuidnoFK → managed.id (on delete cascade).
backup_idtextnoDaemon-minted bk_ plus hex token that is also the artifact filename on the host; unique per managed engine, not globally.
size_bytesbigintnoArtifact size in bytes as reported by the daemon after writing the dump; re-checked before a restore.
checksumtextnoLowercase SHA-256 hex digest of the artifact computed by the daemon; a restore refuses on mismatch.
databasetextyesDatabase name for a single-database backup; null for an instance-scope backup.
pathtextnoAbsolute artifact path on the primary server's filesystem as reported by the daemon.

Constraints and indexes

  • Index idx_backup_managed_id_created_at: (managed_id, created_at)
  • Unique index uniq_backup_managed_backup_id: (managed_id, backup_id)
  • Check backup_id_format_check: backup_id ~ '^[A-Za-z0-9_-]+$'
  • Check backup_checksum_format_check: checksum ~ '^[a-f0-9]{64}$'
  • Check backup_size_bytes_check: size_bytes >= 0

managed

One managed database cluster per environment (1:1 via unique environment_id); created by the managed create route, status projected by the command consumer.

ColumnTypeNullDefaultDescription
id (PK)uuidnouuidv7()Primary key (uuidv7(), time-ordered).
created_attimestamp(3) with time zonenonow()Row creation time.
updated_attimestamp(3) with time zonenonow()Last write time; the ORM sets it to now() on every update.
metadatajsonbyesResidual cluster facts: rootPrincipalId and rootUsername set at create, plus host, port and error written by the command consumer from daemon results.
optionsjsonbyesOperator settings jsonb with keys settings (engine ManagedSettings) and databases (string array), written by the managed routes and parsed per engine spec.
environment_iduuidnoFK → environment.id (on delete cascade). Owning environment; exactly one managed row per environment (unique index), cascade-deleted with it.
server_iduuidyesFK → server.id (on delete restrict). Placement pin of the primary member's host, copied from the environment at create and re-set by the consumer only on a primary-member apply success.
nametextyesOperator label for the cluster (1-255 chars of letters, digits, space, dot, underscore, hyphen); null when unnamed.
enginetextnoCatalog engine code set once at create from ManagedEngineSpec: postgres, mysql, mariadb, redis or clickhouse (only the first three are creatable).
statustextyesLifecycle state: provisioning at create, applying while a command is queued, then daemon-observed ready, stopped or failed projected by the consumer.

Constraints and indexes

  • Index idx_managed_environment_id: (environment_id)
  • Index idx_managed_server_id: (server_id)
  • Index idx_managed_engine: (engine)
  • Unique index managed_environment_id_unique: (environment_id)
  • Check managed_name_format_check: ("managed"."name" IS NULL) OR (((char_length(("managed"."name")::text) >= 1) AND (char_length(("managed"."name")::text) <= 255)) AND (("managed"."name")::text ~ '^[A-Za-z0-9 ._-]+$'::text))
  • Check managed_status_check: status IS NULL OR status IN ('provisioning','applying','ready','stopped','failed')

recovery

Durable HA journal entry for one managed cluster recovery (failover, switchover or DR); at most one non-terminal row per managed_id, written by the HA flow.

ColumnTypeNullDefaultDescription
id (PK)uuidnouuidv7()Primary key (uuidv7(), time-ordered).
created_attimestamp(3) with time zonenonow()Row creation time.
updated_attimestamp(3) with time zonenonow()Last write time; the ORM sets it to now() on every update.
metadatajsonbyesFencing and progress facts: fencingEpoch, fenceCommandIds, promoteCommandId, haPresent, fenced, drainApplied, lagBytes, blockedReason.
optionsjsonbyesReserved jsonb; no current code path writes it.
managed_iduuidnoFK → managed.id (on delete cascade).
kindtextnoautomatic-failover, switchover (planned promotion of a failover replica) or disaster-recovery (promotion of a remote read replica).
source_primary_member_iduuidnoreplica.id of the primary being replaced, stored without an FK so deleting the member cannot block the journal.
target_member_iduuidyesreplica.id of the member being promoted, stored without an FK; null when an automatic failover was blocked with no eligible candidate.
statetextnoJournal phase: detecting, fencing, promoting, repointing, reconciling-ingress, verifying, then terminal completed, failed or blocked.
started_attimestamp(3) with time zonenonow()When the recovery was opened; set explicitly by insertRecovery together with the initial state.
completed_attimestamp(3) with time zoneyesWhen the recovery reached a terminal state; null while still in flight.

Constraints and indexes

  • Index idx_recovery_managed_id: (managed_id)
  • Unique index uniq_recovery_inflight_managed: (managed_id) where "recovery"."state" NOT IN ('completed','failed','blocked')
  • Check recovery_kind_check: "recovery"."kind" IN ('automatic-failover','switchover','disaster-recovery')
  • Check recovery_state_check: "recovery"."state" IN ('detecting','fencing','promoting','repointing','reconciling-ingress','verifying','completed','failed','blocked')

replica

One server's membership in a managed cluster (primary plus replicas); exactly one primary per managed_id, written by the member lifecycle and the consumer.

ColumnTypeNullDefaultDescription
id (PK)uuidnouuidv7()Primary key (uuidv7(), time-ordered).
created_attimestamp(3) with time zonenonow()Row creation time.
updated_attimestamp(3) with time zonenonow()Last write time; the ORM sets it to now() on every update.
metadatajsonbyesDaemon-observed replication health (state, observedAt, optional lagBytes, lagSeconds) written by the consumer after apply and lifecycle commands.
optionsjsonbyesReserved jsonb; no current code path writes it.
managed_iduuidnoFK → managed.id (on delete cascade).
server_iduuidnoFK → server.id (on delete restrict). Host running this member; one member per server per cluster and a private port is unique per server; deleting the server is restricted.
roletextno'primary'primary or replica; a partial unique index allows one primary per cluster and the consumer swaps roles on promote and failover.
replica_classtextyesfailover (same datacenter, promotable) or read (any org server, never auto-promoted); null on the primary and ignored when role is primary.
is_read_eligiblebooleannofalseWhether the listener may route read-only logins to this member; true on the primary, operator-chosen on replicas (API field readEligible).
ordinalintegerno11-based member ordinal, unique per cluster; the primary is 1 and it mirrors the engine service's container ordinal.
replication_transporttextyesResolved private path from this member to the primary: local, datacenter, fabric or public; null until resolved or on the primary.
private_portintegeryesHost port 45000-45999 published on the member's private address for replication and ProxySQL backends; allocated per server, null for single-member clusters.
statustextyesPer-member state: provisioning, applying, ready, stopped, failed or needs_resync (set on demote or a failed fence, never auto-cleared).

Constraints and indexes

  • Unique uniq_replica_managed_ordinal: (managed_id, ordinal)
  • Unique uniq_replica_managed_server: (managed_id, server_id)
  • Index idx_replica_managed_id: (managed_id)
  • Index idx_replica_server_id: (server_id)
  • Unique index uniq_replica_primary: (managed_id) where "replica"."role" = 'primary'
  • Unique index uniq_replica_server_private_port: (server_id, private_port) where "replica"."private_port" IS NOT NULL
  • Check replica_role_check: "replica"."role" IN ('primary','replica')
  • Check replica_replica_class_check: "replica"."replica_class" IS NULL OR "replica"."replica_class" IN ('failover','read')
  • Check replica_ordinal_positive_check: "replica"."ordinal" >= 1
  • Check replica_transport_check: "replica"."replication_transport" IS NULL OR "replica"."replication_transport" IN ('local','fabric','datacenter','public')
  • Check replica_status_check: status IS NULL OR status IN ('provisioning','applying','ready','stopped','failed','needs_resync')
Edit on GitHub

Last updated on

On this page