From 31022da0570346328becb2456db9ebe87aefbe2a Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Wed, 22 Apr 2026 01:37:53 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Apply=20missing=20DB=20schema=20?= =?UTF-8?q?changes=20for=20qr=5Fcode=20and=20company=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db-fix.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ sync-to-server.sh | 10 +++++++--- 2 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 db-fix.sh diff --git a/db-fix.sh b/db-fix.sh new file mode 100644 index 0000000..7ca5d01 --- /dev/null +++ b/db-fix.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +echo "🛠️ Applying manual schema updates to PostgreSQL..." + +DOCKER_CMD="docker compose" +if ! docker compose version > /dev/null 2>&1; then + DOCKER_CMD="docker-compose" +fi + +DB_CONTAINER=$($DOCKER_CMD ps -q db) + +if [ -z "$DB_CONTAINER" ]; then + echo "❌ Database container is not running!" + exit 1 +fi + +if [ -f ".env" ]; then + source .env +else + echo "⚠️ .env file not found. Using default values..." + DB_USER="musadaq_user" + DB_NAME="musadaq_db" +fi + +echo "📦 Database container found. Executing ALTER statements..." + +docker exec -i $DB_CONTAINER psql -U $DB_USER -d $DB_NAME <