chore: sync current workspace changes
Desktop CI Build / Build macOS ARM64 DMG (push) Has been cancelled
Desktop CI Build / Build Windows x64 (push) Has been cancelled
Desktop CI Build / Build macOS ARM64 DMG (push) Has been cancelled
Desktop CI Build / Build Windows x64 (push) Has been cancelled
This commit is contained in:
@@ -33,6 +33,7 @@ mod m20260501_000001_add_knowledge_base_rerank_settings;
|
||||
mod m20260504_000001_split_openai_compatible_provider_types;
|
||||
mod m20260515_000001_add_knowledge_base_index_schedule;
|
||||
mod m20260518_000001_add_builtin_model_deletions;
|
||||
mod m20260710_000001_agent_run_state;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
@@ -73,6 +74,7 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20260504_000001_split_openai_compatible_provider_types::Migration),
|
||||
Box::new(m20260515_000001_add_knowledge_base_index_schedule::Migration),
|
||||
Box::new(m20260518_000001_add_builtin_model_deletions::Migration),
|
||||
Box::new(m20260710_000001_agent_run_state::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
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> {
|
||||
for column in [
|
||||
ColumnDef::new(Alias::new("current_run_id")).string().null().to_owned(),
|
||||
ColumnDef::new(Alias::new("host_access_enabled"))
|
||||
.boolean()
|
||||
.not_null()
|
||||
.default(false)
|
||||
.to_owned(),
|
||||
ColumnDef::new(Alias::new("revision"))
|
||||
.big_integer()
|
||||
.not_null()
|
||||
.default(0)
|
||||
.to_owned(),
|
||||
ColumnDef::new(Alias::new("context_version"))
|
||||
.integer()
|
||||
.not_null()
|
||||
.default(1)
|
||||
.to_owned(),
|
||||
ColumnDef::new(Alias::new("last_provider_id"))
|
||||
.string()
|
||||
.null()
|
||||
.to_owned(),
|
||||
ColumnDef::new(Alias::new("last_model_id")).string().null().to_owned(),
|
||||
] {
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(Alias::new("agent_sessions"))
|
||||
.add_column(column)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(Alias::new("agent_runs"))
|
||||
.if_not_exists()
|
||||
.col(
|
||||
ColumnDef::new(Alias::new("id"))
|
||||
.string()
|
||||
.not_null()
|
||||
.primary_key(),
|
||||
)
|
||||
.col(ColumnDef::new(Alias::new("session_id")).string().not_null())
|
||||
.col(
|
||||
ColumnDef::new(Alias::new("conversation_id"))
|
||||
.string()
|
||||
.not_null(),
|
||||
)
|
||||
.col(
|
||||
ColumnDef::new(Alias::new("status"))
|
||||
.string()
|
||||
.not_null()
|
||||
.default("starting"),
|
||||
)
|
||||
.col(ColumnDef::new(Alias::new("assistant_message_id")).string().null())
|
||||
.col(ColumnDef::new(Alias::new("error_message")).text().null())
|
||||
.col(ColumnDef::new(Alias::new("created_at")).string().not_null())
|
||||
.col(ColumnDef::new(Alias::new("updated_at")).string().not_null())
|
||||
.col(ColumnDef::new(Alias::new("finished_at")).string().null())
|
||||
.foreign_key(
|
||||
ForeignKey::create()
|
||||
.name("fk-agent-runs-session")
|
||||
.from(Alias::new("agent_runs"), Alias::new("session_id"))
|
||||
.to(Alias::new("agent_sessions"), Alias::new("id"))
|
||||
.on_delete(ForeignKeyAction::Cascade),
|
||||
)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
manager
|
||||
.create_index(
|
||||
Index::create()
|
||||
.name("idx-agent-runs-conversation-created")
|
||||
.table(Alias::new("agent_runs"))
|
||||
.col(Alias::new("conversation_id"))
|
||||
.col(Alias::new("created_at"))
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
manager
|
||||
.create_index(
|
||||
Index::create()
|
||||
.name("idx-agent-sessions-conversation-unique")
|
||||
.table(Alias::new("agent_sessions"))
|
||||
.col(Alias::new("conversation_id"))
|
||||
.unique()
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(Alias::new("agent_runs")).to_owned())
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user