feat(database): add migration and sync-db scripts to deployment process
Some checks failed
Deploy to production / deploy (push) Failing after 3m20s

- Introduced a new npm script for database migrations in package.json.
- Updated update-backend.sh to execute migrations and conditionally run legacy sync-db based on environment variable.
- Enhanced syncDatabase.js to skip initialization routines if APP_INIT_ON_START is not set, promoting best practices for schema changes during deployment.
This commit is contained in:
Torsten Schulz (local)
2026-04-17 11:34:59 +02:00
parent 1f10e7c519
commit e96c37aac5
4 changed files with 50 additions and 0 deletions

View File

@@ -62,4 +62,14 @@ echo "Running database synchronization..."
cd "$BACKEND_DIR"
export STAGE="$STAGE"
echo "Führe Migrationen aus..."
npm run db:migrate
if [ "${RUN_LEGACY_SYNC_DB_ON_DEPLOY:-0}" = "1" ]; then
echo "RUN_LEGACY_SYNC_DB_ON_DEPLOY=1 gesetzt -> führe zusätzlich legacy sync-db aus..."
npm run sync-db
else
echo "Legacy sync-db übersprungen (Standard)."
fi
echo "Backend update completed!"