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>
18 lines
859 B
SQL
18 lines
859 B
SQL
-- ============================================================================
|
|
-- Migration: Add Token Rotation Columns
|
|
-- Date: 2026-01-27
|
|
-- Author: Claude Code (BLOCKER-001 Token Refresh Improvements)
|
|
-- ============================================================================
|
|
|
|
-- Add columns for token rotation security
|
|
ALTER TABLE auth.sessions
|
|
ADD COLUMN IF NOT EXISTS refresh_token_hash VARCHAR(64),
|
|
ADD COLUMN IF NOT EXISTS refresh_token_issued_at TIMESTAMPTZ;
|
|
|
|
-- Add comments
|
|
COMMENT ON COLUMN auth.sessions.refresh_token_hash IS 'SHA-256 hash of refresh token for rotation security';
|
|
COMMENT ON COLUMN auth.sessions.refresh_token_issued_at IS 'Timestamp when current refresh token was issued';
|
|
|
|
-- Create index for performance (hash lookups)
|
|
CREATE INDEX IF NOT EXISTS idx_sessions_refresh_token_hash ON auth.sessions(refresh_token_hash);
|