initial devcontainer setup

This commit is contained in:
Jeff Clement 2025-07-18 23:12:35 +00:00
commit b9b7aa6a08
Signed by: jeff
GPG key ID: 3BCB43A3F0E1D7DA
14 changed files with 411 additions and 0 deletions

33
.devcontainer/snap_db.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
# Ensure the .snapshots directory exists
mkdir -p "$PROJECT_ROOT/.snapshots"
# Generate the base filename with timestamp
base_filename="$PROJECT_ROOT/.snapshots/snapshot_$(date +%Y%m%d_%H%M%S)"
# Initialize an empty string for sanitized arguments
sanitized_args=""
# Loop through all arguments
for arg in "$@"; do
# Sanitize the argument: remove spaces and special characters
sanitized=$(echo "$arg" | tr -cd '[:alnum:]_-')
sanitized_args="${sanitized_args}_${sanitized}"
done
# Remove leading underscore if present
sanitized_args=${sanitized_args#_}
# Create the final filename
if [ -n "$sanitized_args" ]; then
filename="${base_filename}_${sanitized_args}.sql"
else
filename="${base_filename}.sql"
fi
# Run pg_dump and save to the generated filename
pg_dump --no-tablespaces ${PGDATABASE} -f "$filename"
# Print the filename that was written
echo "Snapshot saved to: $filename"