Skip to main content

write_to_database

Function write_to_database 

Source
pub(crate) async fn write_to_database(
    client: &Client,
    snapshot: &DeploymentSnapshot,
    deploy_id: &str,
    metadata: &DeploymentMetadata,
    promoted_at: Option<DateTime<Utc>>,
    mode: DeploymentMode,
) -> Result<(), DeploymentSnapshotError>
Expand description

Write deployment snapshot to the database using the normalized schema.

This writes to both deployments and objects tables. Schema deployments are inserted (no delete), while object deployments are appended (insert-only history).

ยงArguments

  • client - Database client connection
  • snapshot - The deployment snapshot to write (includes per-schema deployment kind)
  • deploy_id - Deploy ID (e.g., "<init>" for direct deploy, "staging" for staged)
  • metadata - Deployment metadata (user, git commit, etc.)
  • promoted_at - Optional promoted_at timestamp (Some(now) for direct apply, None for stage)
  • mode - Deployment mode tag stored on each row