refactor(DB): changed DB structure for product analytics
This commit is contained in:
parent
7b0771a581
commit
3d448320bf
6 changed files with 50 additions and 1 deletions
|
|
@ -1 +1,13 @@
|
|||
CREATE OR REPLACE FUNCTION openreplay_version AS() -> 'v1.23.0-ee';
|
||||
|
||||
|
||||
-- The full list of event-properties (used to tell which property belongs to which event)
|
||||
CREATE TABLE IF NOT EXISTS product_analytics.event_properties
|
||||
(
|
||||
project_id UInt16,
|
||||
event_name String,
|
||||
property_name String,
|
||||
|
||||
_timestamp DateTime DEFAULT now()
|
||||
) ENGINE = ReplacingMergeTree(_timestamp)
|
||||
ORDER BY (project_id, event_name, property_name);
|
||||
|
|
|
|||
|
|
@ -654,6 +654,17 @@ CREATE TABLE IF NOT EXISTS product_analytics.all_events
|
|||
ORDER BY (project_id, event_name);
|
||||
|
||||
|
||||
-- The full list of event-properties (used to tell which property belongs to which event)
|
||||
CREATE TABLE IF NOT EXISTS product_analytics.event_properties
|
||||
(
|
||||
project_id UInt16,
|
||||
event_name String,
|
||||
property_name String,
|
||||
|
||||
_timestamp DateTime DEFAULT now()
|
||||
) ENGINE = ReplacingMergeTree(_timestamp)
|
||||
ORDER BY (project_id, event_name, property_name);
|
||||
|
||||
-- The full list of properties (events and users)
|
||||
CREATE TABLE IF NOT EXISTS product_analytics.all_properties
|
||||
(
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
CREATE OR REPLACE FUNCTION openreplay_version AS() -> 'v1.22.0-ee';
|
||||
|
||||
DROP TABLE IF EXISTS product_analytics.event_properties;
|
||||
|
|
@ -11,3 +11,14 @@ CREATE TABLE IF NOT EXISTS experimental.user_viewed_sessions
|
|||
PARTITION BY toYYYYMM(_timestamp)
|
||||
ORDER BY (project_id, user_id, session_id)
|
||||
TTL _timestamp + INTERVAL 3 MONTH;
|
||||
|
||||
-- The full list of event-properties (used to tell which property belongs to which event)
|
||||
CREATE TABLE IF NOT EXISTS product_analytics.event_properties
|
||||
(
|
||||
project_id UInt16,
|
||||
event_name String,
|
||||
property_name String,
|
||||
|
||||
_timestamp DateTime DEFAULT now()
|
||||
) ENGINE = ReplacingMergeTree(_timestamp)
|
||||
ORDER BY (project_id, event_name, property_name);
|
||||
|
|
|
|||
|
|
@ -515,6 +515,17 @@ CREATE TABLE IF NOT EXISTS product_analytics.all_events
|
|||
) ENGINE = ReplacingMergeTree(_timestamp)
|
||||
ORDER BY (project_id, event_name);
|
||||
|
||||
-- The full list of event-properties (used to tell which property belongs to which event)
|
||||
CREATE TABLE IF NOT EXISTS product_analytics.event_properties
|
||||
(
|
||||
project_id UInt16,
|
||||
event_name String,
|
||||
property_name String,
|
||||
|
||||
_timestamp DateTime DEFAULT now()
|
||||
) ENGINE = ReplacingMergeTree(_timestamp)
|
||||
ORDER BY (project_id, event_name, property_name);
|
||||
|
||||
|
||||
-- The full list of properties (events and users)
|
||||
CREATE TABLE IF NOT EXISTS product_analytics.all_properties
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
CREATE OR REPLACE FUNCTION openreplay_version AS() -> 'v1.22.0';
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS experimental.user_viewed_sessions;
|
||||
DROP TABLE IF EXISTS experimental.user_viewed_sessions;
|
||||
|
||||
DROP TABLE IF EXISTS product_analytics.event_properties;
|
||||
Loading…
Add table
Reference in a new issue