feat: migrate from PostgreSQL to SQLite

- Updated Docker Compose and Dockerfile to remove PostgreSQL dependencies and configure SQLite as the database provider.
- Adjusted environment variables and healthcheck commands to reflect the new database setup.
- Simplified server startup script by removing PostgreSQL wait logic and replacing migration commands with schema push.
- Updated Prisma schema to use SQLite and removed related migration files.
This commit is contained in:
Daniel Luiz Alves
2025-05-30 22:50:40 -03:00
parent 602780e8dd
commit c39d41b76c
8 changed files with 21 additions and 248 deletions

View File

@@ -1,28 +1,19 @@
#!/bin/sh
echo "Starting Palmr Server..."
echo "Starting Palmr Server with SQLite..."
# Set proper environment
export HOME=/home/palmr
export NPM_CONFIG_CACHE=/home/palmr/.npm
export PNPM_HOME=/home/palmr/.pnpm
# Wait for PostgreSQL - use environment variable or default to postgres
DB_HOST=${DB_HOST:-postgres}
DB_PORT=${DB_PORT:-5432}
echo "Waiting for PostgreSQL at $DB_HOST:$DB_PORT..."
while ! nc -z $DB_HOST $DB_PORT; do
sleep 1
done
echo "PostgreSQL is up!"
cd /app/server
echo "Generating Prisma client..."
npx prisma generate --schema=./prisma/schema.prisma
echo "Running migrations..."
npx prisma migrate deploy
echo "Pushing database schema..."
npx prisma db push --accept-data-loss
echo "Running database seeds..."
node prisma/seed.js || echo "Seeds failed or already exist, continuing..."