0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 18:07:17 +01:00
posthog/ee/management/commands/migrate_clickhouse.py
2020-10-26 20:35:09 +01:00

27 lines
718 B
Python

from django.core.management.base import BaseCommand
from infi.clickhouse_orm import Database # type: ignore
from posthog.settings import (
CLICKHOUSE_DATABASE,
CLICKHOUSE_HTTP_URL,
CLICKHOUSE_PASSWORD,
CLICKHOUSE_USERNAME,
CLICKHOUSE_VERIFY,
)
class Command(BaseCommand):
help = "Migrate clickhouse"
def handle(self, *args, **options):
try:
Database(
CLICKHOUSE_DATABASE,
db_url=CLICKHOUSE_HTTP_URL,
username=CLICKHOUSE_USERNAME,
password=CLICKHOUSE_PASSWORD,
verify_ssl_cert=False,
).migrate("ee.clickhouse.migrations")
except Exception as e:
print(e)