From 1e2bd7b410848e2edce2c2bdbf7f319bbc0f4258 Mon Sep 17 00:00:00 2001 From: Sam <78538841+spwoodcock@users.noreply.github.com> Date: Sun, 8 Oct 2023 17:14:45 +0100 Subject: [PATCH] fix: trim whitespace on schema check prior to migrate (#886) --- 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