Private
Public Access
1
0
Files
Kanban/docker-entrypoint.sh
T
Catherine Renelle 80641b6058 Fix deploy: add --accept-data-loss for search_vector column
prisma db push refuses to sync when the search_vector generated
column exists in the DB but not in the schema. The column is
managed by setup-search.sql which runs immediately after.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 20:12:46 -05:00

49 lines
1.3 KiB
Bash

#!/bin/sh
set -e
echo "Waiting for database..."
MAX_RETRIES=30
RETRY=0
while [ $RETRY -lt $MAX_RETRIES ]; do
if npx prisma db push --skip-generate --accept-data-loss 2>&1; then
echo "Database schema synced successfully."
break
fi
RETRY=$((RETRY + 1))
echo "Database not ready (attempt $RETRY/$MAX_RETRIES), retrying in 3s..."
sleep 3
done
if [ $RETRY -ge $MAX_RETRIES ]; then
echo "ERROR: Could not connect to database after $MAX_RETRIES attempts."
exit 1
fi
# Strip Prisma-specific query params (e.g. ?schema=public) that psql doesn't understand
PSQL_URL="${DATABASE_URL%%\?*}"
echo "Applying position column collation fix..."
if psql "$PSQL_URL" -f ./scripts/setup-collation.sql; then
echo "Collation fix applied successfully."
else
echo "WARNING: Failed to apply collation fix. Continuing anyway..."
fi
echo "Applying RLS policies..."
if psql "$PSQL_URL" -f ./scripts/setup-rls.sql; then
echo "RLS policies applied successfully."
else
echo "WARNING: Failed to apply RLS policies. Continuing anyway..."
fi
echo "Applying full-text search indexes..."
if psql "$PSQL_URL" -f ./scripts/setup-search.sql; then
echo "Search indexes applied successfully."
else
echo "WARNING: Failed to apply search indexes. Continuing anyway..."
fi
echo "Starting server..."
exec node server.js