Added cmake dep to dockerfile and added script for db:schema:load that runs only if the schema is different than the latest migration

This commit is contained in:
Gareth
2025-07-30 20:12:53 -04:00
parent 65604f5b04
commit 6a912b7d8c
4 changed files with 20 additions and 2 deletions

15
script/load_schema.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -e
echo "🔍 Checking if schema is missing or outdated..."
# Get the current DB version
DB_VERSION=$(bundle exec rails db:version | grep 'Current version' | awk '{print $NF}')
FILE_VERSION=$(grep 'version:' db/schema.rb | awk '{print $2}')
if [ -z "$DB_VERSION" ] || [ "$DB_VERSION" != "$FILE_VERSION" ]; then
echo "🧾 Schema mismatch detected (DB=$DB_VERSION, File=$FILE_VERSION). Running db:schema:load..."
bundle exec rails db:schema:load
else
echo "✅ Schema is up to date (version $DB_VERSION)."
fi