botserver/migrations/7.0.0_billion_scale_redesign/down.sql
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

9 lines
395 B
SQL

-- Migration: 7.0.0 Billion Scale Redesign - ROLLBACK
-- Description: Drops the gb schema and all its objects
-- WARNING: This is a DESTRUCTIVE operation - all data will be lost
-- Drop the entire schema (CASCADE drops all objects within)
DROP SCHEMA IF EXISTS gb CASCADE;
-- Note: This migration completely removes the v7 schema.
-- To restore previous schema, run migrations 6.x.x in order.