-- V4__Add_Initial_Admin.sql
-- Insert initial admin user (password: quant123! hashed with SHA-256, will be auto-migrated to BCrypt on first login)

INSERT INTO quantengine.workspace_account (
    ordinal,
    username,
    password_hash,
    role,
    is_active,
    created_at,
    updated_at
)
SELECT
    1,
    'admin',
    '8C6976E5B5410415BDE908BD4DEE15DFB167A9C873FC4BB8A81F6F2AB448A918',
    'Admin',
    'true',
    NOW()::text,
    NOW()::text
WHERE NOT EXISTS (
    SELECT 1 FROM quantengine.workspace_account WHERE username = 'admin'
);
