-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathsetup-fee-structures.sh
More file actions
executable file
Β·33 lines (25 loc) Β· 1.06 KB
/
setup-fee-structures.sh
File metadata and controls
executable file
Β·33 lines (25 loc) Β· 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Setup fee structures for Aframp backend
# This script runs the migration and seeds initial fee configurations
set -e
echo "π Setting up fee structures..."
# Load environment variables
if [ -f .env ]; then
export $(cat .env | grep -v '^#' | xargs)
fi
# Default to test database if not specified
DATABASE_URL=${DATABASE_URL:-"postgresql://postgres:postgres@localhost/aframp_test"}
echo "π Database: $DATABASE_URL"
# Run migration
echo "βοΈ Running migration..."
sqlx migrate run --database-url "$DATABASE_URL"
# Seed fee structures
echo "π± Seeding fee structures..."
psql "$DATABASE_URL" -f db/seed_fee_structures.sql
echo "β
Fee structures setup complete!"
echo ""
echo "π Summary:"
psql "$DATABASE_URL" -c "SELECT COUNT(*) as total_fee_structures FROM fee_structures WHERE is_active = true;"
echo ""
echo "π‘ To view all fee structures:"
echo " psql $DATABASE_URL -c \"SELECT transaction_type, payment_provider, payment_method, min_amount, max_amount FROM fee_structures WHERE is_active = true ORDER BY transaction_type, min_amount;\""