Skip to main content

windmill_api/models/
datatable_migration_with_status.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.841.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct DatatableMigrationWithStatus {
16    #[serde(rename = "timestamp")]
17    pub timestamp: i64,
18    #[serde(rename = "name")]
19    pub name: String,
20    #[serde(rename = "code_up")]
21    pub code_up: String,
22    #[serde(rename = "code_down", skip_serializing_if = "Option::is_none")]
23    pub code_down: Option<String>,
24    #[serde(rename = "status")]
25    pub status: Status,
26    /// the schemas its `-- schemas` annotation declares; absent when it applies to the whole database
27    #[serde(rename = "schemas", skip_serializing_if = "Option::is_none")]
28    pub schemas: Option<Vec<String>>,
29    /// when not run, the earliest pending migration that must be applied first; when run, the latest applied migration that must be rolled back first
30    #[serde(rename = "blocked_by", skip_serializing_if = "Option::is_none")]
31    pub blocked_by: Option<i64>,
32}
33
34impl DatatableMigrationWithStatus {
35    pub fn new(timestamp: i64, name: String, code_up: String, status: Status) -> DatatableMigrationWithStatus {
36        DatatableMigrationWithStatus {
37            timestamp,
38            name,
39            code_up,
40            code_down: None,
41            status,
42            schemas: None,
43            blocked_by: None,
44        }
45    }
46}
47/// 
48#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
49pub enum Status {
50    #[serde(rename = "ran")]
51    Ran,
52    #[serde(rename = "not_run")]
53    NotRun,
54    #[serde(rename = "unknown")]
55    Unknown,
56}
57
58impl Default for Status {
59    fn default() -> Status {
60        Self::Ran
61    }
62}
63