diff --git a/jupiter/callisto/src/builds.rs b/jupiter/callisto/src/builds.rs index 1709def69..66edddc79 100644 --- a/jupiter/callisto/src/builds.rs +++ b/jupiter/callisto/src/builds.rs @@ -8,12 +8,17 @@ use serde::{Deserialize, Serialize}; pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub build_id: Uuid, - pub output: String, pub exit_code: Option, pub start_at: DateTime, pub end_at: Option, pub repo_name: String, pub target: String, + #[sea_orm(column_type = "Text")] + pub output_file: String, + #[sea_orm(column_type = "Text")] + pub arguments: String, + #[sea_orm(column_type = "Text")] + pub mr: String, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] diff --git a/jupiter/src/migration/m20250819_025231_alter_builds.rs b/jupiter/src/migration/m20250819_025231_alter_builds.rs new file mode 100644 index 000000000..d1542ab65 --- /dev/null +++ b/jupiter/src/migration/m20250819_025231_alter_builds.rs @@ -0,0 +1,43 @@ +use sea_orm::DatabaseBackend; +use sea_orm_migration::{prelude::*, schema::*}; + +#[derive(DeriveMigrationName)] +pub struct Migration; + +#[async_trait::async_trait] +impl MigrationTrait for Migration { + async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { + let backend = manager.get_database_backend(); + + match backend { + DatabaseBackend::Postgres | DatabaseBackend::MySql => { + manager + .alter_table( + Table::alter() + .table(Builds::Table) + .drop_column("output") + .add_column_if_not_exists(text(Builds::OutputFile)) + .add_column_if_not_exists(text(Builds::Arguments)) + .add_column_if_not_exists(text(Builds::Mr)) + .to_owned(), + ) + .await?; + } + DatabaseBackend::Sqlite => {} + } + + Ok(()) + } + + async fn down(&self, _: &SchemaManager) -> Result<(), DbErr> { + Ok(()) + } +} + +#[derive(DeriveIden)] +enum Builds { + Table, + OutputFile, + Arguments, + Mr, +} diff --git a/jupiter/src/migration/mod.rs b/jupiter/src/migration/mod.rs index 62bdd3544..f150a8a64 100644 --- a/jupiter/src/migration/mod.rs +++ b/jupiter/src/migration/mod.rs @@ -48,6 +48,7 @@ mod m20250725_103004_add_note; mod m20250804_151214_alter_builds_end_at; mod m20250812_022434_alter_mega_mr; mod m20250815_075653_remove_commit_id; +mod m20250819_025231_alter_builds; /// Creates a primary key column definition with big integer type. /// /// # Arguments @@ -83,6 +84,7 @@ impl MigratorTrait for Migrator { Box::new(m20250804_151214_alter_builds_end_at::Migration), Box::new(m20250812_022434_alter_mega_mr::Migration), Box::new(m20250815_075653_remove_commit_id::Migration), + Box::new(m20250819_025231_alter_builds::Migration), ] } }