feat(database): add migration and sync-db scripts to deployment process
Some checks failed
Deploy to production / deploy (push) Failing after 3m20s
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:
@@ -77,6 +77,13 @@ import initializeWidgetTypes from './initializeWidgetTypes.js';
|
||||
// Normale Synchronisation (nur bei STAGE=dev Schema-Updates)
|
||||
const syncDatabase = async () => {
|
||||
try {
|
||||
const runInitOnStart = process.env.APP_INIT_ON_START === '1';
|
||||
if (!runInitOnStart) {
|
||||
console.log('⏭️ APP_INIT_ON_START!=1: Überspringe datenbankseitige Initialisierungs-/Ensure-Routinen beim Start.');
|
||||
console.log('💡 Empfehlung: Schema-Änderungen via Migrationen im Deploy ausführen (npm run db:migrate).');
|
||||
return;
|
||||
}
|
||||
|
||||
// Zeige den aktuellen Stage an
|
||||
const currentStage = process.env.STAGE || 'nicht gesetzt';
|
||||
console.log(`🚀 Starte Datenbank-Synchronisation (Stage: ${currentStage})`);
|
||||
|
||||
Reference in New Issue
Block a user