4 Commits

Author SHA1 Message Date
73529b353c 1.0.10 2022-03-08 18:55:00 +01:00
88d1b6596f fix(TimDataTable): cleanup 2022-03-08 18:55:00 +01:00
6ef8812a79 1.0.9 2022-03-08 18:54:10 +01:00
3034ef2edd fix(TTL): tables now have a default TTL for data of 1 MONTH 2022-03-08 18:54:10 +01:00
3 changed files with 15 additions and 8 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@pushrocks/smartclickhouse", "name": "@pushrocks/smartclickhouse",
"version": "1.0.8", "version": "1.0.10",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@pushrocks/smartclickhouse", "name": "@pushrocks/smartclickhouse",
"version": "1.0.8", "version": "1.0.10",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@depyronick/clickhouse-client": "^1.0.12", "@depyronick/clickhouse-client": "^1.0.12",

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartclickhouse", "name": "@pushrocks/smartclickhouse",
"version": "1.0.8", "version": "1.0.10",
"private": false, "private": false,
"description": "an odm for talking to clickhouse", "description": "an odm for talking to clickhouse",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

@ -32,10 +32,18 @@ export class TimeDataTable {
// create table in clickhouse // create table in clickhouse
await smartClickHouseDbRefArg.clickhouseClient await smartClickHouseDbRefArg.clickhouseClient
.queryPromise(`CREATE TABLE IF NOT EXISTS ${newTable.tableName} ( .queryPromise(`
timestamp DateTime64(3, 'Europe/Berlin'), CREATE TABLE IF NOT EXISTS ${newTable.tableName} (
message String timestamp DateTime64(3, 'Europe/Berlin'),
) ENGINE=MergeTree() ORDER BY timestamp`); message String
) ENGINE=MergeTree() ORDER BY timestamp
`);
// lets adjust the TTL
await smartClickHouseDbRefArg.clickhouseClient
.queryPromise(`
ALTER TABLE ${newTable.tableName} MODIFY TTL toDateTime(timestamp) + INTERVAL 1 MONTH;
`);
await newTable.updateColumns(); await newTable.updateColumns();
console.log(`=======================`) console.log(`=======================`)
@ -60,7 +68,6 @@ export class TimeDataTable {
} }
public columns: IColumnInfo[] = []; public columns: IColumnInfo[] = [];
public seenPaths: { pathName: string; type: TClickhouseColumnDataType }[] = [];
/** /**
* updates the columns * updates the columns