Skip to content

Commit

Permalink
fix: create database only in dev environment (PostHog#29079)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daesgar authored Feb 21, 2025
1 parent 514d62b commit 179634a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions posthog/management/commands/migrate_clickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def get_applied_migrations(self, database):
return database._get_applied_migrations(MIGRATIONS_PACKAGE_NAME, replicated=True)

def _create_database_if_not_exists(self, database: str, cluster: str):
with default_client() as client:
client.execute(
f"CREATE DATABASE IF NOT EXISTS {database} ON CLUSTER {cluster}",
)
if settings.TEST or settings.E2E_TESTING:
with default_client() as client:
client.execute(
f"CREATE DATABASE IF NOT EXISTS {database} ON CLUSTER {cluster}",
)

0 comments on commit 179634a

Please sign in to comment.