orvanta_api/models/migration_result.rs
1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 6.5.0
7 * Contact: contact@orvanta.cloud
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// MigrationResult : The outcome of a completed migration run. Since #1212 this is the *job's* result (`/jobs_u/get/{id}` -> `result`), not the body of `POST /run` -- that operation returns a job id and does not wait.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct MigrationResult {
17 /// Cumulative across attempts when the run was resumed -- it answers \"how much of this migration is done\", not \"how much did this attempt do\".
18 #[serde(rename = "rows_migrated")]
19 pub rows_migrated: i64,
20 /// cumulative across attempts, for the same reason.
21 #[serde(rename = "batches")]
22 pub batches: i32,
23 /// Non-empty only when execution stopped early -- a failed batch insert, a fetch failure after progress had been made, a checkpoint that could not be recorded, or the run being cancelled. Every prior batch is fully committed and is **not** rolled back, so `rows_migrated` always reflects what is actually in the target. Note the two shapes: an engine-side failure names *where* it stopped (`insert for batch 2 (after cursor ...) failed`), while a cancellation names the count inline.
24 #[serde(rename = "errors")]
25 pub errors: Vec<String>,
26}
27
28impl MigrationResult {
29 /// The outcome of a completed migration run. Since #1212 this is the *job's* result (`/jobs_u/get/{id}` -> `result`), not the body of `POST /run` -- that operation returns a job id and does not wait.
30 pub fn new(rows_migrated: i64, batches: i32, errors: Vec<String>) -> MigrationResult {
31 MigrationResult {
32 rows_migrated,
33 batches,
34 errors,
35 }
36 }
37}
38