fix: Only run prisma db push if database doesn't exist to avoid OOM
This commit is contained in:
@@ -9,22 +9,13 @@ echo "Checking database..."
|
||||
mkdir -p /app/data
|
||||
chmod 777 /app/data
|
||||
|
||||
# Create a dummy file to test write access
|
||||
touch /app/data/.write_test 2>/dev/null && rm /app/data/.write_test || {
|
||||
echo "Warning: Cannot write to /app/data, trying to fix permissions..."
|
||||
chmod -R 777 /app/data
|
||||
}
|
||||
|
||||
# Use local prisma version from node_modules (skip generate - already built)
|
||||
./node_modules/prisma/build/index.js db push --skip-generate || {
|
||||
echo "Warning: db push failed, checking if database exists..."
|
||||
if [ -f /app/data/dev.db ]; then
|
||||
echo "Database file exists, continuing..."
|
||||
else
|
||||
echo "Database file does not exist and could not be created"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
# Only run db push if database file doesn't exist
|
||||
if [ ! -f /app/data/dev.db ]; then
|
||||
echo "Database not found, creating..."
|
||||
./node_modules/prisma/build/index.js db push --skip-generate
|
||||
else
|
||||
echo "Database already exists, skipping db push..."
|
||||
fi
|
||||
|
||||
echo "Starting application..."
|
||||
exec "$@"
|
||||
|
||||
Reference in New Issue
Block a user