|
| 1 | +""" |
| 2 | +Updates: |
| 3 | +1. The ORDER BY clauses for each top-level materialized view include more relevant |
| 4 | + fields. Since these tables now use the ReplacingMergeTree engine, the ORDER BY |
| 5 | + fields are used to determine whether a row needs to be updated. |
| 6 | +2. The video playback events MV now uses an integer for the video position |
| 7 | +3. The emission_time fields now use the DateTime type, as we do not need sub-second |
| 8 | + granularity and so can save space by using a smaller data type. |
| 9 | +""" |
1 | 10 | from dataclasses import dataclass
|
2 | 11 |
|
3 | 12 | from alembic import op
|
4 | 13 |
|
5 |
| -revision = "0011" |
6 |
| -down_revision = "0010" |
| 14 | +revision = "0013" |
| 15 | +down_revision = "0012" |
7 | 16 | branch_labels = None
|
8 | 17 | depends_on = None
|
9 | 18 |
|
@@ -46,7 +55,7 @@ class MvMigration:
|
46 | 55 | `enrollment_mode` LowCardinality(String)
|
47 | 56 | ) ENGINE = ReplacingMergeTree
|
48 | 57 | PRIMARY KEY (org, course_key)
|
49 |
| -ORDER BY (org, course_key, actor_id, emission_time, enrollment_mode, event_id); |
| 58 | +ORDER BY (org, course_key, emission_time, actor_id, enrollment_mode, event_id); |
50 | 59 | """
|
51 | 60 |
|
52 | 61 |
|
@@ -114,7 +123,7 @@ class MvMigration:
|
114 | 123 | `video_position` UInt32 NOT NULL
|
115 | 124 | ) ENGINE = ReplacingMergeTree
|
116 | 125 | PRIMARY KEY (org, course_key, verb_id)
|
117 |
| -ORDER BY (org, course_key, verb_id, actor_id, emission_time, video_position, event_id); |
| 126 | +ORDER BY (org, course_key, verb_id, emission_time, actor_id, video_position, event_id); |
118 | 127 | """
|
119 | 128 |
|
120 | 129 |
|
@@ -205,7 +214,7 @@ class MvMigration:
|
205 | 214 | `attempts` Int16
|
206 | 215 | ) ENGINE = ReplacingMergeTree
|
207 | 216 | PRIMARY KEY (org, course_key, verb_id)
|
208 |
| -ORDER BY (org, course_key, verb_id, actor_id, emission_time, object_id, responses, success, event_id); |
| 217 | +ORDER BY (org, course_key, verb_id, emission_time, actor_id, object_id, responses, success, event_id); |
209 | 218 | """
|
210 | 219 |
|
211 | 220 |
|
@@ -307,7 +316,7 @@ class MvMigration:
|
307 | 316 | `ending_point` String
|
308 | 317 | ) ENGINE = ReplacingMergeTree
|
309 | 318 | PRIMARY KEY (org, course_key, object_type)
|
310 |
| -ORDER BY (org, course_key, object_type, actor_id, emission_time, starting_position, event_id); |
| 319 | +ORDER BY (org, course_key, object_type, emission_time, actor_id, starting_position, event_id); |
311 | 320 | """
|
312 | 321 |
|
313 | 322 |
|
|
0 commit comments