template-saas/apps/database/ddl/02-enums.sql
rckrdmrd 26f0e52ca7 feat: Initial commit - template-saas
Template base para proyectos SaaS multi-tenant.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React/Vite)
- apps/database (PostgreSQL DDL)
- docs/ (Documentación)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:41:24 -06:00

40 lines
2.0 KiB
SQL

-- ============================================
-- TEMPLATE-SAAS: Enum Types
-- Version: 1.0.0
-- ============================================
-- Auth enums
CREATE TYPE auth.token_type AS ENUM ('access', 'refresh', 'reset_password', 'email_verification', 'api_key');
CREATE TYPE auth.oauth_provider AS ENUM ('google', 'microsoft', 'github', 'apple');
CREATE TYPE auth.session_status AS ENUM ('active', 'expired', 'revoked');
-- Tenant enums
CREATE TYPE tenants.tenant_status AS ENUM ('pending', 'active', 'suspended', 'cancelled');
CREATE TYPE tenants.subscription_status AS ENUM ('trialing', 'active', 'past_due', 'cancelled', 'unpaid');
-- User enums
CREATE TYPE users.user_status AS ENUM ('pending', 'active', 'suspended', 'deleted');
CREATE TYPE users.invitation_status AS ENUM ('pending', 'accepted', 'expired', 'cancelled');
-- Billing enums
CREATE TYPE billing.payment_status AS ENUM ('pending', 'processing', 'succeeded', 'failed', 'refunded', 'cancelled');
CREATE TYPE billing.invoice_status AS ENUM ('draft', 'open', 'paid', 'void', 'uncollectible');
CREATE TYPE billing.billing_interval AS ENUM ('month', 'year');
-- Notification enums
CREATE TYPE notifications.channel AS ENUM ('email', 'push', 'in_app', 'sms', 'whatsapp');
CREATE TYPE notifications.notification_status AS ENUM ('pending', 'sent', 'delivered', 'failed', 'read');
CREATE TYPE notifications.priority AS ENUM ('low', 'normal', 'high', 'urgent');
-- Feature flag enums
CREATE TYPE feature_flags.flag_status AS ENUM ('disabled', 'enabled', 'percentage', 'user_list');
CREATE TYPE feature_flags.rollout_stage AS ENUM ('development', 'internal', 'beta', 'general');
-- Audit enums
CREATE TYPE audit.action_type AS ENUM ('create', 'read', 'update', 'delete', 'login', 'logout', 'export', 'import');
CREATE TYPE audit.severity AS ENUM ('info', 'warning', 'error', 'critical');
-- Storage enums
CREATE TYPE storage.file_status AS ENUM ('uploading', 'processing', 'ready', 'failed', 'deleted');
CREATE TYPE storage.visibility AS ENUM ('private', 'tenant', 'public');