Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion jupiter/callisto/src/builds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32>,
pub start_at: DateTime,
pub end_at: Option<DateTime>,
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)]
Expand Down
43 changes: 43 additions & 0 deletions jupiter/src/migration/m20250819_025231_alter_builds.rs
Original file line number Diff line number Diff line change
@@ -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,
}
2 changes: 2 additions & 0 deletions jupiter/src/migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
]
}
}
Expand Down
Loading