Skip to main content

scripts/apply-migrations.sh

Metadata

Indexed Symbols

No indexed functions/methods detected in this file.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

#!/usr/bin/env bash
set -euo pipefail

if [[ -z "${DATABASE_URL:-}" ]]; then
echo "DATABASE_URL is required"
exit 1
fi

for migration in \
infra/sql/0001_init.sql \
infra/sql/0002_psa_resources.sql \
infra/sql/0003_idempotency.sql \
infra/sql/0004_event_pipeline.sql \
infra/sql/0005_job_queue.sql \
infra/sql/0006_security_hardening.sql \
infra/sql/0007_configuration_plane.sql \
infra/sql/0008_job_metadata.sql \
infra/sql/0009_workflow_execution_metadata.sql \
infra/sql/0010_worker_runtime.sql \
infra/sql/0011_portal_invites.sql; do
echo "Applying ${migration}"
psql "${DATABASE_URL}" -v ON_ERROR_STOP=1 -f "${migration}"
done

echo "Migrations applied successfully"