template-saas-database-v2/seeds/prod/01-plans.sql
rckrdmrd 3ce06fbce4 Initial commit - Database de template-saas migrado desde monorepo
Migración desde workspace-v2/projects/template-saas/apps/database
Este repositorio es parte del estándar multi-repo v2

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:07:11 -06:00

156 lines
5.3 KiB
SQL

-- ============================================
-- TEMPLATE-SAAS: Production Seeds - Plans
-- Version: 1.0.0
-- ============================================
-- Default pricing plans
INSERT INTO plans.plans (id, name, slug, description, tagline, price_monthly, price_yearly, trial_days, is_popular, sort_order, features, limits, included_features) VALUES
-- Free Plan
(
'a0000000-0000-0000-0000-000000000001',
'Free',
'free',
'Perfect for trying out the platform',
'Get started for free',
0.00,
0.00,
0, -- No trial needed
FALSE,
1,
'[
{"name": "Users", "value": "1", "highlight": false},
{"name": "Storage", "value": "100MB", "highlight": false},
{"name": "API Calls", "value": "1,000/mo", "highlight": false},
{"name": "Email Support", "value": true, "highlight": false}
]'::jsonb,
'{
"max_users": 1,
"max_storage_mb": 100,
"max_api_calls_month": 1000,
"max_projects": 1
}'::jsonb,
'["basic_features"]'::jsonb
),
-- Starter Plan
(
'a0000000-0000-0000-0000-000000000002',
'Starter',
'starter',
'Great for small teams getting started',
'Best for small teams',
29.00,
290.00, -- ~17% discount
14,
FALSE,
2,
'[
{"name": "Users", "value": "5", "highlight": true},
{"name": "Storage", "value": "5GB", "highlight": false},
{"name": "API Calls", "value": "10,000/mo", "highlight": false},
{"name": "Email Support", "value": true, "highlight": false},
{"name": "Basic Analytics", "value": true, "highlight": false}
]'::jsonb,
'{
"max_users": 5,
"max_storage_mb": 5120,
"max_api_calls_month": 10000,
"max_projects": 5
}'::jsonb,
'["basic_features", "analytics_basic"]'::jsonb
),
-- Pro Plan
(
'a0000000-0000-0000-0000-000000000003',
'Pro',
'pro',
'For growing teams that need more power',
'Most popular',
79.00,
790.00, -- ~17% discount
14,
TRUE, -- Popular
3,
'[
{"name": "Users", "value": "25", "highlight": true},
{"name": "Storage", "value": "50GB", "highlight": true},
{"name": "API Calls", "value": "100,000/mo", "highlight": false},
{"name": "Priority Support", "value": true, "highlight": true},
{"name": "Advanced Analytics", "value": true, "highlight": false},
{"name": "API Access", "value": true, "highlight": false},
{"name": "Custom Integrations", "value": true, "highlight": false}
]'::jsonb,
'{
"max_users": 25,
"max_storage_mb": 51200,
"max_api_calls_month": 100000,
"max_projects": 25
}'::jsonb,
'["basic_features", "analytics_basic", "analytics_advanced", "api_access", "integrations"]'::jsonb
),
-- Enterprise Plan
(
'a0000000-0000-0000-0000-000000000004',
'Enterprise',
'enterprise',
'For large organizations with custom needs',
'Contact sales',
NULL, -- Custom pricing
NULL,
30,
FALSE,
4,
'[
{"name": "Users", "value": "Unlimited", "highlight": true},
{"name": "Storage", "value": "Unlimited", "highlight": true},
{"name": "API Calls", "value": "Unlimited", "highlight": true},
{"name": "Dedicated Support", "value": true, "highlight": true},
{"name": "SLA", "value": "99.9%", "highlight": true},
{"name": "Custom Development", "value": true, "highlight": false},
{"name": "On-premise Option", "value": true, "highlight": false}
]'::jsonb,
'{
"max_users": -1,
"max_storage_mb": -1,
"max_api_calls_month": -1,
"max_projects": -1
}'::jsonb,
'["basic_features", "analytics_basic", "analytics_advanced", "api_access", "integrations", "sso", "audit_logs_extended", "custom_development"]'::jsonb
)
ON CONFLICT (slug) DO UPDATE SET
name = EXCLUDED.name,
description = EXCLUDED.description,
price_monthly = EXCLUDED.price_monthly,
price_yearly = EXCLUDED.price_yearly,
features = EXCLUDED.features,
limits = EXCLUDED.limits,
updated_at = NOW();
-- Plan features detailed (optional)
INSERT INTO plans.plan_features (plan_id, feature_code, feature_name, category, value_type, value_number, display_value, sort_order) VALUES
-- Free plan features
('a0000000-0000-0000-0000-000000000001', 'max_users', 'Maximum Users', 'limits', 'number', 1, '1 user', 1),
('a0000000-0000-0000-0000-000000000001', 'storage', 'Storage', 'limits', 'number', 100, '100 MB', 2),
-- Starter plan features
('a0000000-0000-0000-0000-000000000002', 'max_users', 'Maximum Users', 'limits', 'number', 5, '5 users', 1),
('a0000000-0000-0000-0000-000000000002', 'storage', 'Storage', 'limits', 'number', 5120, '5 GB', 2),
-- Pro plan features
('a0000000-0000-0000-0000-000000000003', 'max_users', 'Maximum Users', 'limits', 'number', 25, '25 users', 1),
('a0000000-0000-0000-0000-000000000003', 'storage', 'Storage', 'limits', 'number', 51200, '50 GB', 2),
-- Enterprise plan features
('a0000000-0000-0000-0000-000000000004', 'max_users', 'Maximum Users', 'limits', 'number', -1, 'Unlimited', 1),
('a0000000-0000-0000-0000-000000000004', 'storage', 'Storage', 'limits', 'number', -1, 'Unlimited', 2)
ON CONFLICT (plan_id, feature_code) DO NOTHING;
-- Comments
COMMENT ON TABLE plans.plans IS 'Default SaaS pricing plans';