ST-2.1: Unify timeframe enum - Created ddl/00-global-types.sql with public.trading_timeframe - Marked trading.timeframe and market_data.timeframe as DEPRECATED ST-2.2: Resolve transaction_type conflict - Documented rename plan: financial.wallet_transaction_type - Documented rename plan: investment.investment_transaction_type - Added deprecation comments to both enums ST-2.3: Unify common functions - Created ddl/00-global-functions.sql with public.update_updated_at() - Marked schema-specific functions as DEPRECATED: - auth.update_updated_at() - education.update_updated_at_column() - financial.update_timestamp() - feature_flags.update_timestamp() Migrations created (not executed): - 2026-02-03_unify_timeframe_enum.sql - 2026-02-03_rename_transaction_type_enums.sql - 2026-02-03_unify_common_functions.sql Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
56 lines
1.4 KiB
SQL
56 lines
1.4 KiB
SQL
-- =====================================================
|
|
-- INVESTMENT SCHEMA - ENUMS
|
|
-- =====================================================
|
|
-- Description: Enumerations for PAMM investment system
|
|
-- Schema: investment
|
|
-- Author: Database Agent
|
|
-- Date: 2025-12-06
|
|
-- =====================================================
|
|
|
|
-- Agentes de inversión (Trading Agents)
|
|
CREATE TYPE investment.trading_agent AS ENUM (
|
|
'atlas', -- Conservador: 3-5% mensual
|
|
'orion', -- Moderado: 5-10% mensual
|
|
'nova' -- Agresivo: 10%+ mensual
|
|
);
|
|
|
|
-- Perfil de riesgo (unificado con cuestionario)
|
|
CREATE TYPE investment.risk_profile AS ENUM (
|
|
'conservative',
|
|
'moderate',
|
|
'aggressive'
|
|
);
|
|
|
|
-- Estado de cuenta PAMM
|
|
CREATE TYPE investment.account_status AS ENUM (
|
|
'pending_kyc',
|
|
'active',
|
|
'suspended',
|
|
'closed'
|
|
);
|
|
|
|
-- Frecuencia de distribución (DECISIÓN: mensual por defecto)
|
|
CREATE TYPE investment.distribution_frequency AS ENUM (
|
|
'monthly',
|
|
'quarterly'
|
|
);
|
|
|
|
-- Tipo de transacción
|
|
-- DEPRECATED: Should be renamed to investment.investment_transaction_type
|
|
-- Conflict: CONF-001 - Same name as financial.transaction_type
|
|
-- Migration: migrations/2026-02-03_rename_transaction_type_enums.sql
|
|
CREATE TYPE investment.transaction_type AS ENUM (
|
|
'deposit',
|
|
'withdrawal',
|
|
'distribution'
|
|
);
|
|
|
|
-- Estado de transacción
|
|
CREATE TYPE investment.transaction_status AS ENUM (
|
|
'pending',
|
|
'processing',
|
|
'completed',
|
|
'failed',
|
|
'cancelled'
|
|
);
|