···1#!/bin/bash
23-# Script to copy .sqlx files to all Rust projects that use SQLx
4-# This is needed for offline SQLx builds (SQLX_OFFLINE=true)
56set -e
7···12# Source .sqlx directory
13SQLX_SOURCE="$PROJECT_ROOT/.sqlx"
1415-# List of projects that use SQLx (relative to project root)
16-SQLX_PROJECTS=(
17- "apps/aqua"
18- "services/cadet"
19- "services/satellite"
20-)
21-22-echo "🔧 Setting up SQLx offline files..."
2324# Check if source .sqlx directory exists
25if [ ! -d "$SQLX_SOURCE" ]; then
26- echo "❌ Source .sqlx directory not found at: $SQLX_SOURCE"
27- echo " Make sure you've run 'cargo sqlx prepare' from the services directory first."
28 exit 1
29fi
3031-# Copy .sqlx files to each project that needs them
32-for project in "${SQLX_PROJECTS[@]}"; do
33- project_path="$PROJECT_ROOT/$project"
34- target_sqlx="$project_path/.sqlx"
35-36- if [ ! -d "$project_path" ]; then
37- echo "⚠️ Project directory not found: $project_path (skipping)"
38- continue
39- fi
40-41- # Check if project actually uses SQLx
42- if [ ! -f "$project_path/Cargo.toml" ]; then
43- echo "⚠️ No Cargo.toml found in $project (skipping)"
44- continue
45- fi
46-47- if ! grep -q "sqlx" "$project_path/Cargo.toml"; then
48- echo "⚠️ Project $project doesn't appear to use SQLx (skipping)"
49- continue
50- fi
51-52- echo "📦 Copying .sqlx files to $project..."
53-54- # Remove existing .sqlx directory if it exists
55- if [ -d "$target_sqlx" ]; then
56- rm -rf "$target_sqlx"
57- fi
58-59- # Copy the .sqlx directory
60- cp -r "$SQLX_SOURCE" "$target_sqlx"
61-62- echo " ✅ Copied $(ls -1 "$target_sqlx" | wc -l) query files"
63-done
64-65-echo "✅ SQLx offline setup complete!"
66echo ""
67-echo "Note: If you add new SQL queries or modify existing ones, you'll need to:"
68-echo "1. Run 'cargo sqlx prepare' from the services directory"
69-echo "2. Run this script again to update all project copies"
···1#!/bin/bash
23+# Script to verify .sqlx files exist for offline SQLx builds (SQLX_OFFLINE=true)
4+# With unified workspace, .sqlx only needs to exist at the project root
56set -e
7···12# Source .sqlx directory
13SQLX_SOURCE="$PROJECT_ROOT/.sqlx"
1415+echo "🔧 Verifying SQLx offline files..."
00000001617# Check if source .sqlx directory exists
18if [ ! -d "$SQLX_SOURCE" ]; then
19+ echo "❌ .sqlx directory not found at: $SQLX_SOURCE"
20+ echo " Make sure you've run 'cargo sqlx prepare' from the project root first."
21 exit 1
22fi
2324+query_count=$(ls -1 "$SQLX_SOURCE" | wc -l | tr -d ' ')
25+echo "✅ Found .sqlx directory with $query_count query files"
26+echo "✅ SQLx offline mode ready!"
0000000000000000000000000000000027echo ""
28+echo "Note: If you add new SQL queries or modify existing ones, run 'cargo sqlx prepare' from the project root"
00
···68# Force SQLx to use offline mode with workspace cache
69ENV SQLX_OFFLINE=true
7071-# copy sqlx in
72-COPY ./.sqlx ./services/cadet/.sqlx
73-74# Debug platform detection and run build
75RUN echo "DEBUG Before target.sh: TARGETPLATFORM=$TARGETPLATFORM TARGETARCH=$TARGETARCH" && \
76 . ./target.sh && \
···68# Force SQLx to use offline mode with workspace cache
69ENV SQLX_OFFLINE=true
7000071# Debug platform detection and run build
72RUN echo "DEBUG Before target.sh: TARGETPLATFORM=$TARGETPLATFORM TARGETARCH=$TARGETARCH" && \
73 . ./target.sh && \