mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-17 17:24:12 +00:00
fix: remove drizzle-kit push from auto-deploy to prevent data loss
BREAKING: drizzle-kit push with --force can delete columns that exist in the database but not in the schema, causing data loss. Changes: - Remove automatic drizzle-kit push from deploy-production.sh - Add warnings to sync-schema.sh about potential data loss - Only use Payload migrations for safe schema changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9e433315e5
commit
16498a7650
2 changed files with 14 additions and 5 deletions
|
|
@ -255,9 +255,9 @@ if [ "$SKIP_MIGRATIONS" = false ]; then
|
||||||
log "Running database migrations..."
|
log "Running database migrations..."
|
||||||
pnpm payload migrate || warn "No migrations to run or migration failed"
|
pnpm payload migrate || warn "No migrations to run or migration failed"
|
||||||
|
|
||||||
log "Syncing database schema with drizzle-kit..."
|
# WICHTIG: drizzle-kit push wurde aus dem automatischen Deployment entfernt
|
||||||
# Use drizzle-kit push to ensure schema is in sync (handles payload_locked_documents_rels etc.)
|
# um Datenverlust zu verhindern. Nur Payload-Migrationen sind sicher.
|
||||||
pnpm exec drizzle-kit push --config=drizzle.production.config.ts --force 2>/dev/null || warn "drizzle-kit push skipped or failed"
|
# Für manuelle Schema-Erweiterungen: ./scripts/sync-schema.sh --dry-run
|
||||||
else
|
else
|
||||||
warn "Skipping migrations (--skip-migrations)"
|
warn "Skipping migrations (--skip-migrations)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,17 @@ fi
|
||||||
|
|
||||||
# Run schema sync
|
# Run schema sync
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${BLUE}Running drizzle-kit push...${NC}"
|
echo -e "${RED}WARNUNG: drizzle-kit push kann Daten löschen wenn Spalten entfernt werden!${NC}"
|
||||||
pnpm exec drizzle-kit push --config=drizzle.production.config.ts --force
|
echo -e "${YELLOW}Empfehlung: Nutze das fix-locked-docs-rels.sql Script für sichere Spalten-Hinzufügung.${NC}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if [ "$FORCE" = true ]; then
|
||||||
|
echo -e "${BLUE}Running drizzle-kit push (FORCE mode - GEFÄHRLICH!)...${NC}"
|
||||||
|
pnpm exec drizzle-kit push --config=drizzle.production.config.ts --force
|
||||||
|
else
|
||||||
|
echo -e "${BLUE}Running drizzle-kit push (interactive mode)...${NC}"
|
||||||
|
pnpm exec drizzle-kit push --config=drizzle.production.config.ts
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${GREEN}Schema sync complete!${NC}"
|
echo -e "${GREEN}Schema sync complete!${NC}"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue