fix: update database schema push command to include force-reset option

- Modified the database schema push command in server-start.sh to include the --force-reset flag for both root and non-root users.
- This change ensures that the database schema is reset and applied correctly, improving the initialization process for the application.
This commit is contained in:
Daniel Luiz Alves
2025-06-27 18:22:43 -03:00
parent 099546d525
commit 7eaae9fcb4

View File

@@ -41,9 +41,9 @@ if [ ! -f "/app/server/prisma/palmr.db" ]; then
echo "🗄️ Creating database schema..."
if [ "$(id -u)" = "0" ]; then
su-exec $TARGET_UID:$TARGET_GID npx prisma db push --schema=./prisma/schema.prisma --skip-generate
su-exec $TARGET_UID:$TARGET_GID npx prisma db push --schema=./prisma/schema.prisma --skip-generate --force-reset
else
npx prisma db push --schema=./prisma/schema.prisma --skip-generate
npx prisma db push --schema=./prisma/schema.prisma --skip-generate --force-reset
fi
# Run seed script from application directory (where node_modules is) - as target user
@@ -60,9 +60,9 @@ else
echo "🔧 Checking for schema updates..."
if [ "$(id -u)" = "0" ]; then
su-exec $TARGET_UID:$TARGET_GID npx prisma db push --schema=./prisma/schema.prisma --skip-generate
su-exec $TARGET_UID:$TARGET_GID npx prisma db push --schema=./prisma/schema.prisma --skip-generate --force-reset
else
npx prisma db push --schema=./prisma/schema.prisma --skip-generate
npx prisma db push --schema=./prisma/schema.prisma --skip-generate --force-reset
fi
echo "🔍 Checking if new tables need seeding..."