fix: migration for session replay
This commit is contained in:
@@ -2,7 +2,6 @@ import fs from 'node:fs';
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { TABLE_NAMES } from '../src/clickhouse/client';
|
import { TABLE_NAMES } from '../src/clickhouse/client';
|
||||||
import {
|
import {
|
||||||
addColumns,
|
|
||||||
createTable,
|
createTable,
|
||||||
modifyTTL,
|
modifyTTL,
|
||||||
runClickhouseMigrationCommands,
|
runClickhouseMigrationCommands,
|
||||||
@@ -25,8 +24,8 @@ export async function up() {
|
|||||||
'`is_full_snapshot` Bool',
|
'`is_full_snapshot` Bool',
|
||||||
'`payload` String CODEC(ZSTD(6))',
|
'`payload` String CODEC(ZSTD(6))',
|
||||||
],
|
],
|
||||||
orderBy: ['project_id', 'session_id', 'chunk_index'],
|
orderBy: ['project_id', 'session_id', 'started_at', 'chunk_index'],
|
||||||
partitionBy: 'toYYYYMM(started_at)',
|
partitionBy: 'toYYYYMMDD(started_at)',
|
||||||
settings: {
|
settings: {
|
||||||
index_granularity: 8192,
|
index_granularity: 8192,
|
||||||
},
|
},
|
||||||
@@ -42,16 +41,16 @@ export async function up() {
|
|||||||
];
|
];
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
path.join(__filename.replace('.ts', '.sql')),
|
path.join(import.meta.filename.replace('.ts', '.sql')),
|
||||||
sqls
|
sqls
|
||||||
.map((sql) =>
|
.map((sql) =>
|
||||||
sql
|
sql
|
||||||
.trim()
|
.trim()
|
||||||
.replace(/;$/, '')
|
.replace(/;$/, '')
|
||||||
.replace(/\n{2,}/g, '\n')
|
.replace(/\n{2,}/g, '\n')
|
||||||
.concat(';'),
|
.concat(';')
|
||||||
)
|
)
|
||||||
.join('\n\n---\n\n'),
|
.join('\n\n---\n\n')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!process.argv.includes('--dry')) {
|
if (!process.argv.includes('--dry')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user