This commit introduces several new scripts for managing database operations, including user creation, permission grants, and data migrations. It also adds new documentation files to guide users through the setup and configuration processes. Additionally, the project structure is updated to enhance organization and maintainability, ensuring a smoother development experience for contributors. These changes support the ongoing transition to a web-based architecture and improve overall project functionality.
35 lines
976 B
Bash
Executable File
35 lines
976 B
Bash
Executable File
#!/bin/bash
|
|
# Setup script that uses PostgreSQL superuser to create tables
|
|
# Usage: ./scripts/setup-with-superuser.sh [postgres_user] [postgres_password]
|
|
|
|
POSTGRES_USER=${1:-postgres}
|
|
POSTGRES_PASSWORD=${2:-}
|
|
DB_NAME="punimtag"
|
|
|
|
echo "Creating database tables using PostgreSQL superuser..."
|
|
echo ""
|
|
|
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
|
# Try without password (trust authentication)
|
|
PGPASSWORD="" psql -U "$POSTGRES_USER" -d "$DB_NAME" -f setup-auth-complete.sql
|
|
else
|
|
# Use password
|
|
PGPASSWORD="$POSTGRES_PASSWORD" psql -U "$POSTGRES_USER" -d "$DB_NAME" -f setup-auth-complete.sql
|
|
fi
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo ""
|
|
echo "✅ Tables created! Now creating admin user..."
|
|
echo ""
|
|
npx tsx scripts/create-admin-user.ts
|
|
else
|
|
echo ""
|
|
echo "❌ Failed to create tables. Please check:"
|
|
echo " 1. PostgreSQL superuser credentials"
|
|
echo " 2. Database name is correct: $DB_NAME"
|
|
echo " 3. You have CREATE TABLE permissions"
|
|
fi
|
|
|
|
|
|
|