-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseed-database.sh
More file actions
executable file
·45 lines (37 loc) · 1.41 KB
/
seed-database.sh
File metadata and controls
executable file
·45 lines (37 loc) · 1.41 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
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# PyAirtable Database Seeding Script
# ==================================
# This script seeds the PyAirtable PostgreSQL database with realistic test data
#
# Usage: ./seed-database.sh
echo "🚀 PyAirtable Database Seeding"
echo "=============================="
# Check if Docker is running and postgres container exists
if ! docker ps | grep -q pyairtable-compose-postgres-1; then
echo "❌ Error: PostgreSQL container not found or not running"
echo " Please start the Docker services first with: docker-compose up -d"
exit 1
fi
echo "🐳 Running database seeding script in Docker container..."
echo " This will populate the database with realistic test data:"
echo " • 21 users with different roles"
echo " • 7 tenants/organizations"
echo " • 24 workspaces"
echo " • 34 workflows with 321 runs"
echo " • 500 analytics events and 200 metrics"
echo " • API keys and workspace members"
echo ""
# Run the seeding script
docker run --rm --network pyairtable-compose_pyairtable-network \
-v "$(pwd)":/app -w /app python:3.11-slim \
bash -c "pip install -q psycopg2-binary bcrypt && python seed_database.py"
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo ""
echo "🎉 Database seeding completed successfully!"
echo "📊 Run './check-status.sh' to verify the data"
else
echo ""
echo "❌ Database seeding failed with exit code: $exit_code"
fi
exit $exit_code