DDL schemas for Trading Platform: - User management - Authentication - Payments - Education - ML predictions - Trading data Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
81 lines
1.8 KiB
SQL
81 lines
1.8 KiB
SQL
-- ============================================================================
|
|
-- OrbiQuant IA - Trading Platform
|
|
-- Schema: auth
|
|
-- File: 01-enums.sql
|
|
-- Description: Enumerated types for authentication and authorization
|
|
-- ============================================================================
|
|
|
|
-- User account status
|
|
CREATE TYPE auth.user_status AS ENUM (
|
|
'pending_verification',
|
|
'active',
|
|
'suspended',
|
|
'deactivated',
|
|
'banned'
|
|
);
|
|
|
|
COMMENT ON TYPE auth.user_status IS 'User account status lifecycle states';
|
|
|
|
-- User role for RBAC
|
|
CREATE TYPE auth.user_role AS ENUM (
|
|
'user',
|
|
'trader',
|
|
'analyst',
|
|
'admin',
|
|
'super_admin'
|
|
);
|
|
|
|
COMMENT ON TYPE auth.user_role IS 'Role-based access control roles';
|
|
|
|
-- OAuth provider types
|
|
CREATE TYPE auth.oauth_provider AS ENUM (
|
|
'google',
|
|
'facebook',
|
|
'apple',
|
|
'github',
|
|
'microsoft',
|
|
'twitter'
|
|
);
|
|
|
|
COMMENT ON TYPE auth.oauth_provider IS 'Supported OAuth 2.0 providers';
|
|
|
|
-- Phone verification channel
|
|
CREATE TYPE auth.phone_channel AS ENUM (
|
|
'sms',
|
|
'whatsapp'
|
|
);
|
|
|
|
COMMENT ON TYPE auth.phone_channel IS 'Phone verification delivery channels';
|
|
|
|
-- Authentication event types for logging
|
|
CREATE TYPE auth.auth_event_type AS ENUM (
|
|
'login',
|
|
'logout',
|
|
'register',
|
|
'password_change',
|
|
'password_reset_request',
|
|
'password_reset_complete',
|
|
'email_verification',
|
|
'phone_verification',
|
|
'mfa_enabled',
|
|
'mfa_disabled',
|
|
'session_expired',
|
|
'account_suspended',
|
|
'account_reactivated',
|
|
'failed_login',
|
|
'oauth_linked',
|
|
'oauth_unlinked'
|
|
);
|
|
|
|
COMMENT ON TYPE auth.auth_event_type IS 'Types of authentication events for audit logging';
|
|
|
|
-- MFA method types
|
|
CREATE TYPE auth.mfa_method AS ENUM (
|
|
'none',
|
|
'totp',
|
|
'sms',
|
|
'email'
|
|
);
|
|
|
|
COMMENT ON TYPE auth.mfa_method IS 'Multi-factor authentication methods';
|