0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00
posthog/ee/clickhouse/migrations/0015_materialized_column_comments.py
Karl-Aksel Puulmann cef2af5e4c
Group analytics: Initial schema (#6462)
* Add table for group_type_mapping

* Remove materialized columns from events table schema

These are not used and not needed w/ new mat columns work

* WIP: Migration to add group analytics columns

* Remove event table changes temporarily
2021-10-25 15:05:58 +03:00

16 lines
549 B
Python

from infi.clickhouse_orm import migrations
from posthog.settings import CLICKHOUSE_CLUSTER
already_materialized_columns = [
("properties_issampledevent", "isSampledEvent"),
("properties_currentscreen", "currentScreen"),
("properties_objectname", "objectName"),
]
operations = []
for column_name, property in already_materialized_columns:
statement = f"ALTER TABLE events ON CLUSTER {CLICKHOUSE_CLUSTER} COMMENT COLUMN IF EXISTS {column_name} 'column_materializer::{property}'"
operations.append(migrations.RunSQL(statement))