fix: add missing migration for viewCount, downloadCount, isPublished, publishedAt, imageUrl

This commit is contained in:
Erik Silva
2026-01-20 23:48:04 -03:00
parent 7ad912baae
commit 1619a813e2
2 changed files with 10 additions and 11 deletions

View File

@@ -55,14 +55,5 @@ EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
# Run migrations with retry logic and start server
CMD sh -c '\
echo "Waiting for database..." && \
sleep 5 && \
echo "Running migrations..." && \
for i in 1 2 3 4 5; do \
prisma migrate deploy --schema=./prisma/schema.prisma && break || \
(echo "Migration failed, retrying in 5s..." && sleep 5); \
done && \
echo "Starting server..." && \
node server.js'
# Simple startup: try migration once then start (migration errors won't prevent startup)
CMD sh -c "echo 'Waiting 10s for database...' && sleep 10 && echo 'Running migrations...' && prisma migrate deploy --schema=./prisma/schema.prisma || echo 'Migration failed, continuing anyway...' && echo 'Starting server...' && exec node server.js"

View File

@@ -0,0 +1,8 @@
-- AlterTable - Add missing columns to Document
ALTER TABLE "Document" ADD COLUMN IF NOT EXISTS "viewCount" INTEGER NOT NULL DEFAULT 0;
ALTER TABLE "Document" ADD COLUMN IF NOT EXISTS "downloadCount" INTEGER NOT NULL DEFAULT 0;
-- AlterTable - Add missing columns to Folder
ALTER TABLE "Folder" ADD COLUMN IF NOT EXISTS "isPublished" BOOLEAN NOT NULL DEFAULT false;
ALTER TABLE "Folder" ADD COLUMN IF NOT EXISTS "publishedAt" TIMESTAMP(3);
ALTER TABLE "Folder" ADD COLUMN IF NOT EXISTS "imageUrl" TEXT;