#!/usr/bin/env bash

#SQLITE_DB_PATH="../share-lt/database/database.sqlite"
SQLITE_DB_PATH="../share-lt/database/database.sqlite.backup5.recovery"
BACKUP_DIR="database/backups"
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
BACKUP_FILE="$BACKUP_DIR/backup_$TIMESTAMP.sql"
TABLES="taggables media tags categories text_widgets entries users"
mkdir -p "$BACKUP_DIR"

for TABLE in $TABLES; do
    echo "Backing up table: $TABLE"
    sqlite3 "$SQLITE_DB_PATH" ".dump $TABLE" > "$BACKUP_DIR/${TABLE}_backup_$TIMESTAMP.sql"
done

