This commit is contained in:
2026-03-09 12:25:40 +00:00
parent 05f29028f6
commit c56b7bc13e
2 changed files with 8 additions and 1 deletions

View File

@@ -565,7 +565,11 @@ async function initDatabase({ allowRecovery = true } = {}) {
async function seedFromSchemaFile(db) { async function seedFromSchemaFile(db) {
const schemaSql = fs.readFileSync(schemaFilePath, 'utf-8'); const schemaSql = fs.readFileSync(schemaFilePath, 'utf-8');
const statements = schemaSql // Kommentarzeilen vor dem Split entfernen, damit der erste INSERT-Block nicht
// mit vorangehenden Kommentaren in einem Chunk landet und durch den
// /^INSERT\b/-Filter herausfällt.
const strippedSql = schemaSql.replace(/^--[^\n]*$/gm, '');
const statements = strippedSql
.split(/;\s*\n/) .split(/;\s*\n/)
.map((s) => s.trim()) .map((s) => s.trim())
.filter((s) => /^INSERT\b/i.test(s)); .filter((s) => /^INSERT\b/i.test(s));

View File

@@ -395,6 +395,9 @@ if [[ -d "$INSTALL_DIR/.git" ]]; then
cp -a "$INSTALL_DIR/backend/data" "$DATA_BACKUP" cp -a "$INSTALL_DIR/backend/data" "$DATA_BACKUP"
info "Datenbank gesichert nach: $DATA_BACKUP" info "Datenbank gesichert nach: $DATA_BACKUP"
fi fi
# safe.directory nötig wenn das Verzeichnis einem anderen User gehört
# (z.B. ripster-Serviceuser nach erstem Install)
git config --global --add safe.directory "$INSTALL_DIR" 2>/dev/null || true
git -C "$INSTALL_DIR" fetch --quiet origin git -C "$INSTALL_DIR" fetch --quiet origin
git -C "$INSTALL_DIR" checkout --quiet "$GIT_BRANCH" git -C "$INSTALL_DIR" checkout --quiet "$GIT_BRANCH"
git -C "$INSTALL_DIR" reset --hard "origin/$GIT_BRANCH" git -C "$INSTALL_DIR" reset --hard "origin/$GIT_BRANCH"