Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build #5162

Merged
merged 3 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions ee/management/commands/migrate_clickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
from infi.clickhouse_orm.migrations import MigrationHistory # type: ignore
from infi.clickhouse_orm.utils import import_submodules # type: ignore

from posthog.settings import CLICKHOUSE_DATABASE, CLICKHOUSE_HTTP_URL, CLICKHOUSE_PASSWORD, CLICKHOUSE_USER
from posthog.settings import (
CLICKHOUSE_DATABASE,
CLICKHOUSE_HTTP_URL,
CLICKHOUSE_PASSWORD,
CLICKHOUSE_REPLICATION,
CLICKHOUSE_USER,
)

MIGRATIONS_PACKAGE_NAME = "ee.clickhouse.migrations"

Expand Down Expand Up @@ -65,11 +71,13 @@ def migrate(self, host, options):
)
print("Migrations done")
else:
database.migrate(MIGRATIONS_PACKAGE_NAME, options["upto"])
database.migrate(MIGRATIONS_PACKAGE_NAME, options["upto"], replicated=CLICKHOUSE_REPLICATION)
print("Migration successful")

def get_migrations(self, database, upto):
applied_migrations = database._get_applied_migrations(MIGRATIONS_PACKAGE_NAME)
applied_migrations = database._get_applied_migrations(
MIGRATIONS_PACKAGE_NAME, replicated=CLICKHOUSE_REPLICATION
)
modules = import_submodules(MIGRATIONS_PACKAGE_NAME)
unapplied_migrations = set(modules.keys()) - applied_migrations

Expand Down
3 changes: 2 additions & 1 deletion ee/management/commands/setup_test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def handle(self, *args, **options):
CLICKHOUSE_DATABASE,
CLICKHOUSE_HTTP_URL,
CLICKHOUSE_PASSWORD,
CLICKHOUSE_REPLICATION,
CLICKHOUSE_USER,
CLICKHOUSE_VERIFY,
)
Expand All @@ -36,4 +37,4 @@ def handle(self, *args, **options):
database.create_database()
except:
pass
database.migrate("ee.clickhouse.migrations")
database.migrate("ee.clickhouse.migrations", replicated=CLICKHOUSE_REPLICATION)
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ gunicorn==20.1.0
grpcio==1.33.1
idna==2.8
importlib-metadata==1.6.0
git+git://github.com/PostHog/infi.clickhouse_orm@develop
git+git://github.com/PostHog/infi.clickhouse_orm@369320b390d132799804728844673215540a04b2
kafka-python==2.0.1
kafka-helper==0.2
kombu==4.6.8
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ idna==2.8
# requests
importlib-metadata==1.6.0
# via -r requirements.in
git+git://github.com/PostHog/infi.clickhouse_orm@develop
git+git://github.com/PostHog/infi.clickhouse_orm@369320b390d132799804728844673215540a04b2
# via -r requirements.in
iso8601==0.1.12
# via infi.clickhouse-orm
Expand Down