Skip to main content

windmill_api/models/
publish_migration_body.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.770.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// PublishMigrationBody : one best-effort data table migration attached to a project (per data table)
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct PublishMigrationBody {
17    #[serde(rename = "datatable_name")]
18    pub datatable_name: String,
19    #[serde(rename = "sql")]
20    pub sql: String,
21    /// defaults to an empty string when omitted
22    #[serde(rename = "sql_down", skip_serializing_if = "Option::is_none")]
23    pub sql_down: Option<String>,
24    #[serde(rename = "enabled")]
25    pub enabled: bool,
26}
27
28impl PublishMigrationBody {
29    /// one best-effort data table migration attached to a project (per data table)
30    pub fn new(datatable_name: String, sql: String, enabled: bool) -> PublishMigrationBody {
31        PublishMigrationBody {
32            datatable_name,
33            sql,
34            sql_down: None,
35            enabled,
36        }
37    }
38}
39