Skip to content

Commit

Permalink
fix: Parallelize migrate commands
Browse files Browse the repository at this point in the history
  • Loading branch information
timgl committed Mar 28, 2024
1 parent d929ca9 commit bd4903f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions bin/migrate
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
#!/bin/bash
set -e

python manage.py migrate
python manage.py migrate_clickhouse
python manage.py migrate &
pid1=$!

python manage.py migrate_clickhouse &

# NOTE: we do not apply any non-noop migrations here. Rather these are run
# manually within the UI. See https://posthog.com/docs/runbook/async-migrations
# for details.
python manage.py run_async_migrations --complete-noop-migrations
python manage.py run_async_migrations --complete-noop-migrations &

# NOTE: this check should not fail if a migration isn't complete but within the
# given async migration posthog version range, thus this should not block e.g.
# k8s pod deployments.
python manage.py run_async_migrations --check
python manage.py run_async_migrations --check &

python manage.py sync_replicated_schema &

pid2=$!

python manage.py sync_replicated_schema
wait $pid1
wait $pid2

0 comments on commit bd4903f

Please sign in to comment.