From ef3935560d9b8cc99abe84e5e7e2a8f0764ec9d7 Mon Sep 17 00:00:00 2001 From: Ricky Stretch Date: Sun, 22 Mar 2026 21:21:57 -0400 Subject: [PATCH] v0.12.1 FCM db update --- .env | 2 +- backend/src/models/db.js | 15 +++++++++++++++ build.sh | 2 +- docker-compose.yaml | 6 ++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 139b4a5..3f469a5 100644 --- a/.env +++ b/.env @@ -3,7 +3,7 @@ DB_PASSWORD=C@nuck2024 JWT_SECRET=changemesupersecretjwtkey #** App identity -PROJECT_NAME=rosterchirp +PROJECT_NAME=jama APP_NAME=RosterChirp DEFCHAT_NAME=General Chat ADMIN_NAME=Admin User diff --git a/backend/src/models/db.js b/backend/src/models/db.js index b1226fd..b019b97 100644 --- a/backend/src/models/db.js +++ b/backend/src/models/db.js @@ -350,6 +350,21 @@ async function initDb() { await seedAdmin('public'); await seedUserGroups('public'); + // Host mode: run migrations on all existing tenant schemas so new migrations + // (e.g. 007_fcm_push) are applied to tenants that were created before the migration existed. + if (APP_TYPE === 'host') { + const tenantResult = await pool.query( + "SELECT schema_name FROM information_schema.schemata WHERE schema_name LIKE 'tenant_%'" + ); + for (const row of tenantResult.rows) { + console.log(`[DB] Running migrations for tenant schema: ${row.schema_name}`); + await runMigrations(row.schema_name); + await seedSettings(row.schema_name); + await seedEventTypes(row.schema_name); + await seedUserGroups(row.schema_name); + } + } + // Host mode: the public schema is the host's own workspace — always full RosterChirp-Team plan. // ON CONFLICT DO UPDATE ensures existing installs get corrected on restart too. if (APP_TYPE === 'host') { diff --git a/build.sh b/build.sh index f491328..77c25f2 100644 --- a/build.sh +++ b/build.sh @@ -13,7 +13,7 @@ # ───────────────────────────────────────────────────────────── set -euo pipefail -VERSION="${1:-0.12.0}" +VERSION="${1:-0.12.1}" ACTION="${2:-}" REGISTRY="${REGISTRY:-}" IMAGE_NAME="rosterchirp" diff --git a/docker-compose.yaml b/docker-compose.yaml index 591353c..a11ce05 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -23,6 +23,12 @@ services: - DB_PASSWORD=${DB_PASSWORD:?DB_PASSWORD is required} - HOST_DOMAIN=${HOST_DOMAIN:-} - HOST_ADMIN_KEY=${HOST_ADMIN_KEY:-} + - FIREBASE_API_KEY=${FIREBASE_API_KEY:-} + - FIREBASE_PROJECT_ID=${FIREBASE_PROJECT_ID:-} + - FIREBASE_MESSAGING_SENDER_ID=${FIREBASE_MESSAGING_SENDER_ID:-} + - FIREBASE_APP_ID=${FIREBASE_APP_ID:-} + - FIREBASE_VAPID_KEY=${FIREBASE_VAPID_KEY:-} + - FIREBASE_SERVICE_ACCOUNT=${FIREBASE_SERVICE_ACCOUNT} volumes: - rosterchirp_uploads:/app/uploads depends_on: