generalbots/src/core/shared/mod.rs
Rodrigo Rodriguez (Pragmatismo) 1f150228af Add billion-scale database redesign with enums and sharding
Database Schema v7.0.0:
- Create new 'gb' schema with PostgreSQL ENUMs instead of VARCHAR for all domain values
- Add sharding infrastructure (shard_config, tenant_shard_map tables)
- Implement partitioned tables for sessions, messages, and analytics (monthly partitions)
- Add Snowflake-like ID generation for distributed systems
- Design for billion-user scale with proper indexing strategies

Rust Enums:
- Add comprehensive enum types in core/shared/enums.rs
- Implement ToSql/FromSql for Diesel ORM integration
- Include: ChannelType, MessageRole, MessageType, LlmProvider, ContextProvider
- Include: TaskStatus, TaskPriority, ExecutionMode, RiskLevel, ApprovalStatus, IntentType
- All enums stored as SMALLINT for efficiency

Other fixes:
- Fix hardcoded gpt-4 model in auto_task modules to use bot config
- Add vector_db to required bootstrap components
- Add Qdrant health check before KB indexing
- Change verbose START messages to trace level
- Fix episodic memory role handling in Claude client
- Disable auth for /api routes during development

This is a DESTRUCTIVE migration - only for fresh installations.
2025-12-29 11:27:13 -03:00

73 lines
1.8 KiB
Rust

pub mod admin;
pub mod analytics;
pub mod enums;
pub mod models;
pub mod schema;
pub mod state;
#[cfg(test)]
pub mod test_utils;
pub mod utils;
pub use enums::*;
pub use schema::*;
pub use botlib::branding::{
branding, copyright_text, footer_text, init_branding, is_white_label, log_prefix,
platform_name, platform_short, BrandingConfig,
};
pub use botlib::error::{BotError, BotResult};
pub use botlib::message_types;
pub use botlib::message_types::MessageType;
pub use botlib::version::{
get_botserver_version, init_version_registry, register_component, version_string,
ComponentSource, ComponentStatus, ComponentVersion, VersionRegistry, BOTSERVER_NAME,
BOTSERVER_VERSION,
};
pub use botlib::models::{ApiResponse, Attachment, Suggestion};
pub use botlib::models::BotResponse;
pub use botlib::models::Session;
pub use botlib::models::UserMessage;
pub use models::{
Automation, Bot, BotConfiguration, BotMemory, Click, MessageHistory, NewTask, Organization,
Task, TriggerKind, User, UserLoginToken, UserPreference, UserSession,
};
pub use utils::{
create_conn, get_content_type, sanitize_identifier, sanitize_path_component,
sanitize_path_for_filename, sanitize_sql_value, DbPool,
};
pub mod prelude {
pub use super::schema::*;
pub use super::{
ApiResponse, Attachment, Automation, Bot, BotConfiguration, BotError, BotMemory,
BotResponse, BotResult, Click, DbPool, MessageHistory, MessageType, NewTask, Organization,
Session, Suggestion, Task, TriggerKind, User, UserLoginToken, UserMessage, UserPreference,
UserSession,
};
pub use diesel::prelude::*;
pub use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl};
pub use chrono::{DateTime, Utc};
pub use serde::{Deserialize, Serialize};
pub use uuid::Uuid;
}