-- SIDEL ScriptsManager PostgreSQL Database Initialization -- This script creates the initial database structure for PostgreSQL -- Enable necessary extensions CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE EXTENSION IF NOT EXISTS "pg_trgm"; -- For text search capabilities -- Create application schema (optional, can use public schema) -- CREATE SCHEMA IF NOT EXISTS scriptsmanager; -- SET search_path TO scriptsmanager, public; -- Database configuration for better performance ALTER DATABASE scriptsmanager SET timezone TO 'UTC'; ALTER DATABASE scriptsmanager SET log_statement TO 'all'; ALTER DATABASE scriptsmanager SET log_min_duration_statement TO 1000; -- Log slow queries -- Grant necessary permissions to the application user GRANT CONNECT ON DATABASE scriptsmanager TO scriptsmanager; GRANT USAGE ON SCHEMA public TO scriptsmanager; GRANT CREATE ON SCHEMA public TO scriptsmanager; -- Create sequences for auto-incrementing IDs (SQLAlchemy will handle this automatically, but good to have) -- Note: SQLAlchemy will create these automatically when creating tables COMMENT ON DATABASE scriptsmanager IS 'SIDEL ScriptsManager Application Database';