refactor: enhance installation process with support for full-stack and app-only modes, update environment configurations, and improve database migration handling
This commit is contained in:
+19
-20
@@ -1,31 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -euo pipefail
|
||||
set -eu
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
|
||||
|
||||
if [ -z "${DATABASE_URL:-}" ]; then
|
||||
echo "DATABASE_URL is required." >&2
|
||||
echo "Example:" >&2
|
||||
echo " DATABASE_URL='postgresql://postgres:password@host:5432/postgres' bash ./scripts/apply-migrations.sh" >&2
|
||||
echo " DATABASE_URL='postgresql://postgres:password@host:5432/postgres' sh ./scripts/apply-migrations.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SQL_FILES=(
|
||||
"supabase/schema.sql"
|
||||
"supabase/migrations/0002_add_freelancer_os_core_tables.sql"
|
||||
"supabase/migrations/0003_add_project_planning_assets.sql"
|
||||
"supabase/migrations/0004_add_business_os_tables.sql"
|
||||
"supabase/migrations/0005_add_advanced_crm_tables.sql"
|
||||
"supabase/migrations/0006_add_pgvector_and_embeddings.sql"
|
||||
"supabase/migrations/0007_add_client_portal_tables.sql"
|
||||
"supabase/migrations/0008_add_project_progress_and_quota.sql"
|
||||
"supabase/migrations/0009_lock_registration_after_first_admin.sql"
|
||||
)
|
||||
|
||||
run_sql_file() {
|
||||
local file_path="$1"
|
||||
local absolute_path="$ROOT_DIR/$file_path"
|
||||
file_path="$1"
|
||||
absolute_path="$ROOT_DIR/$file_path"
|
||||
|
||||
if [ ! -f "$absolute_path" ]; then
|
||||
echo "Missing SQL file: $file_path" >&2
|
||||
@@ -45,8 +33,19 @@ run_sql_file() {
|
||||
fi
|
||||
}
|
||||
|
||||
for sql_file in "${SQL_FILES[@]}"; do
|
||||
while IFS= read -r sql_file; do
|
||||
[ -n "$sql_file" ] || continue
|
||||
run_sql_file "$sql_file"
|
||||
done
|
||||
done <<'SQL_FILES'
|
||||
supabase/schema.sql
|
||||
supabase/migrations/0002_add_freelancer_os_core_tables.sql
|
||||
supabase/migrations/0003_add_project_planning_assets.sql
|
||||
supabase/migrations/0004_add_business_os_tables.sql
|
||||
supabase/migrations/0005_add_advanced_crm_tables.sql
|
||||
supabase/migrations/0006_add_pgvector_and_embeddings.sql
|
||||
supabase/migrations/0007_add_client_portal_tables.sql
|
||||
supabase/migrations/0008_add_project_progress_and_quota.sql
|
||||
supabase/migrations/0009_lock_registration_after_first_admin.sql
|
||||
SQL_FILES
|
||||
|
||||
echo "All Neta migrations were applied."
|
||||
|
||||
Reference in New Issue
Block a user