# Prax Configuration File
# This file configures database connections, generators, and runtime behavior.

[database]
# Database provider: "postgresql", "mysql", "sqlite", "mongodb"
provider = "postgresql"

# Connection URL - supports environment variable interpolation
url = "postgresql://prax:prax_test_password@localhost:5432/prax_test"

# Connection pool settings
[database.pool]
min_connections = 2
max_connections = 10
connect_timeout = "30s"
idle_timeout = "10m"
max_lifetime = "30m"

# Schema file location (default: prax/schema.prax)
[schema]
path = "prax/schema.prax"

# Generator configuration
[generator.client]
# Output directory for generated code
output = "./src/generated"

# Generate async client (default: true)
async_client = true

# Enable tracing instrumentation
tracing = true

# Preview features to enable
preview_features = ["full_text_search", "multi_schema"]

# Migration settings
[migrations]
# Directory for migration files (inside prax/ directory)
directory = "./prax/migrations"

# Auto-apply migrations in development
auto_migrate = false

# Migration table name
table_name = "_prax_migrations"

# Seeding configuration
[seed]
# Seeds directory (inside prax/ directory)
directory = "./prax/seeds"

# Seed script path - supports multiple formats:
# - .rs   - Rust seed script (compiled and executed)
# - .sql  - Raw SQL file (executed directly)
# - .json - JSON data file (declarative seeding)
# - .toml - TOML data file (declarative seeding)
script = "./prax/seeds/seed.rs"

# Run seed automatically after migrations in development
auto_seed = false

# Environment-specific seeding controls
# Prevents accidental seeding in production
[seed.environments]
development = true
test = true
staging = false
production = false

# Logging and debugging
[debug]
# Log all queries
log_queries = false

# Pretty print SQL
pretty_sql = true

# Query execution time warnings (ms)
slow_query_threshold = 1000

# Development-specific overrides
[environments.development]
database.url = "${DEV_DATABASE_URL}"
debug.log_queries = true

# Production-specific overrides
[environments.production]
database.pool.min_connections = 5
database.pool.max_connections = 50
debug.log_queries = false

