commit
32a36cceff
444 files changed
+67186
No files matched your search
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
# Backend startup script - ensures database is initialized before starting server
|
||||
|
||||
set -e # Exit on error (except for seed script)
|
||||
|
||||
echo "🔍 Checking database..."
|
||||
echo "Database host: ${DB_HOST}"
|
||||
echo "Database name: ${DB_NAME}"
|
||||
|
||||
# Run seed script - capture exit code but continue
|
||||
echo "🌱 Running database seed script..."
|
||||
if node database/seed-postgres.js; then
|
||||
echo "✅ Seed script completed successfully"
|
||||
else
|
||||
SEED_EXIT_CODE=$?
|
||||
echo "⚠️ Seed script exited with code ${SEED_EXIT_CODE}"
|
||||
echo " This is normal if data already exists"
|
||||
fi
|
||||
|
||||
# Run migrations
|
||||
echo "🔄 Running database migrations..."
|
||||
if node database/run-migrations.js; then
|
||||
echo "✅ Migrations completed successfully"
|
||||
else
|
||||
MIGRATION_EXIT_CODE=$?
|
||||
echo "⚠️ Migrations exited with code ${MIGRATION_EXIT_CODE}"
|
||||
fi
|
||||
|
||||
echo "🚀 Starting server..."
|
||||
node server.js
|
||||
Reference in new issue
Block a user