feat: add worker operations and fix gitea actions
Some checks failed
docker-images / build-and-push (admin, admin, termi-astro-admin, admin/Dockerfile) (push) Successful in 29s
docker-images / build-and-push (backend, backend, termi-astro-backend, backend/Dockerfile) (push) Successful in 33m13s
docker-images / build-and-push (frontend, frontend, termi-astro-frontend, frontend/Dockerfile) (push) Successful in 58s
ui-regression / playwright-regression (push) Failing after 13m24s
Some checks failed
docker-images / build-and-push (admin, admin, termi-astro-admin, admin/Dockerfile) (push) Successful in 29s
docker-images / build-and-push (backend, backend, termi-astro-backend, backend/Dockerfile) (push) Successful in 33m13s
docker-images / build-and-push (frontend, frontend, termi-astro-frontend, frontend/Dockerfile) (push) Successful in 58s
ui-regression / playwright-regression (push) Failing after 13m24s
This commit is contained in:
@@ -43,6 +43,7 @@ mod m20260401_000032_add_runtime_security_keys_to_site_settings;
|
||||
mod m20260401_000033_add_taxonomy_metadata_and_media_assets;
|
||||
mod m20260401_000034_add_source_markdown_to_posts;
|
||||
mod m20260401_000035_add_human_verification_modes_to_site_settings;
|
||||
mod m20260402_000036_create_worker_jobs;
|
||||
pub struct Migrator;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
@@ -90,6 +91,7 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20260401_000033_add_taxonomy_metadata_and_media_assets::Migration),
|
||||
Box::new(m20260401_000034_add_source_markdown_to_posts::Migration),
|
||||
Box::new(m20260401_000035_add_human_verification_modes_to_site_settings::Migration),
|
||||
Box::new(m20260402_000036_create_worker_jobs::Migration),
|
||||
// inject-above (do not remove this comment)
|
||||
]
|
||||
}
|
||||
|
||||
98
backend/migration/src/m20260402_000036_create_worker_jobs.rs
Normal file
98
backend/migration/src/m20260402_000036_create_worker_jobs.rs
Normal file
@@ -0,0 +1,98 @@
|
||||
use loco_rs::schema::*;
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
#[derive(DeriveMigrationName)]
|
||||
pub struct Migration;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
create_table(
|
||||
manager,
|
||||
"worker_jobs",
|
||||
&[
|
||||
("id", ColType::PkAuto),
|
||||
("parent_job_id", ColType::IntegerNull),
|
||||
("job_kind", ColType::String),
|
||||
("worker_name", ColType::String),
|
||||
("display_name", ColType::StringNull),
|
||||
("status", ColType::String),
|
||||
("queue_name", ColType::StringNull),
|
||||
("requested_by", ColType::StringNull),
|
||||
("requested_source", ColType::StringNull),
|
||||
("trigger_mode", ColType::StringNull),
|
||||
("payload", ColType::JsonBinaryNull),
|
||||
("result", ColType::JsonBinaryNull),
|
||||
("error_text", ColType::TextNull),
|
||||
("tags", ColType::JsonBinaryNull),
|
||||
("related_entity_type", ColType::StringNull),
|
||||
("related_entity_id", ColType::StringNull),
|
||||
("attempts_count", ColType::Integer),
|
||||
("max_attempts", ColType::Integer),
|
||||
("cancel_requested", ColType::Boolean),
|
||||
("queued_at", ColType::StringNull),
|
||||
("started_at", ColType::StringNull),
|
||||
("finished_at", ColType::StringNull),
|
||||
],
|
||||
&[],
|
||||
)
|
||||
.await?;
|
||||
|
||||
for (name, columns) in [
|
||||
(
|
||||
"idx_worker_jobs_status_created_at",
|
||||
vec![Alias::new("status"), Alias::new("created_at")],
|
||||
),
|
||||
(
|
||||
"idx_worker_jobs_worker_status_created_at",
|
||||
vec![
|
||||
Alias::new("worker_name"),
|
||||
Alias::new("status"),
|
||||
Alias::new("created_at"),
|
||||
],
|
||||
),
|
||||
(
|
||||
"idx_worker_jobs_kind_created_at",
|
||||
vec![Alias::new("job_kind"), Alias::new("created_at")],
|
||||
),
|
||||
(
|
||||
"idx_worker_jobs_related_entity",
|
||||
vec![Alias::new("related_entity_type"), Alias::new("related_entity_id")],
|
||||
),
|
||||
(
|
||||
"idx_worker_jobs_parent_job_id",
|
||||
vec![Alias::new("parent_job_id")],
|
||||
),
|
||||
] {
|
||||
let mut statement = Index::create();
|
||||
statement.name(name).table(Alias::new("worker_jobs"));
|
||||
for column in columns {
|
||||
statement.col(column);
|
||||
}
|
||||
manager.create_index(statement.to_owned()).await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
for index_name in [
|
||||
"idx_worker_jobs_parent_job_id",
|
||||
"idx_worker_jobs_related_entity",
|
||||
"idx_worker_jobs_kind_created_at",
|
||||
"idx_worker_jobs_worker_status_created_at",
|
||||
"idx_worker_jobs_status_created_at",
|
||||
] {
|
||||
manager
|
||||
.drop_index(
|
||||
Index::drop()
|
||||
.name(index_name)
|
||||
.table(Alias::new("worker_jobs"))
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
drop_table(manager, "worker_jobs").await
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user