DDL updates: - Update extensions and schemas configuration - Add sessions table for auth schema - Update education schema (videos, install/uninstall scripts) - Add backtest_runs and llm_signals tables for ML schema Scripts: - Update database creation and migration scripts - Add DDL validation script New: - Add migrations directory structure - Add production seeds for auth, investment, market_data, trading Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
73 lines
1.9 KiB
SQL
73 lines
1.9 KiB
SQL
-- =====================================================
|
|
-- SEED DATA - Schema Auth (Production)
|
|
-- =====================================================
|
|
-- Project: OrbiQuant IA (Trading Platform)
|
|
-- Tables: auth.users, auth.user_profiles
|
|
-- Description: Admin super user seed for platform bootstrap
|
|
-- Date: 2026-01-27
|
|
-- =====================================================
|
|
|
|
SET search_path TO auth, public;
|
|
|
|
-- =====================================================
|
|
-- 1. ADMIN USER
|
|
-- =====================================================
|
|
|
|
INSERT INTO auth.users (
|
|
id,
|
|
email,
|
|
email_verified,
|
|
email_verified_at,
|
|
password_hash,
|
|
status,
|
|
role,
|
|
mfa_enabled,
|
|
mfa_method
|
|
) VALUES (
|
|
'00000000-0000-0000-0000-000000000000',
|
|
'admin@orbiquant.com',
|
|
true,
|
|
NOW(),
|
|
'$2b$12$LJ3m4yv5E7Qj8K9F2N1P6eR4T6Y8U0I2O4P6A8S0D2F4G6H8J0K2',
|
|
'active',
|
|
'super_admin',
|
|
false,
|
|
'none'
|
|
) ON CONFLICT (email) DO NOTHING;
|
|
|
|
-- =====================================================
|
|
-- 2. ADMIN USER PROFILE
|
|
-- =====================================================
|
|
|
|
INSERT INTO auth.user_profiles (
|
|
user_id,
|
|
first_name,
|
|
last_name,
|
|
display_name,
|
|
language,
|
|
timezone,
|
|
newsletter_subscribed,
|
|
marketing_emails_enabled,
|
|
notifications_enabled,
|
|
metadata
|
|
) VALUES (
|
|
'00000000-0000-0000-0000-000000000000',
|
|
'System',
|
|
'Administrator',
|
|
'OrbiQuant Admin',
|
|
'en',
|
|
'UTC',
|
|
false,
|
|
false,
|
|
true,
|
|
'{"role_description": "Platform super administrator", "created_by": "seed"}'::jsonb
|
|
) ON CONFLICT (user_id) DO NOTHING;
|
|
|
|
-- =====================================================
|
|
-- VERIFICATION
|
|
-- =====================================================
|
|
SELECT 'auth.users (admin) seed:' AS info, COUNT(*) AS count
|
|
FROM auth.users WHERE email = 'admin@orbiquant.com';
|
|
SELECT 'auth.user_profiles (admin) seed:' AS info, COUNT(*) AS count
|
|
FROM auth.user_profiles WHERE user_id = '00000000-0000-0000-0000-000000000000';
|