diff --git a/backend/entrypoint.sh b/backend/entrypoint.sh index 6023151..aa1cd85 100644 --- a/backend/entrypoint.sh +++ b/backend/entrypoint.sh @@ -3,15 +3,20 @@ DATABASE_URL="postgresql://prosapp_user:ProsappPass123!@wkuvmdsy39relyhnugk87eqb:5432/prosapp" export DATABASE_URL +PRISMA="node_modules/.bin/prisma" + echo "=== ProsApp Backend Starting ===" -echo "Running migrations..." -node_modules/.bin/prisma migrate deploy -MIGRATE_STATUS=$? +# Baseline: mark existing migrations as applied without running their SQL. +# This creates _prisma_migrations if it doesn't exist, then records each +# migration so prisma migrate deploy skips them and only runs new ones. +echo "Baselining existing migrations..." +$PRISMA migrate resolve --applied "0000_init" 2>/dev/null || true +$PRISMA migrate resolve --applied "0001_add_rethus_code" 2>/dev/null || true -if [ $MIGRATE_STATUS -ne 0 ]; then - echo "WARNING: migrations exited with status $MIGRATE_STATUS — starting server anyway" -fi +# Apply only new/pending migrations (0002, 0003, ...) +echo "Applying pending migrations..." +$PRISMA migrate deploy echo "Starting server..." exec node dist/main.js diff --git a/backend/prisma/migrations/0003_add_suggestions/migration.sql b/backend/prisma/migrations/0003_add_suggestions/migration.sql new file mode 100644 index 0000000..db336e4 --- /dev/null +++ b/backend/prisma/migrations/0003_add_suggestions/migration.sql @@ -0,0 +1,9 @@ +-- CreateTable +CREATE TABLE IF NOT EXISTS "suggestions" ( + "id" UUID NOT NULL DEFAULT uuid_generate_v4(), + "name" VARCHAR(255), + "message" TEXT NOT NULL, + "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "suggestions_pkey" PRIMARY KEY ("id") +);