From b59c76610e5ddc0f6797801967025fee8546cd25 Mon Sep 17 00:00:00 2001
From: spwoodcock <sam.woodcock@protonmail.com>
Date: Sun, 8 Oct 2023 17:10:47 +0100
Subject: [PATCH] fix: trim whitespace on schema check prior to migrate

---
 src/backend/migrate-entrypoint.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/backend/migrate-entrypoint.sh b/src/backend/migrate-entrypoint.sh
index 6923803f01..2491d1084f 100644
--- a/src/backend/migrate-entrypoint.sh
+++ b/src/backend/migrate-entrypoint.sh
@@ -60,8 +60,9 @@ create_db_schema_if_missing() {
     table_exists=$(psql -t "$db_url" -c "
         SELECT EXISTS (SELECT 1 FROM information_schema.tables
         WHERE table_schema = 'public' AND table_name = 'projects');
-    ")
-    
+    " | tr -d '[:space:]')  # Remove all whitespace and formatting characters
+    echo "Debug: return from table_exists query: $table_exists"
+
     if [ "$table_exists" = "t" ]; then
         echo "Data exists in the database. Skipping schema creation."
         return 0