#!/bin/bash # sql/helper_scripts/generate_rollup.sh # ============================================================================ # SQL ROLLUP GENERATION SCRIPT (BASH) # ============================================================================ # Purpose: # This script automatically generates the 'master_schema_rollup.sql' file by # concatenating the individual SQL component files in the correct order. # # WARNING: This will overwrite the existing master_schema_rollup.sql file. # # Usage: # From the root of the project, run: # bash sql/generate_rollup.sh # ============================================================================ # Set the script to exit immediately if a command fails set -e # Define file paths relative to the project root SQL_DIR="sql" MASTER_FILE="$SQL_DIR/master_schema_rollup.sql" # The individual files to concatenate, IN ORDER. SOURCE_FILES=( "$SQL_DIR/initial_schema.sql" "$SQL_DIR/initial_data.sql" "$SQL_DIR/initial_triggers_and_functions.sql" ) echo "Generating '$MASTER_FILE' from source files..." cat "${SOURCE_FILES[@]}" > "$MASTER_FILE" echo "✅ Success: '$MASTER_FILE' has been generated."