refactor(migrate,models): apply rustfmt formatting
This commit is contained in:
parent
4c4c33f970
commit
8fd6dbb68b
@ -40,8 +40,12 @@ pub struct Migrator;
|
||||
#[async_trait::async_trait]
|
||||
impl MigratorTrait for Migrator {
|
||||
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
|
||||
vec![Box::new(init::Migration)]
|
||||
vec![
|
||||
Box::new(init::Migration),
|
||||
Box::new(room_compact_summary::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub mod init;
|
||||
pub mod room_compact_summary;
|
||||
|
||||
31
libs/migrate/room_compact_summary.rs
Normal file
31
libs/migrate/room_compact_summary.rs
Normal file
@ -0,0 +1,31 @@
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub struct Migration;
|
||||
|
||||
impl MigrationName for Migration {
|
||||
fn name(&self) -> &str {
|
||||
"room_compact_summary"
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
let sql = include_str!("sql/room_compact_summary.sql");
|
||||
super::execute_sql(manager, sql).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.get_connection()
|
||||
.execute_unprepared(
|
||||
r#"
|
||||
DROP INDEX IF EXISTS idx_room_compact_summary_room_to_seq;
|
||||
DROP TABLE IF EXISTS room_compact_summary;
|
||||
"#,
|
||||
)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
16
libs/migrate/sql/room_compact_summary.sql
Normal file
16
libs/migrate/sql/room_compact_summary.sql
Normal file
@ -0,0 +1,16 @@
|
||||
CREATE TABLE IF NOT EXISTS room_compact_summary
|
||||
(
|
||||
id uuid NOT NULL
|
||||
PRIMARY KEY,
|
||||
room uuid NOT NULL,
|
||||
from_seq bigint NOT NULL,
|
||||
to_seq bigint NOT NULL,
|
||||
summary text NOT NULL,
|
||||
message_count integer NOT NULL,
|
||||
source_message_ids jsonb DEFAULT '[]'::jsonb NOT NULL,
|
||||
created_at timestamp with time zone NOT NULL,
|
||||
updated_at timestamp with time zone NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_room_compact_summary_room_to_seq
|
||||
ON room_compact_summary (room, to_seq DESC);
|
||||
@ -2,9 +2,7 @@ use crate::{DateTimeUtc, ProjectId, UserId};
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, PartialEq, Eq, Serialize, Deserialize, DeriveEntityModel,
|
||||
)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "ai_conversation")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
|
||||
@ -2,9 +2,7 @@ use crate::{DateTimeUtc, Uuid};
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, PartialEq, Eq, Serialize, Deserialize, DeriveEntityModel,
|
||||
)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "ai_message")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
|
||||
@ -3,9 +3,7 @@ use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, PartialEq, Eq, Serialize, Deserialize, DeriveEntityModel,
|
||||
)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "ai_message_fork")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
|
||||
@ -2,9 +2,7 @@ use crate::{DateTimeUtc, UserId};
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, PartialEq, Eq, Serialize, Deserialize, DeriveEntityModel,
|
||||
)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "ai_shared_conversation")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
|
||||
@ -2,9 +2,7 @@ use crate::{DateTimeUtc, UserId};
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, PartialEq, Eq, Serialize, Deserialize, DeriveEntityModel,
|
||||
)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "ai_token_usage")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
|
||||
@ -50,8 +50,8 @@ pub mod ai_message;
|
||||
pub mod ai_message_fork;
|
||||
pub mod ai_session;
|
||||
pub mod ai_shared_conversation;
|
||||
pub mod ai_token_usage;
|
||||
pub mod ai_tool_auth;
|
||||
pub mod ai_tool_call;
|
||||
pub mod ai_token_usage;
|
||||
pub mod billing_error;
|
||||
pub mod subscription;
|
||||
|
||||
@ -4,9 +4,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Project-level context management settings.
|
||||
/// Controls compaction (sliding window) and RAG behavior.
|
||||
#[derive(
|
||||
Clone, Debug, PartialEq, Serialize, Deserialize, DeriveEntityModel,
|
||||
)]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "project_context_setting")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
pub use user::Entity as User;
|
||||
pub use user_2fa::Entity as User2fa;
|
||||
pub use user_activity_log::Entity as UserActivityLog;
|
||||
pub use user_billing::Entity as UserBilling;
|
||||
pub use user_email::Entity as UserEmail;
|
||||
pub use user_email_change::Entity as UserEmailChange;
|
||||
pub use user_notification::Entity as UserNotification;
|
||||
@ -10,11 +11,11 @@ pub use user_preferences::Entity as UserPreferences;
|
||||
pub use user_relation::Entity as UserRelation;
|
||||
pub use user_ssh_key::Entity as UserSshKey;
|
||||
pub use user_token::Entity as UserToken;
|
||||
pub use user_billing::Entity as UserBilling;
|
||||
|
||||
pub mod user;
|
||||
pub mod user_2fa;
|
||||
pub mod user_activity_log;
|
||||
pub mod user_billing;
|
||||
pub mod user_email;
|
||||
pub mod user_email_change;
|
||||
pub mod user_notification;
|
||||
@ -24,4 +25,3 @@ pub mod user_preferences;
|
||||
pub mod user_relation;
|
||||
pub mod user_ssh_key;
|
||||
pub mod user_token;
|
||||
pub mod user_billing;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user