mirror of
https://github.com/freedbygrace/SQL.git
synced 2026-07-26 19:38:16 +00:00
b30733ccad
- Docker setup with PostgreSQL 16 and DB-UI web interface - Comprehensive 20+ table schema with fraud detection patterns - Idempotent shell scripts for data generation (no Python dependency) - Realistic geographic data (100 US cities, 210 world cities) - 5M+ transactions with embedded fraud patterns (velocity, geographic, structuring, etc.) - Progressive SQL exercises from beginner to advanced fraud detection - Complete documentation and quick start guide - Setup and verification scripts
23 lines
858 B
SQL
23 lines
858 B
SQL
-- ============================================================================
|
|
-- Database Initialization Script
|
|
-- ============================================================================
|
|
-- This script ensures the database is created and ready
|
|
-- It runs automatically when the PostgreSQL container starts
|
|
-- ============================================================================
|
|
|
|
-- Ensure the database exists (this runs in the default postgres database)
|
|
SELECT 'Database initialization starting...' AS status;
|
|
|
|
-- Set timezone
|
|
SET timezone = 'UTC';
|
|
|
|
-- Show current database
|
|
SELECT current_database() AS current_db, current_user AS current_user, version() AS pg_version;
|
|
|
|
-- Enable required extensions
|
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
|
|
|
|
SELECT 'Extensions enabled successfully' AS status;
|
|
|