···11#!/bin/bash
2233-# Script to copy .sqlx files to all Rust projects that use SQLx
44-# This is needed for offline SQLx builds (SQLX_OFFLINE=true)
33+# Script to verify .sqlx files exist for offline SQLx builds (SQLX_OFFLINE=true)
44+# With unified workspace, .sqlx only needs to exist at the project root
5566set -e
77···1212# Source .sqlx directory
1313SQLX_SOURCE="$PROJECT_ROOT/.sqlx"
14141515-# List of projects that use SQLx (relative to project root)
1616-SQLX_PROJECTS=(
1717- "apps/aqua"
1818- "services/cadet"
1919- "services/satellite"
2020-)
2121-2222-echo "🔧 Setting up SQLx offline files..."
1515+echo "🔧 Verifying SQLx offline files..."
23162417# Check if source .sqlx directory exists
2518if [ ! -d "$SQLX_SOURCE" ]; then
2626- echo "❌ Source .sqlx directory not found at: $SQLX_SOURCE"
2727- echo " Make sure you've run 'cargo sqlx prepare' from the services directory first."
1919+ echo "❌ .sqlx directory not found at: $SQLX_SOURCE"
2020+ echo " Make sure you've run 'cargo sqlx prepare' from the project root first."
2821 exit 1
2922fi
30233131-# Copy .sqlx files to each project that needs them
3232-for project in "${SQLX_PROJECTS[@]}"; do
3333- project_path="$PROJECT_ROOT/$project"
3434- target_sqlx="$project_path/.sqlx"
3535-3636- if [ ! -d "$project_path" ]; then
3737- echo "⚠️ Project directory not found: $project_path (skipping)"
3838- continue
3939- fi
4040-4141- # Check if project actually uses SQLx
4242- if [ ! -f "$project_path/Cargo.toml" ]; then
4343- echo "⚠️ No Cargo.toml found in $project (skipping)"
4444- continue
4545- fi
4646-4747- if ! grep -q "sqlx" "$project_path/Cargo.toml"; then
4848- echo "⚠️ Project $project doesn't appear to use SQLx (skipping)"
4949- continue
5050- fi
5151-5252- echo "📦 Copying .sqlx files to $project..."
5353-5454- # Remove existing .sqlx directory if it exists
5555- if [ -d "$target_sqlx" ]; then
5656- rm -rf "$target_sqlx"
5757- fi
5858-5959- # Copy the .sqlx directory
6060- cp -r "$SQLX_SOURCE" "$target_sqlx"
6161-6262- echo " ✅ Copied $(ls -1 "$target_sqlx" | wc -l) query files"
6363-done
6464-6565-echo "✅ SQLx offline setup complete!"
2424+query_count=$(ls -1 "$SQLX_SOURCE" | wc -l | tr -d ' ')
2525+echo "✅ Found .sqlx directory with $query_count query files"
2626+echo "✅ SQLx offline mode ready!"
6627echo ""
6767-echo "Note: If you add new SQL queries or modify existing ones, you'll need to:"
6868-echo "1. Run 'cargo sqlx prepare' from the services directory"
6969-echo "2. Run this script again to update all project copies"
2828+echo "Note: If you add new SQL queries or modify existing ones, run 'cargo sqlx prepare' from the project root"
···11-[workspace]
22-members = ["cadet", "satellite", "types"]
33-resolver = "2"
44-55-[workspace.dependencies]
66-# Shared dependencies
77-tokio = { version = "1.0", features = ["rt-multi-thread", "macros", "time"] }
88-axum = { version = "0.8", features = ["macros"] }
99-tower-http = { version = "0.6", features = ["cors"] }
1010-sqlx = { version = "0.8", features = [
1111- "runtime-tokio",
1212- "postgres",
1313- "uuid",
1414- "chrono",
1515- "tls-rustls",
1616-] }
1717-serde = { version = "1.0", features = ["derive"] }
1818-anyhow = "1.0"
1919-serde_json = "1.0"
2020-tracing = "0.1"
2121-tracing-subscriber = "0.3"
2222-metrics = "0.23"
2323-reqwest.workspace = true
2424-url = "2.5"
2525-rand = "0.8"
2626-flume = "0.11"
2727-async-trait = "0.1"
2828-time = "0.3"
2929-dotenvy = "0.15"
3030-tokio-tungstenite.workspace = true
3131-atrium-api = "0.25"
3232-chrono = { version = "0.4", features = ["serde"] }
3333-uuid = { version = "1.0", features = ["v4", "serde"] }
3434-types = { path = "types" }
3535-rocketman = "0.2.5"
3636-3737-# CAR and IPLD dependencies
3838-iroh-car = "0.4"
3939-libipld = { version = "0.16", features = ["dag-cbor", "dag-json"] }
4040-cid = "0.11"
4141-base64 = "0.22"
4242-4343-# Redis for job queues and caching
4444-redis = { version = "0.24", features = ["tokio-comp", "connection-manager"] }
4545-4646-# Install sqlx-cli globally for migrations
4747-# Run: cargo install sqlx-cli --features postgres
-3
services/cadet/Dockerfile
···6868# Force SQLx to use offline mode with workspace cache
6969ENV SQLX_OFFLINE=true
70707171-# copy sqlx in
7272-COPY ./.sqlx ./services/cadet/.sqlx
7373-7471# Debug platform detection and run build
7572RUN echo "DEBUG Before target.sh: TARGETPLATFORM=$TARGETPLATFORM TARGETARCH=$TARGETARCH" && \
7673 . ./target.sh && \